Draygoes Posted September 21, 2007 Share Posted September 21, 2007 I have tried everything that I can to get this to work. It Just wont. I have a file save function and I have it write to a gui control, an imput. Problem is, the text in the input box cant seem to be read unless its put in by the user!!! Heres my code: #include<GUIConstants.au3> $gui = GUICreate("Build A Batch Workshop", 500,250) GUISetState() $stuff = GUICtrlCreateLabel( "Please save your compiled script. (Must end with .exe extention.)", 0, 0, 500, 18) $path = GUICtrlCreateInput( "", 0, 50, 350, 18) $button = GUICtrlCreateButton( "Select", 370, 50, 100, 18) $finish = GUICtrlCreateButton( "Finish", 190, 150, 125, 50) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button $var = FileSaveDialog( "Save Compiled Exe as: ", @DesktopDir, "Executible Files (*.exe)", 16) GUICtrlSetData( $path, $var) Case $msg = $finish $data2 = GUICtrlRead( $path, 0 ) FileWrite( "path.lne", $data2) Exit EndSelect WEnd Exit If the user enters text into the box, it works fine. It writes the text to file exactly like I tell it to. But, when I add text using guictrlsetdata, It wont read it. Can anyone fix please??? thx Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
Nahuel Posted September 21, 2007 Share Posted September 21, 2007 Dude, that works... Link to comment Share on other sites More sharing options...
enaiman Posted September 21, 2007 Share Posted September 21, 2007 Nahuel is right - it works. Maybe you can't find your saved file (path.lne) complete then the whole path - e.g. c:\path.lne 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...
Draygoes Posted September 21, 2007 Author Share Posted September 21, 2007 Thats not what I want it to do though. I want it to create a file in the same directory that the scipt is in, then write into the file the exact path that the user selected when they hit select. The problem is, it creates the file in the path that the user selected. I hope that I explained that right lol. Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
Nahuel Posted September 21, 2007 Share Posted September 21, 2007 But...it does what you want it to do... you should do what enaiman said. Something like this: #include<GUIConstants.au3> $gui = GUICreate("Build A Batch Workshop", 500,250) GUISetState() $stuff = GUICtrlCreateLabel( "Please save your compiled script. (Must end with .exe extention.)", 0, 0, 500, 18) $path = GUICtrlCreateInput( "", 0, 50, 350, 18) $button = GUICtrlCreateButton( "Select", 370, 50, 100, 18) $finish = GUICtrlCreateButton( "Finish", 190, 150, 125, 50) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button $var = FileSaveDialog( "Save Compiled Exe as: ", @DesktopDir, "Executible Files (*.exe)", 16) GUICtrlSetData( $path, $var) Case $msg = $finish $data2 = GUICtrlRead( $path, 0 ) FileWrite( @ScriptDir&"\path.lne", $data2) Exit EndSelect WEnd Exit Link to comment Share on other sites More sharing options...
aslani Posted September 21, 2007 Share Posted September 21, 2007 (edited) Ok try this; Case $msg = $finish $data2 = GUICtrlRead($path) $file = FileOpen(@ScriptDir & "\path.lne", 2) FileWrite(@ScriptDir & "\path.lne", $data2) FileClose($file) Edited September 21, 2007 by aslani [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version 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