Sign in to follow this  
Followers 0
netrecov

Noob trying to run a program with a changing drive letter

34 posts in this topic

GuiCtrlCreatecombo("Drives", 250, 80, 120, 100)

GUICtrlSetData(-1, "A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z")

$varA = ControlGetText("Drives", "", "")

$wssetup = GuiCtrlCreateButton("wssetup", 320, 145)

GUICtrlSetOnEvent($wssetup, "wssetup")

Func wssetup()

Run("$varA:\wfx32\wssetup.exe")

EndFunc

here is my script. I cant seem to figure out how to get the drive letter in the combo box to be a variable to change into the func box. any ideas?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Use string concatenation.

Run($varA & ":\wfx32\wssetup.exe")
Edited by omikron48

Share this post


Link to post
Share on other sites

Use string concatenation.

Run($varA & ":\wfx32\wssetup.exe")

GuiCtrlCreatecombo("Drives", 250, 80, 120, 100)

GUICtrlSetData(-1, "A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z")

$varA = ControlGetText("Drives", "", "")

$wssetup = GuiCtrlCreateButton("wssetup", 320, 145)

GUICtrlSetOnEvent($wssetup, "wssetup")

Func wssetup()

Run($varA & ":\wfx32\wssetup.exe")

EndFunc

ok here is what it says now. I still can't figure this out. I think I am overlooking something.

Share this post


Link to post
Share on other sites

GuiCtrlCreatecombo("Drives", 250, 80, 120, 100)

GUICtrlSetData(-1, "A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z")

$varA = ControlGetText("Drives", "", "")

$wssetup = GuiCtrlCreateButton("wssetup", 320, 145)

GUICtrlSetOnEvent($wssetup, "wssetup")

Func wssetup()

Run($varA & ":\wfx32\wssetup.exe")

EndFunc

ok here is what it says now. I still can't figure this out. I think I am overlooking something. I am just wanting to be able to change drive letter for that program.

Share this post


Link to post
Share on other sites

Are you trying to make a program that runs and does something on that drive? because if so, one way to identify that drive is to create a file on the root of the drive, like "This_drive.txt", doesn't have to be anything special, and then have autoit search for that file in all the drives that are connected, so then when it finds it, it knows it has the right drive. I'm not sure if this is what you want though, but it's a suggestion


RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites

Are you trying to make a program that runs and does something on that drive? because if so, one way to identify that drive is to create a file on the root of the drive, like "This_drive.txt", doesn't have to be anything special, and then have autoit search for that file in all the drives that are connected, so then when it finds it, it knows it has the right drive. I'm not sure if this is what you want though, but it's a suggestion

Actually to better explain. i am trying to create this script to be able to change drive letters on the fly to point to different installs of this software and run that wssetup.exe. the path for run is fine. i am just trying to figure out how to be able to select a drive letter in the create combo box and have that variable be able to change in my func section.

Share this post


Link to post
Share on other sites

Check your other post (you have a duplicate one in the GUI section) - I gave you a solution there.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Try instead of using ControlGetText, GUICtrlRead(). You're having trouble just selecting and when you hit ok, storing the letter you selected?

Edited by mistersquirrle

RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Thank you everyone for your help. I know i have another post with the same issue. I am trying to spread my question more so maybe i can get the issue resolved. I put your text it and it still doesnt work. I have created a button directly for it and that one seems to work. here is the whole script. hope it helps

<Code removed>

Edited by Valik

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Misplaced quotes:

Func wssetup()

Run("$var & :\wfx32\WWSETUP.EXE")

EndFunc

Run($var & ":\wfx32\WWSETUP.EXE")

Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Well, one error is this:

