Jump to content

How to use variable in the code?


Recommended Posts

; Activate test.txt
WinActivate ("test.txt")

; Delay 2 seconds
Sleep (2000)

; Inserting text to notepad
Opt('SendKeyDelay', 70)
ControlSend ("test.txt", "", "Edit1", "HELLO WORLD")

; Delay 2 seconds
Sleep (200)

; Choosing menu items
WinMenuSelectItem("[CLASS:Notepad]", "", "&File", "Save &As...")

; Delay 2 seconds

; Change file name
ControlSend ("Save As", "", "Edit1", "HELLO WORLD.txt")

; Delay 2 seconds
Sleep (2000)

; Save file button
ControlClick ( "Save As", "", "&Save")

; Delay 2 seconds
sleep (2000)

; Closing Notepad
WinClose("[CLASS:Notepad]", "")

I am testing Autoit becouse i want to us it at my work to do some repetitive tasks, could someone help me with variables? Here i have little code which opens text file, inserts some text then going to menu settings changing the name of the file then saves it and closes it. I would like to have variable at "HELLO WORLD" for example (My variable) = "HELLO WORLD" so i could insert my variable and all code changes to it. But i can't find example of it 😕

Link to comment
Share on other sites

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...