Enhanced timer/sequence project for use on financial supervised learning software.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
blad4
Posts: 307
Joined: 07 Oct 2015, 11:06

Enhanced timer/sequence project for use on financial supervised learning software.

Post by blad4 » 05 Feb 2023, 19:49

Wondering if I can solicit some help. I can only code this in the crudest sense via AHK, thus wondering about the better ways to do so.

Some context; supervised learning on my finance platform, meaning there are many many child windows need sorting/accessing quickly. Hope it helps explain the purpose.

My "sendA" label calls A and B (my desired child windows).

My main block/sequence can be expressed as:

Code: Select all

gosub sendA
sleep 4000(x)
loop 999999
{
gosub sendright
sleep 5000(x*1.25)
gosub sendleft
sleep 4000
gosub sendup
sleep 4000
}
x (the sleep length) is a variable I can change from other hotkeys.

the

Code: Select all

 'loop 999999'
represents an infinite loop until cancelled.

Now let's assume all of the sleep intervals can be interrupted (as if using settimer, label, -x)

I need Numpads 1-6 to reassign variable A and send an iteration of the default sequence. If coded the above way, and on a fresh script reload, it would look like:

Code: Select all

Numpad1::
A=1
gosub sendA
sleep 4000(x)
loop 999999
{
gosub sendright
sleep 5000(x*1.25)
gosub sendleft
sleep 4000
gosub sendup
sleep 4000
}

Numpad2::
A=29
gosub sendA
sleep 4000(x)
loop 999999
{
gosub sendleft
sleep 5000(x*1.25)
gosub sendright
sleep 4000
gosub sendup
sleep 4000
}

Numpad3::
A=57
gosub sendA
sleep 4000(x)
loop 999999
{
gosub sendright
gosub sendright
sleep 5000(x*1.25)
gosub sendleft
gosub sendleft
sleep 4000
gosub sendup
sleep 4000
}

Numpad4::
A=85
gosub sendA
sleep 4000(x)
loop 999999
{
gosub sendright
gosub sendright
sleep 5000(x*1.25)
gosub sendleft
gosub sendleft
sleep 4000
gosub sendup
sleep 4000
}

Numpad5::
A=113
gosub sendA
sleep 4000(x)
loop 999999
{
gosub sendleft
sleep 5000(x*1.25)
gosub sendright
sleep 4000
gosub sendup
sleep 4000
}

Numpad6::
A=141
gosub sendA
sleep 4000(x)
loop 999999
{
gosub sendleft
gosub sendleft
sleep 5000(x*1.25)
gosub sendright
gosub sendright
sleep 4000
gosub sendup
sleep 4000
}
To clarify, Numpad1 makes A 1, Numpad2 makes it 29 etc (+28 at a time)

Now there needs to be a memory of the last Numpad press, as depending on where A currently stands, I need it to influence the output of the next Numpad press.

Example, if Numpad1 then Numpad3 is pressed, instead of the above routine, it would run a further modified sequence:

Code: Select all

A=57
gosub sendA
sleep 4000(x)
loop 999999
{
gosub sendleft
gosub sendleft
sleep 5000(x*1.25)
gosub sendright
gosub sendright
sleep 4000
gosub sendup
sleep 4000
}
You can guess that sendleft and sendright's job is mainly is deduct/add 28 from/to A. Then they also have to

Code: Select all

gosub sendA
in the current format.

If I press Numpad3 again, then it will revert to Numpad3's default routine above (as if the script was reloaded and Numpad3 was pressed).

If I press Numpad6, for instance, it will respect the last press of Numpad3 and give a different predefined sequence.

If someone can let me know if and how this is possible, it would be highly appreciated. Essentially being able to reduce this into a smarter code, than me writing each and every combination out, with a zillion settimers etc? There should be 6 default variations and 30 modified. I can donate $ to the site or for anyone's time.

And, lastly, I would have x assigned with the normal keyboard numbers as 1:1000ms, 2:2000ms, 3:3000ms etc, allowing me to modify the sequence rate of firing immediately and easily.

blad4
Posts: 307
Joined: 07 Oct 2015, 11:06

Re: Enhanced timer/sequence project for use on financial supervised learning software.

Post by blad4 » 06 Feb 2023, 09:53

Seems I am getting feedback to refer to python for this level of task?

blad4
Posts: 307
Joined: 07 Oct 2015, 11:06

Re: Enhanced timer/sequence project for use on financial supervised learning software.

Post by blad4 » 06 Feb 2023, 13:20

This is an example I made with settimers, two options for Numpad1.

It works, it's just not right to code this way I imagine? Any way I can be pointed in the right direction?

Just need something I can quickly replicate per number, edit the sleep variables etc

Code: Select all

Numpad1::
if (A_PriorHotkey = "Numpad3")
{
A=1
settimer, sendA, -1
settimer, sendright, -4000
settimer, sendright, -8000
settimer, sendleft, -13000
settimer, sendup, -17000
settimer, 3to1, 21000
return
}
else
A=1
settimer, sendA, -1
settimer, sendright, -4000
settimer, sendleft, -9000
settimer, sendup, -17000
settimer, 1to1, 21000
return
return

3to1:
settimer, sendright, -4000
settimer, sendright, -8000
settimer, sendleft, -13000
settimer, sendup, -17000
return

1to1:
settimer, sendright, -4000
settimer, sendleft, -9000
settimer, sendup, -17000
return

Post Reply

Return to “Ask for Help (v1)”