Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
As you can see, this is already concatenated and is done this way so I can store the output from everything in one variable.
The double quotes are throwing me. I understand this is what the quote constant is for but I can't seem to figure out the proper syntax for executing this command. I have had a variety of errors but the latest one is:
It often helps to post the entire code, in your case including the shell("<command to run>") in order to make sure the advice you receive addresses your issue.
Can you simply replace the double quotes in your command with single quotes? This typically works and LiveCode is not confused because the single quotes have no meaning to it, thus you can wrap the command with the required "..." and quote as necessary within the command using single quotes.
Last edited by wsamples on Sat Jul 06, 2013 7:09 am, edited 1 time in total.
In using the quote constant you need to be certain to add the " in the right places as you build the sting and confusion is very common in the beginning.
Example:
"this is a quoted "string" containing a quoted section"
becomes:
"this is a quoted" && quote & string & quote && "containing a quoted section"
The & concatenates two strings while && concatenates with an added space. Notice that we must fully quote the two sections of the original string which flank the section being quoted with constants.
I am happy to post the code. I did try using just the single quotes inside of "..." and the command prompt does not interpret the command correctly. In the following code I have attempted to use single quotes just so you can see what I was trying to accomplish.
on menuPick pItemName
hide group "Validate Settings"
switch pItemName
case "Validate Settings"
Global ipconfig
show group "Validate Settings"
set the hideconsolewindows to true
get shell("ipconfig /all | find 'Host Name'&ipconfig /all | find 'IP Address'&ipconfig /all | find 'Subnet Mask'&ipconfig /all | find 'DNS Servers'")
put it into ipconfig
set the itemDel to ":"
//check host name
if "ALOHABOH" is in ipconfig then
put "ALOHABOH" into fld "Computer Name"
set foregroundColor of fld "Computer Name" to "#2c9303"
else
put item 1 of ipconfig into fld "Computer Name"
set foregroundColor of fld "Computer Name" to "#e72b00"
set textStyle of fld "Computer Name" to "bold"
end if
//check IP address
if "192.168.1.100" is in ipconfig then
put "192.168.1.100" into fld "IP Address"
set foregroundColor of fld "IP Address" to "#2c9303"
else
put item 13 of ipconfig into fld "IP Address"
set foregroundColor of fld "IP Address" to "#e72b00"
set textStyle of fld "IP Address" to "bold"
end if
//check subnet mask
if "255.255.255.0" is in ipconfig then
put "PASS" into fld "Subnet Mask"
set foregroundColor of fld "Subnet Mask" to "#2c9303"
else
put "FAIL" into fld "Subnet Mask"
set foregroundColor of fld "Subnet Mask" to "#e72b00"
set textStyle of fld "Subnet Mask" to "bold"
end if
//check primary DNS
if "208.67.222.222" is in ipconfig then
put "PASS" into fld "Primary DNS"
set foregroundColor of fld "Primary DNS" to "#2c9303"
else
put "FAIL" into fld "Primary DNS"
set foregroundColor of fld "Primary DNS" to "#e72b00"
set textStyle of fld "Primary DNS" to "bold"
end if
//check secondary DNS
if "208.67.220.200" is in ipconfig then
put "PASS" into fld "Secondary DNS"
set foregroundColor of fld "Secondary DNS" to "#2c9303"
else
put "FAIL" into fld "Secondary DNS"
set foregroundColor of fld "Secondary DNS" to "#e72b00"
set textStyle of fld "Secondary DNS" to "bold"
end if
break
case "Restore Data"
hide group "Validate Settings"
break
end switch
end menuPick
Although Livecode isn't reporting any errors, the return from the command line is attached. Unfortunately the single quote method doesn't appear to work in this situation.
I appreciate you guys helping me out. I was hoping to get your option 3 to work since it is considerably less code. I will keep playing with it but at least now it is working.