Jump to content

Simple question i'm sure.....


Recommended Posts

Good day all,

I've been using AutoIT for years now and i have a simple question that has always eluded me, is it possible to have a reference value that can be "linked" to by many different commands but always use the same value that's in place?

I could be asking this the wrong way so let me give you an idea of what i'm talking about in a simple format:

x= 10000

MouseMove (230,190)

MouseClick ("LEFT")

Sleep (x)

MouseMove (300,190)

MouseClick ("LEFT")

Sleep (x)

MouseMove (200,360)

MouseClick ("LEFT")

Sleep (x)

MouseMove (200,490)

MouseClick ("LEFT")

Sleep (x)

MouseMove (350,360)

MouseClick ("LEFT")

Sleep (x)

So in the case that the value of "X" ever needed to be change it was one edit versus 5 in this case.

Thanks for your time and any input would be much appreciated!

-JP

Link to comment
Share on other sites

  • Moderators

jpinnegar,

Welcome to the AutoIt forum. :)

I've been using AutoIT for years now and i have a simple question that has always eluded me, is it possible to have a reference value that can be "linked" to by many different commands but always use the same value that's in place?

Pardon me for asking, but whatever have you been doing with AutoIt for "years" if the concept of a variable has not yet crossed your path? :wacko:

All you need to do is declare a variable like this:

$x= 10000 ; Note the leading $ - this defines the $x as a variable

and then you can reference it like this:

Sleep ($x)

where $x will be replaced by the value assigned to it when the code is run. :)

You might benefit from a quick read of the excellent tutorials that you will find here and here - they could save you a lot of frustration. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thank you!

Up to this point I've only needed simple move and click scripts for friends and family, but as time has moved on, they are asking for more complex scripts and i'm trying to teach myself how to do it the correct way.

Thank you again for your time!

Link to comment
Share on other sites

  • Moderators

jpinnegar,

Please do read those tutorials - they really will help you. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Moderators

Hi, Bhanumati. Please do not hijack someone else's thread. Please create a new thread to ask your question, and provide as much information as possible ("how can upload a resume using autoit" isn't going to do it) :)

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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
 Share

  • Recently Browsing   0 members

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