Run("$var & :\wfx32\WWSETUP.EXE"

should be something like this:

Run("$varA" & ":\wfx32\WWSETUP.EXE")
Edited by mistersquirrle

RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites

Run("$varA" & ":\wfx32\WWSETUP.EXE")

Run($varA & ":\wfx32\WWSETUP.EXE")
- no quotes around a variable name!

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Well, one error is this:

[color=#1C2837][font=arial, verdana, tahoma, sans-serif][size=2]Run("$var & :\wfx32\WWSETUP.EXE")[/size][/font][/color]

should be something like this:

[color=#1C2837][font=arial, verdana, tahoma, sans-serif][size=2]Run("$varA" & ":\wfx32\WWSETUP.EXE")[color=#000000][size=3]

that's how it was originally but i was playing aaround in it trying to get it to work. I put it back how you said and it still wont open the file. is there any other ways to have the drive letter change from what is selected in the combo list?

Func wssetup()

Run($varA & ":\wfx32\WWSETUP.EXE")

EndFunc

this is how it looks now.

Edited by netrecov

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

All right, so here's your reading error: you put GUICtrlRead() RIGHT after you created the GUIComboBox, which will read the default value. In the loop you need to have it read the combobox when you click the setup, or some other button. It has to read it right before you execute whatever it is you want to do, otherwise it'll give an inaccurate value.

Test this out

Func wssetup()
    $varA = GUICtrlRead($MyCombo)
    MsgBox(0,"",$varA)
;~ Run("$var & :\wfx32\WWSETUP.EXE")
EndFunc

Run($varA & ":\wfx32\WWSETUP.EXE")
- no quotes around a variable name!

Ahh, yeah, sorry thanks. I wasn't paying attention Edited by mistersquirrle

RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites

All right, so here's your reading error: you put GUICtrlRead() RIGHT after you created the GUIComboBox, which will read the default value. In the loop you need to have it read the combobox when you click the setup, or some other button. It has to read it right before you execute whatever it is you want to do, otherwise it'll give an inaccurate value.

Test this out

Func wssetup()
    $varA = GUICtrlRead($MyCombo)
    MsgBox(0,"",$varA)
;~ Run("$var & :\wfx32\WWSETUP.EXE")
EndFunc

ok i replace my old func with that one. ran it i got the message box "C". then took out the ";" for the run, re ran the script and nothing.

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Well, did you have it like

Func wssetup()
    $varA = GUICtrlRead($MyCombo)
    MsgBox(0,"",$varA)
 Run("$var & :\wfx32\WWSETUP.EXE")
EndFunc

??

or

Func wssetup()
    $varA = GUICtrlRead($MyCombo)
   ; MsgBox(0,"",$varA)
Run($varA & ":\wfx32\WWSETUP.EXE")
EndFunc

^that should return "c:\wfx32\WWSETUP.EXE" in the run command. "Run("$var & :\wfx32\WWSETUP.EXE")" would return "$var & :\wfx32\WWSETUP.EXE"

BTW, check your variables, you put just $var in the run command, which would yield nothing, I just caught that.

Edited by mistersquirrle

RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites

you need to remove the ~ too, and the msgbox, that's for debugging

Share this post


Link to post
Share on other sites

ame='netrecov' date='07 December 2009 - 05:36 PM' timestamp='1260236212' post='751849']

Well, did you have it like

Func wssetup()
    $varA = GUICtrlRead($MyCombo)
    MsgBox(0,"",$varA)
 Run("$var & :\wfx32\WWSETUP.EXE")
EndFunc

??

or

Func wssetup()
    $varA = GUICtrlRead($MyCombo)
   ; MsgBox(0,"",$varA)
Run($varA & ":\wfx32\WWSETUP.EXE")
EndFunc

^that should return "c:\wfx32\WWSETUP.EXE" in the run command. "Run("$var & :\wfx32\WWSETUP.EXE")" would return "$var & :\wfx32\WWSETUP.EXE"

BTW, check your variables, you put just $var in the run command, which would yield nothing, I just caught that.

yeah i caught that too.... this is what i got now

$MyCombo = GuiCtrlCreatecombo("Drives", 250, 80, 120, 100)

GUICtrlSetData(-1, "A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z")

$wssetup = GuiCtrlCreateButton("wssetup", 320, 145)

GUICtrlSetOnEvent($wssetup, "wssetup")

then

Func wssetup()

$varA = GUICtrlRead($MyCombo)

; MsgBox(0,"",$varA)

Run($varA & ":\wfx32\WWSETUP.EXE")

EndFunc

;Func wssetup()

; Run($varA & ":\wfx32\WWSETUP.EXE")

;EndFunc

Func wssetup2()

Run("C:\wfx32\WSSETUP.EXE")

EndFunc

Share this post


Link to post
Share on other sites

that looks good to me, have you tested it? And is wssetup2 just for testing? since the drive is fixed, just to make sure it does actually work, right?


RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites

that looks good to me, have you tested it? And is wssetup2 just for testing? since the drive is fixed, just to make sure it does actually work, right?

yes and yes, thats how i know it still isn't working. i have confirmed that the wssetup2 will successfully launch the software

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