Sign in to follow this  
Followers 0
daveed

concatenate var textinput into run()

8 posts in this topic

hi,

i have a couple of text input boxs and would like to pass the values in them into to run()

like this

$aInput = GUICtrlCreateInput("-w", 10, 110, 120, 19)

$aInput2 = "100"

Run("filename" & '$aInput' & '$aInput2' "-z FILENAME.txt","", @SW_HIDE)

Share this post


Link to post
Share on other sites



Not sure completely, not tested, but I'm pretty sure it needs to look like this.

$aInput = GUICtrlCreateInput("-w", 10, 110, 120, 19)

Global $aInput2
$aInput2 = "100"


Run("filename" & GUICtrlRead($aInput) & $aInput2 &  "-z FILENAME.txt","", @SW_HIDE)

2 things you did wrong, the $aInput2 was not declared before you set a value to it, and you forgot an "&" in between the $aInput2 and "-z FILENAME.txt". $aInput2 could not be read by GuiCtrlRead because it is not a control inside a GUI, it is simply a variable that has a value.

~TK

Share this post


Link to post
Share on other sites

Not sure completely, not tested, but I'm pretty sure it needs to look like this.

$aInput = GUICtrlCreateInput("-w", 10, 110, 120, 19)

Global $aInput2
$aInput2 = "100"
Run("filename" & GUICtrlRead($aInput) & $aInput2 &  "-z FILENAME.txt","", @SW_HIDE)

2 things you did wrong, the $aInput2 was not declared before you set a value to it, and you forgot an "&" in between the $aInput2 and "-z FILENAME.txt". $aInput2 could not be read by GuiCtrlRead because it is not a control inside a GUI, it is simply a variable that has a value.

~TK

Didn't bother go in with the details, what he said.

Share this post


Link to post
Share on other sites

Thanks for the reply,

I now get a error: The system cannot find the file specified.

The .exe that is getting the flags are in the same dir.

This passes fine

Run("program.exe -w 100 -z FILENAME.txt","", @SW_HIDE)

I have tryed and the error applys to the following:

Run(@ScriptDir & "program.exe" & GUICtrlRead($aInput) & GUICtrlRead($aInput2) "-z FILENAME.txt","", @SW_HIDE)

Run("program.exe" & GUICtrlRead($aInput) & GUICtrlRead($aInput2) "-z FILENAME.txt","", @SW_HIDE)

Run("C:\tests\autoit\test\program.exe" & GUICtrlRead($aInput) & GUICtrlRead($aInput2) "-z FILENAME.txt","", @SW_HIDE)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Run(@ScriptDir & "program.exe"oÝ÷ Ûú®¢×m¶¼ºÚ"µÍ[ØÜ   [È ][ÝÉÌLÜÙÜ[K^I][ÝoÝ÷ Ø l£^*.j·©jË"«éÛ2¢é¢e¢µ§]x-ë)iÇzÜz{azf§vZ(«p­ªix2¢êßW©jØlwh¹¹^ªê-zÅ¢Û-i¶®¶­se'Vâb33²gV÷C²b33²fײ67&DF"fײb33²b3#·&öw&ÒæWRgV÷C²b33²fײuT7G&Å&VBb33c¶çWBfײgV÷C²gV÷C²fײuT7G&Å&VBb33c¶çWC"fײgV÷C²×¢dÄTäÔRçGBgV÷C²ÂgV÷C²gV÷C²Â5uôDR

Edit:

Takes time to re-write after a forum edit screw up!! :)

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Try this one here, since you are ALWAYS using 100

$aInput = GUICtrlCreateInput("-w", 10, 110, 120, 19)

$String = GuiCtrlRead($aInput)

Run("filename" & $String & "100 -z FILENAME.txt","", @SW_HIDE)

Share this post


Link to post
Share on other sites

Thanks, guys for the help and explaining it :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0