netrecov Posted December 7, 2009 Share Posted December 7, 2009 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? Link to comment Share on other sites More sharing options...
omikron48 Posted December 7, 2009 Share Posted December 7, 2009 (edited) Use string concatenation. Run($varA & ":\wfx32\wssetup.exe") Edited December 7, 2009 by omikron48 Link to comment Share on other sites More sharing options...
netrecov Posted December 7, 2009 Author Share Posted December 7, 2009 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. Link to comment Share on other sites More sharing options...
netrecov Posted December 8, 2009 Author Share Posted December 8, 2009 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") EndFuncok 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. Link to comment Share on other sites More sharing options...
mistersquirrle Posted December 8, 2009 Share Posted December 8, 2009 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 We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
netrecov Posted December 8, 2009 Author Share Posted December 8, 2009 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. Link to comment Share on other sites More sharing options...
enaiman Posted December 8, 2009 Share Posted December 8, 2009 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 :) Link to comment Share on other sites More sharing options...
mistersquirrle Posted December 8, 2009 Share Posted December 8, 2009 (edited) Try instead of using ControlGetText, GUICtrlRead(). You're having trouble just selecting and when you hit ok, storing the letter you selected? Edited December 8, 2009 by mistersquirrle We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
netrecov Posted December 8, 2009 Author Share Posted December 8, 2009 (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 January 26, 2010 by Valik Link to comment Share on other sites More sharing options...
enaiman Posted December 8, 2009 Share Posted December 8, 2009 (edited) Misplaced quotes:Func wssetup()Run("$var & :\wfx32\WWSETUP.EXE")EndFuncRun($var & ":\wfx32\WWSETUP.EXE") Edited December 8, 2009 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 :) Link to comment Share on other sites More sharing options...
mistersquirrle Posted December 8, 2009 Share Posted December 8, 2009 (edited) Well, one error is this: Run("$var & :\wfx32\WWSETUP.EXE" should be something like this: Run("$varA" & ":\wfx32\WWSETUP.EXE") Edited December 8, 2009 by mistersquirrle We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
enaiman Posted December 8, 2009 Share Posted December 8, 2009 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 :) Link to comment Share on other sites More sharing options...
netrecov Posted December 8, 2009 Author Share Posted December 8, 2009 (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 December 8, 2009 by netrecov Link to comment Share on other sites More sharing options...
mistersquirrle Posted December 8, 2009 Share Posted December 8, 2009 (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 December 8, 2009 by mistersquirrle We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
netrecov Posted December 8, 2009 Author Share Posted December 8, 2009 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. Link to comment Share on other sites More sharing options...
mistersquirrle Posted December 8, 2009 Share Posted December 8, 2009 (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 December 8, 2009 by mistersquirrle We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
skyboy Posted December 8, 2009 Share Posted December 8, 2009 you need to remove the ~ too, and the msgbox, that's for debugging Link to comment Share on other sites More sharing options...
netrecov Posted December 8, 2009 Author Share Posted December 8, 2009 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 Link to comment Share on other sites More sharing options...
mistersquirrle Posted December 8, 2009 Share Posted December 8, 2009 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? We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
netrecov Posted December 8, 2009 Author Share Posted December 8, 2009 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now