Sign in to follow this  
Followers 0
MasonMill

Help with array, i think

20 posts in this topic

Ok so after this message tab pops up pixelsearch detects it and sends an away message, i want to start clicking in intervals to the right though. How do i construct the $stop variable to tell it wehn to stop? This is what i have so far.

$stop = 539, 693
      For $i = 0 to $stop Step 5
       mouseclick("left", $redtab[0] + $i , 693)
       sleep(500)
      Next

Share this post


Link to post
Share on other sites



MasonMill,

How do i construct the $stop variable to tell it wehn to stop

Unless you give us some idea of what criterion you wish to use define the stop point we cannot help. :)

Do you want a fixed number of clicks? Until the edge of the screen? Perhaps until something happens?

Over to you! :(

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

well, so 693 is the Y coord I want it to click along and I want it to stop at the X coord 539. Which is where the end of the chat window is located, so i want it to stop there. The ($stop = 539, 693) is basically the mouse coord I dont want it to click past.

Share this post


Link to post
Share on other sites

i just dont know how to construct $stop such that it wont click past it.

Share this post


Link to post
Share on other sites

MasonMill,

So you want to click from the coordinates of $redtab until the point defined in your $stop variable ( example 539 x 693) at 5 pixel intervals.

How are the coordinates stored in $stop? If it is an array (Dim $stop = [539, 693]) then you do this:

For $i = $redtab[0] To $stop[0] Step 5
    mouseclick("left", $i , $stop[1])
Next

How is that? :(

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Awesome, thank you.

Share this post


Link to post
Share on other sites

Why do you the Dim?

Share this post


Link to post
Share on other sites

It gave me an error that says:

dim $stop = [539,693]

dim $stop = ^ERROR

ERROR: Subscript used with non-Array variable.

Share this post


Link to post
Share on other sites

MasonMill,

To make clear it was an array. Normally I never use Dim, only Global and Local, but I was not sure of the scope you wanted to use.

How do you get the coordinates of the stop point into the variable $stop? Is it from another PixelSearch? If so then AutoIt creates the array for you and you are not forced to declare it beforehand. Other functions (like _FileReadToArray, for example) require you to declare the array yourself before you call the function.

It is a good idea to get into the habit of properly declaring your variables in scripts. It will pay dividends when you get into more complex code. :(

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Yeah pixel search gave me the coords of the tab originally. ($redtab). But the message box ends at 539, 693 so i just picked them myself. I wanted it to click along the tabs becasue they have Xs on them to remove them. so i wanted to click to the right to remove all the tabs. The code is structured properly i believe but I don't know the syntax well enough yet in autoit. Should i use local or global?

Share this post


Link to post
Share on other sites

dim $stop[2] = [539,693]


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

George,

I will now go and write 50 times on the board: "I will not forget the dimensions when declaring an array the next time". :(

MasonMill,

Should i use local or global?

It depends on where you are in your code and how you want to use the array.

If the array is only used within a single function, the Local is correct. You can still use it in other functions, but you must pass it as a parameter.

If the array is used by many functions, then you might consider declaring it as Global so they can all see it. But you should try and limit the number of Global variables to a minimum for various reasons, among which is the chance of overwriting them when you do not mean to! :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

So the 2th array cell becomes that coord, correct? So the last cell can have an X and Y coord? I'm sorry I'm just trying to understand why it works the way it does.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

MasonMill,

There is a very good tutorial on arrays in the Wiki. :(

M23

Edit: Speeling!

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

thanks! Ill go check that out. I appreciate the help guys, im almost done with CSE 1311(C programming) at my university and it has given tremendous insight to all this. I love it!

Share this post


Link to post
Share on other sites

lightbulb!! thanks!

Share this post


Link to post
Share on other sites

George,

I will now go and write 50 times on the board: "I will not forget the dimensions when declaring an array the next time". :(

M23

I've been letting you off to easy lately, make it a hundred.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

any ideas why this isnt working properly? Its zooms across the screen and doesnt stop at 539, 693. if it steps over that coord does it just keep going? Even when i put step 1 it does the same thing.

$stop[2] = [539, 693]
      For $i = 0 to $stop Step 5
       mouseclick("left", $redtab[0] + $i , $stop[1])
       sleep(500)
      Next

Share this post


Link to post
Share on other sites

It jumps down to the correct Y coordinate then zooms off in the X direction without stopping till it gets way across the screen.

Share this post


Link to post
Share on other sites

To use the value 539 from the array as the the ending value of the 'for' loop, so it goes from 0 to 539 you need to use $stop[0] in your 'for' line as below

For $i = 0 to $stop[0] Step 5

I dont know what vaule is contained in $redtab[0] but this will stop it ending at 539 as it will be added to 539 and also if wont start at zero, it would start at the value of $redtab[0], if this is intended to be the start pos the following lines would apply.

For $i = $redtab[0] to $stop[0] Step 5
       mouseclick("left",  $i , $stop[1])

Not really understanding what you require and not knowing what $redtab[0] is/does is not helping. sorry if this doesnt help you out much.


GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.

Share this post


Link to post
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
Sign in to follow this  
Followers 0