Jump to content

Recommended Posts

Posted

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.

 

 
Posted

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.

 

 
Posted

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

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
×
×
  • Create New...