Jump to content
Sign in to follow this  
Eclipse1024

Clarification request

Recommended Posts

Eclipse1024

Hi all,

I've very new to AutoIt though not new to scripting in general and I seek some clarification on whether my goals are achievable with AutoIt.

What I have created so far is a script that will monitor certain pixel colors and send keys when specific criteria are met. It's all very linear however and not over configurable short of editing the script directly so...

What I'd like to be able to do is as follows:

  • create a UI that will allow me to configure which pixels to monitor and which colors to react upon - each time I start the script I typically need to reset all the pixel locations and colors and therefore automating this task somewhat would be beneficial.
  • continue to monitor a specific set of pixels in linear order - what I would call the utility thread that runs continuously checking each defined pixel in turn and acting accordingly. This is the only piece I've written so far.
  • simultaneous watch another set of pixels and "break" into the loop if a certain set of criteria are met - this is what I'd call the priority thread that has the ability to break into aforementioned script. Being so used to linear scripting I have no idea if it's even possible to have these two threads running simultaneously. Basically, do X_action until Y_criteria=true then perform Y_action before returning to X_action, but Y_criteria is just as complicated as X_criteria hence my question.
  • dynamic control the criteria through the UI - at any time I'd like to be able to select an alternative set of predefined rules and have it modify the actions of the script on the fly. Basically have 3 or 4 radio buttons that would dictate which set of rules to follow.

I realize it would likely be much easier to provide a qualified answer if there were some samples to review but before I spend the time learning how to program the UI portion I wanted to first find out if my goals were even achievable.

Any comments gratefully appreciated!

Share this post


Link to post
Share on other sites
FireLord

Hi all,

I've very new to AutoIt though not new to scripting in general and I seek some clarification on whether my goals are achievable with AutoIt.

What I have created so far is a script that will monitor certain pixel colors and send keys when specific criteria are met. It's all very linear however and not over configurable short of editing the script directly so...

What I'd like to be able to do is as follows:

  • create a UI that will allow me to configure which pixels to monitor and which colors to react upon - each time I start the script I typically need to reset all the pixel locations and colors and therefore automating this task somewhat would be beneficial.
  • continue to monitor a specific set of pixels in linear order - what I would call the utility thread that runs continuously checking each defined pixel in turn and acting accordingly. This is the only piece I've written so far.
  • simultaneous watch another set of pixels and "break" into the loop if a certain set of criteria are met - this is what I'd call the priority thread that has the ability to break into aforementioned script. Being so used to linear scripting I have no idea if it's even possible to have these two threads running simultaneously. Basically, do X_action until Y_criteria=true then perform Y_action before returning to X_action, but Y_criteria is just as complicated as X_criteria hence my question.
  • dynamic control the criteria through the UI - at any time I'd like to be able to select an alternative set of predefined rules and have it modify the actions of the script on the fly. Basically have 3 or 4 radio buttons that would dictate which set of rules to follow.

I realize it would likely be much easier to provide a qualified answer if there were some samples to review but before I spend the time learning how to program the UI portion I wanted to first find out if my goals were even achievable.

Any comments gratefully appreciated!

It's possible in AutoIt. May not be easy though.


[center]See the Helpfile[/center]
While Alive()
	 DrinkWine();
}
[center][/center]

Share this post


Link to post
Share on other sites
Eclipse1024

  • create a UI that will allow me to configure which pixels to monitor and which colors to react upon - each time I start the script I typically need to reset all the pixel locations and colors and therefore automating this task somewhat would be beneficial.
  • dynamic control the criteria through the UI - at any time I'd like to be able to select an alternative set of predefined rules and have it modify the actions of the script on the fly. Basically have 3 or 4 radio buttons that would dictate which set of rules to follow.

Ok, so I think I may have found partial solutions to the first item above. It seems doable if I use MouseGetPos to return the new pixel location and then PixelGetColor to return the color. I'm just not sure how to trigger the MouseGetPos on a left mouse click since it returns the present mouse position as soon as the command is issued.

The second item above seems doable if I enable GUIOnEventMode but my question is, are there any performance side-effects I should consider when using GUIOnEventMode?

Also, on another note, I didn't seem to have much luck calling a function while using a variable. Example, trying to call Func Proc_1 with Call ("Proc_"+$f) where $f=1. Is there a way of accomplishing this?

Share this post


Link to post
Share on other sites
SmOke_N

Yes, we don't have multithreading, and using things such as OnEvent or AdlibEnable are going to steal from other process and slow down response time.

We do have however a way to launch multiple scripts spawned from the original and ran as an executable in script form.

/AutoIt3ExecuteScript

We don't use the "+" for anything other than addition (or as a literal string when in quotes).

For concatenation look under operators at the ampersand &.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Eclipse1024

Thanks for the tip on &. That looks like it'll work for me.

From what I gather reading the help file on /AutoIt3ExecuteScript this would still not allow me to pause the first script while the second one performed an action. My problem is the application I'm controlling would not take too kindly to having keystrokes sent to it simultaneously by two different scripts, if that makes sense.

Share this post


Link to post
Share on other sites
SmOke_N

Thanks for the tip on &. That looks like it'll work for me.

From what I gather reading the help file on /AutoIt3ExecuteScript this would still not allow me to pause the first script while the second one performed an action. My problem is the application I'm controlling would not take too kindly to having keystrokes sent to it simultaneously by two different scripts, if that makes sense.

Well, it seems though you have some knowledge of some type of coding.

What I would do is 1 of two things.

1. I'd set each script with a GUI or TCP setup, and communicate back and forth that way, telling each script what I needed to do that way.

or

2. I might use a HotKeySet() + Send() << From main script, telling the 2nd/3rd instance they need to hold the on and read maybe a text file for a change of coords or something.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Eclipse1024

I'm thinking what I might do is rework the logic of my initial script to include overriding scripts logic, rather than getting overly complicated trying to use multiple scripts passing notes back and forth.

The only thing I'm grappling with now is how I can set variables with MouseGetPos on a mouseclick. Essentially what I'd like to be able to do is click a button in the GUI that will start a process to capture the very next mouse click with MouseGetPos. Sample logic...

  • Click Button A to reset monitored pixel location
  • User depresses Button A in GUI
  • Next mouse click will be captured by MouseGetPos
  • The user manually positions the mouse over new pixel location and depresses left mouse button.
  • X and Y pos set to respective variables and/or written to Ini file for later consumption.

Share this post


Link to post
Share on other sites
SmOke_N

If you're using events/or GUIGetMsg ... look in your GUIConstantsEx.au3 file (in the include directory) for $GUI_EVENT_PRIMARYDOWN, then once you set a condition for that, you can use MouseGetPos() and store in Var, etc...


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Eclipse1024

If you're using events/or GUIGetMsg ... look in your GUIConstantsEx.au3 file (in the include directory) for $GUI_EVENT_PRIMARYDOWN, then once you set a condition for that, you can use MouseGetPos() and store in Var, etc...

I don't quite understand this. I've looked up the $GUI_EVENT_PRIMARYDOWN constant and see that it equals -7 but I'm unfamiliar with how to use UDFs I suppose. I've done some quick searches for some examples but didn't come up with much related. Can you elaborate?

Share this post


Link to post
Share on other sites
SmOke_N

I don't quite understand this. I've looked up the $GUI_EVENT_PRIMARYDOWN constant and see that it equals -7 but I'm unfamiliar with how to use UDFs I suppose. I've done some quick searches for some examples but didn't come up with much related. Can you elaborate?

Here are a couple of pages of possible examples of use:

http://www.autoitscript.com/forum/index.ph..._PRIMARYDOWN%5C


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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  

×