shea851 Posted September 7, 2007 Share Posted September 7, 2007 To start off, i'm not a programmer, and I basically know enough Autoit to automate tasks like reading colors on the screen and sending keystrokes, which proves very useful with certain games and etc. The GUI portion of Autoit i'm a total newb. But I don't really learn by reading manuals / help guides though, I learn by seeing something used in a script/program. I'm trying to create a GUI that will allow me to select an input .doc file and then convert it to a .html file. I'm sure this task will prove very difficult for me, but i'm up for a challenge. The first problem i've run into is that I need to create a button that opens another window where you can choose a file. Now, I know how to make a button close a program or run one or whatever, but as far as opening a new window where you can navigate through the files on your computer... i have no idea the code for that. Can someone please post a small GUI script that has that feature in it so I can see how it works? If more information is needed I can post a screenshot Link to comment Share on other sites More sharing options...
Alek Posted September 7, 2007 Share Posted September 7, 2007 look in the help file for FileOpenDialog [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
shea851 Posted September 7, 2007 Author Share Posted September 7, 2007 Thanks Alek I actually managed to find a script while I was waiting for a reply here with that exact command and I added the following code to my script, and it works perfectly If $nMsg = $button Then FileOpenDialog("Choose file...",@DesktopCommonDir,"All (*.doc)") Else EndIf And now my next task to tackle.. to have it populate a GUICtrlCreateInput with the file that was just selected... Link to comment Share on other sites More sharing options...
Monamo Posted September 7, 2007 Share Posted September 7, 2007 Thanks Alek I actually managed to find a script while I was waiting for a reply here with that exact command and I added the following code to my script, and it works perfectly If $nMsg = $button Then FileOpenDialog("Choose file...",@DesktopCommonDir,"All (*.doc)") Else EndIf And now my next task to tackle.. to have it populate a GUICtrlCreateInput with the file that was just selected... If $nMsg = $button Then $SelectedDoc = FileOpenDialog("Choose file...",@DesktopCommonDir,"All (*.doc)") Else EndIf GUICtrlCreateInput($SelectedDoc,left,top,width,height) ;yada, yada - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
shea851 Posted September 7, 2007 Author Share Posted September 7, 2007 (edited) I see what you're going at, and it seems like it would work, but it doesn't.. Here is my whole script: #include <GUIConstants.au3> #NoTrayIcon #Region ### START Koda GUI section ### Form=h:\koda\forms\test.kxf $Form1_1 = GUICreate("Convert This!", 443, 80, 228, 172) $Group1 = GUICtrlCreateGroup("Select the .doc you want to convert: ", 0, 0, 441, 57) $button = GUICtrlCreateButton("...", 400, 24, 25, 17, 0) GUICtrlCreateInput($SelectedDoc, 8, 24, 385, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $File = GUICtrlCreateMenu("&File") $Exit = GUICtrlCreateMenuItem("Exit", $File) $Help = GUICtrlCreateMenu("&Help") $About = GUICtrlCreateMenuItem("About", $Help) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If $nMsg = $button Then $SelectedDoc = FileOpenDialog("Choose file...",@DesktopCommonDir,"All (*.doc)") Else EndIf WEnd Right now it doesn't work because it's trying to use "$SelectedDoc" which is not declared yet. However if I move "GUICtrlCreateInput($SelectedDoc, 8, 24, 385, 21)" below the GetGuiMsg loop then the script runs, but I can't see my Input box... Edited September 7, 2007 by shea851 Link to comment Share on other sites More sharing options...
Monamo Posted September 7, 2007 Share Posted September 7, 2007 I see what you're going at, and it seems like it would work, but it doesn't.. Here is my whole script: #include <GUIConstants.au3> #NoTrayIcon #Region ### START Koda GUI section ### Form=h:\koda\forms\test.kxf $Form1_1 = GUICreate("Convert This!", 443, 80, 228, 172) $Group1 = GUICtrlCreateGroup("Select the .doc you want to convert: ", 0, 0, 441, 57) $button = GUICtrlCreateButton("...", 400, 24, 25, 17, 0) GUICtrlCreateInput($SelectedDoc, 8, 24, 385, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $File = GUICtrlCreateMenu("&File") $Exit = GUICtrlCreateMenuItem("Exit", $File) $Help = GUICtrlCreateMenu("&Help") $About = GUICtrlCreateMenuItem("About", $Help) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If $nMsg = $button Then $SelectedDoc = FileOpenDialog("Choose file...",@DesktopCommonDir,"All (*.doc)") Else EndIf WEnd Right now it doesn't work because it's trying to use "$SelectedDoc" which is not declared yet. However if I move "GUICtrlCreateInput($SelectedDoc, 8, 24, 385, 21)" below the GetGuiMsg loop then the script runs, but I can't see my Input box... Here ya go - When you create the input box, it will have a default of a blank field, then the button that triggers the FileOpen will write the selection to the input box: #include <GUIConstants.au3> #NoTrayIcon #Region ### START Koda GUI section ### Form=h:\koda\forms\test.kxf $Form1_1 = GUICreate("Convert This!", 443, 80, 228, 172) $Group1 = GUICtrlCreateGroup("Select the .doc you want to convert: ", 0, 0, 441, 57) $button = GUICtrlCreateButton("...", 400, 24, 25, 17, 0) $document = GUICtrlCreateInput("", 8, 24, 385, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $File = GUICtrlCreateMenu("&File") $Exit = GUICtrlCreateMenuItem("Exit", $File) $Help = GUICtrlCreateMenu("&Help") $About = GUICtrlCreateMenuItem("About", $Help) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If $nMsg = $button Then $SelectedDoc = FileOpenDialog("Choose file...",@DesktopCommonDir,"All (*.doc)") GUICtrlSetData($document,$SelectedDoc) Else EndIf WEnd - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
shea851 Posted September 7, 2007 Author Share Posted September 7, 2007 Thanks a ton, that worked for me. Attempting to integrate some more features and whatnot, so I may be back.. 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