Jump to content

Recommended Posts

Posted

This is my script:

Dim $variable

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("MyVar", 155, 90, 398, 238)
$Button1 = GUICtrlCreateButton("Create Variable", 8, 8, 137, 33, 0)
$Button2 = GUICtrlCreateButton("Display Variable", 8, 48, 137, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            $variable = inputbox("Variable","type Something")
        Case $button2
            MsgBox(0,"Variable","The Variable is: " & $variable)
    EndSwitch
WEnd

When you run it a GUI appears with two buttons:

"create Variable" &

"Display Variable"

First you choose "Create Variable", then you enter some text

Next you choose "Display Variable", you will receive a msgbox displaying the variable you just created

Now Let's say i want to first create my variable, exit the script, reopen the script, click "Display variable" and see the variable i assigned before i closed the script

First off, Is this even possible, and if so, can someone please tell me how (examples would help)

Posted

Try

;Dim $variable

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("MyVar", 155, 90, 398, 238)
$Button1 = GUICtrlCreateButton("Create Variable", 8, 8, 137, 33, 0)
$Button2 = GUICtrlCreateButton("Display Variable", 8, 48, 137, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $variable = InputBox("Variable", "type Something")
            IniWriteSection(@ScriptDir & "\test.ini", "section name", "Variable=" & $variable)
        Case $Button2
            $variable = IniRead(@ScriptDir & "\test.ini", "section name", "Variable", "No variable has been created")
            MsgBox(0, "Variable", "The Variable Is: " & $variable)
    EndSwitch
WEnd

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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...