Sign in to follow this  
Followers 0
tous

Pseduo to real code

3 posts in this topic

Ello, I started looking into Autoit to make a basic automation process for a certain application I use for work. I didn't think it would be very tricky(still dont think it is) but I havn't done any coding in a looong time and Im too old for this stuff now. I don't think this needs much to go from pseudo to real code. Basically what I need is a script to check a certain memory address withing a windows process ever 5 or so seconds, and then make a very simple choise on what keystroke to make. F1 if the value is out of normal range(1-1000), F2 if the value is the same over a 2 second period, and F3 if the value is increasing. As such it would need real world delays, and need to read the value from another application, and execute a keystroke(without deselection/removing priority from said application), those are the 3 stickie bits.

wait 2 real world second

$ID = _MemoryOpen(ProcessExists ( "delphi.exe" ))

$Address=0x(TO BE MANUALLY SET PRIOR TO RUNNING EACH TIME) - the application appears to have security preventing me from getting the pointer so Ill need to look this up every time I lunch the application

$ValuecheckA=_MemoryRead($Address,$ID)

wait 2 real seconds

$ValuecheckB=_MemoryRead($Address,$ID)

$ValueCalc = $ValuecheckA - $valuecheckB

If $ValueClac = 0

execute Keystroke F2

end if

If $ValueClac < 0(negative)

execute Keystroke F3

end if

If $Valuecheckb = 0 or anything above 1000

execute Keystroke F1

end if

wait 2 real second

and then loop the whole dealy over again till the cows come home.

Obviously extremely ruff, but if any of you younger folks could help turn this pseudo script into actually script it would be greatly appreciated. Biggest issues are an effective wait/delay code, and I haven't the foggiest on how to execute a keystroke using AI.

Share this post


Link to post
Share on other sites



Ello, I started looking into Autoit to make a basic automation process for a certain application I use for work. I didn't think it would be very tricky(still dont think it is) but I havn't done any coding in a looong time and Im too old for this stuff now. I don't think this needs much to go from pseudo to real code. Basically what I need is a script to check a certain memory address withing a windows process ever 5 or so seconds, and then make a very simple choise on what keystroke to make. F1 if the value is out of normal range(1-1000), F2 if the value is the same over a 2 second period, and F3 if the value is increasing. As such it would need real world delays, and need to read the value from another application, and execute a keystroke(without deselection/removing priority from said application), those are the 3 stickie bits.

wait 2 real world second

$ID = _MemoryOpen(ProcessExists ( "delphi.exe" ))

$Address=0x(TO BE MANUALLY SET PRIOR TO RUNNING EACH TIME) - the application appears to have security preventing me from getting the pointer so Ill need to look this up every time I lunch the application

$ValuecheckA=_MemoryRead($Address,$ID)

wait 2 real seconds

$ValuecheckB=_MemoryRead($Address,$ID)

$ValueCalc = $ValuecheckA - $valuecheckB

If $ValueClac = 0

execute Keystroke F2

end if

If $ValueClac < 0(negative)

execute Keystroke F3

end if

If $Valuecheckb = 0 or anything above 1000

execute Keystroke F1

end if

wait 2 real second

and then loop the whole dealy over again till the cows come home.

Obviously extremely ruff, but if any of you younger folks could help turn this pseudo script into actually script it would be greatly appreciated. Biggest issues are an effective wait/delay code, and I haven't the foggiest on how to execute a keystroke using AI.

This forum doesn't write scripts for you, it answers support questions and helps you learn to do it yourself. I am also very likely older than you are, so the line about old dogs/new tricks isn't going to fly here.

So the questions are:

1. How do I learn AutoIt?

There are basic tutorials in the help file, and example scripts for almost every function. In addition, Valuator created a more extensive AutoIt 1-2-3 tutorial, which is linked in my sig below.

2. How to pause/wait?

Look up Sleep() in the help file.

3. How do I send a key stroke?

Look up Send() in the help file, or to be more precise about where the keystroke goes, ControlSend().

4. What if I have more questions?

As long as it doesn't constitute "please write this script for me", post all the questions you want right in this forum. There is no marginal cost to a new post, so please keep it to one specific topic per thread.

This forum has taught many clueless noobs how to use AutoIt (including me) so Welcome To AutoIt!

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thnx, those two commands are really what I needed so that greatly appriciated. I tried to use the tool in your signature, but it seems to be only coded to read autoit off the C: drive only, and ignores my other 4 hard disks. I have windows, and all my applications installed on F: drive... don't really wanna reinstall everything.

Edit:

Found the ini file so I could manually set the directory, its working now.

Edited by tous

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