Jump to content

conditional sequence


Recommended Posts

Hi,

I've created my first script and it's working! Hooray!

I'd like to expand on its functionality and I'm not sure what to ask or search for in the forums.

I'm using pixel search and when it finds the color range it sends keys. I'd like it to send the keys in sequence depending on what the last key that was sent.

pixelsearch found its color

send 1

search again

pixel search found its color

send 2

search again

pixel search found its color

send 3

I've read the FAQ's and searched the forums for the last several hours and I'm sure the answer is here but don't know how to phrase what 'it' should be.

If someone could give me an example or tell me what kind of feature I'm trying to accomplish that would be great.

Thanks in advance. :)

Link to comment
Share on other sites

Hi,

I've created my first script and it's working! Hooray!

I'd like to expand on its functionality and I'm not sure what to ask or search for in the forums.

I'm using pixel search and when it finds the color range it sends keys. I'd like it to send the keys in sequence depending on what the last key that was sent.

pixelsearch found its color

send 1

search again

pixel search found its color

send 2

search again

pixel search found its color

send 3

I've read the FAQ's and searched the forums for the last several hours and I'm sure the answer is here but don't know how to phrase what 'it' should be.

If someone could give me an example or tell me what kind of feature I'm trying to accomplish that would be great.

Thanks in advance. :)

Welcome to the AutoIt forums ;)

If you want each Send to use the next key, or character, then there are many ways it could be done. One way is to have a string at the start which is all the keys you want to use in the sequence you want them. Have a global variable $nextKey say, and have a function SendNext like this maybe

Global $nextKey = 1;start at the first one
Global $Seq = "thisistheorder"

pixelsearch found its color
sendNext($nextKey,$seq)
search again
pixel search found its color
sendNext($nextKey,$seq)

.
.
.
Func sendNext(ByRef $iPos,$sList)

 send('"' & StringMid($sList,$iPos,1) & '"')

 if $iPos < StringLen($sList) then $iPos += 1

endfunc

If the keys to send are more complicated than a single character each time then you could use an array of strings.

Global $nextKey = 1;start at the first one
Global $Seq[3] = ["this","is","theorder"]

pixelsearch found its color
sendNext($nextKey,$seq)
search again
pixel search found its color
sendNext($nextKey,$seq)

.
.
.
Func sendNext(ByRef $iPos,$sList)

 send($sList[$iPos - 1])

 if $iPos < UBound($sList) then $iPos += 1

endfunc

None of the code has been tested!

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...