TonyP Posted April 30, 2009 Share Posted April 30, 2009 (edited) I'm trying my hand at my first GUI script but I'm having some trouble... What I'm trying to do is use GUICtrlSetData to change the value of a Input field based on a FileOpenDialog selection and also a FileSelect Folder. But I can't seem to get it to work right because it always returns numbers... Its probably some stupid error on my part, but I've scoured the forums, the help file, and some other user's scripts who use GUICtrlSetData. Any ideas? expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $boxy = GUICreate("Mount WIM file", 411, 141, 192, 124) $Label1 = GUICtrlCreateLabel("Select the location of the WIM file you would like to mount:", 8, 8, 400, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $FileLocation = GUICtrlCreateInput("C:\", 8, 32, 321, 21) $Browse = GUICtrlCreateButton("Browse", 336, 30, 57, 23, $WS_GROUP) $Label2 = GUICtrlCreateLabel("Select the folder to mount the file to:", 8, 62, 250, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $FileLocation2 = GUICtrlCreateInput("C:\", 8, 86, 321, 21) $Browse2 = GUICtrlCreateButton("Browse", 336, 84, 57, 23, $WS_GROUP) $Mount = GUICtrlCreateButton("Mount", 8, 112, 90, 25, $WS_GROUP) $Unmount = GUICtrlCreateButton("Unmount", 100, 112, 90, 25, $WS_GROUP) $Test = GUICtrlCreateButton("Test", 200, 112, 90, 25, $WS_GROUP) $exit = GUICtrlCreateButton("Exit", 336, 112, 57, 25, $WS_GROUP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Browse $WIMFile = FileOpenDialog("Select WIM File", "C:\", "Images (*.wim)", 1 ) GUICtrlSetData($FileLocation, $WIMFile) GUICtrlSetBkColor($FileLocation, 0x00ff00) Case $Browse2 $MountFolder = FileSelectFolder("Select Mount Location", "C:\",1 + 4) GUICtrlSetData($FileLocation2, $MountFolder) GUICtrlSetBkColor($FileLocation2, 0x00ff00) Case $Test MsgBox(0,"Variable Contents","WIMFile has a value of: " & $FileLocation & @LF & "MountFolder has a value of: " & $FileLocation2) Case $Mount ShellExecuteWait("C:\temp\ImageX\imagex.exe", "/mountrw " & $FileLocation & " 1 " & $FileLocation2) Case $Unmount $Unmountfolder = FileSelectFolder("Select Folder to Unmount", "C:\",1 + 4) Case $exit Exit EndSwitch WEnd Edited May 1, 2009 by xenon2050 Link to comment Share on other sites More sharing options...
Valuater Posted April 30, 2009 Share Posted April 30, 2009 The folder selection works for me Win Xp sp3, Autoit 3.3.0.0 8) Link to comment Share on other sites More sharing options...
Yashied Posted April 30, 2009 Share Posted April 30, 2009 (edited) Works for me too (XP SP2, AutoIt 3.3.0.0). ??? Edited April 30, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
TonyP Posted May 1, 2009 Author Share Posted May 1, 2009 Yeah the folder selection works fine and the data in the input shows up fine. However, if you look towards the end of the script:Case $Test MsgBox(0,"Variable Contents","WIMFile has a value of: " & $FileLocation & @LF & "MountFolder has a value of: " & $FileLocation2)Case $Mount ShellExecuteWait("C:\temp\ImageX\imagex.exe", "/mountrw " & $FileLocation & " 1 " & $FileLocation2)When I run it those two variables have numerical values instead of the location they are suppose to have. This is what the message box shows. So the parameters for imagex.exe don't work since it doesn't appear to be returning the correct information... Link to comment Share on other sites More sharing options...
Yashied Posted May 1, 2009 Share Posted May 1, 2009 (edited) Yeah the folder selection works fine and the data in the input shows up fine. However, if you look towards the end of the script:Case $Test MsgBox(0,"Variable Contents","WIMFile has a value of: " & $FileLocation & @LF & "MountFolder has a value of: " & $FileLocation2)Case $Mount ShellExecuteWait("C:\temp\ImageX\imagex.exe", "/mountrw " & $FileLocation & " 1 " & $FileLocation2)When I run it those two variables have numerical values instead of the location they are suppose to have. This is what the message box shows. So the parameters for imagex.exe don't work since it doesn't appear to be returning the correct information...What are you doing? Look carefully at this lines.$FileLocation = GUICtrlCreateInput("C:\", 8, 32, 321, 21)$FileLocation2 = GUICtrlCreateInput("C:\", 8, 86, 321, 21)Then at this.ShellExecuteWait("C:\temp\ImageX\imagex.exe", "/mountrw " & $FileLocation & " 1 " & $FileLocation2)$FileLocation and $FileLocation2 is identifiers (controlID)!Use GUICtrlRead($FileLocation) and GUICtrlRead($FileLocation2). Edited May 1, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
TonyP Posted May 1, 2009 Author Share Posted May 1, 2009 (edited) What are you doing? Look carefully at this lines. $FileLocation = GUICtrlCreateInput("C:\", 8, 32, 321, 21) $FileLocation2 = GUICtrlCreateInput("C:\", 8, 86, 321, 21) Then at this. ShellExecuteWait("C:\temp\ImageX\imagex.exe", "/mountrw " & $FileLocation & " 1 " & $FileLocation2) $FileLocation and $FileLocation2 is identifiers (controlID)! Use GUICtrlRead($FileLocation) and GUICtrlRead($FileLocation2). Ahhh, I see. That did it! Thanks for your help! Funny thing is, I had just seen some usage of the GUICtrlRead and was trying to figure out if I could use that in this script somehow. As to what am I doing, I really don't know... Which is why I wanted help... Like I said, first GUI ever... Well besides some C#... Edit: For documentation purposes I changed this line: Case $Mount ShellExecuteWait("C:\temp\ImageX\imagex.exe", "/mountrw " & GUICtrlRead($FileLocation) & " 1 " & GUICtrlRead($FileLocation2)) Edited May 1, 2009 by xenon2050 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