Any way to prevent FK from executing other macros?

Discussion, questions and support.
User avatar
Marko
Posts: 1718
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Oct 14th, ’21, 16:20

That’s a large number of commands. If I were you, I would select the ones I use on a daily basis (80:20 principle) but that’s just me. :D

Please keep the backups safe.
User avatar
Oblomov
Posts: 184
Joined: Mar 4th, ’19, 19:44

Post by Oblomov » Oct 19th, ’21, 15:06

Marko wrote: Oct 14th, ’21, 16:20 That’s a large number of commands. If I were you, I would select the ones I use on a daily basis (80:20 principle) but that’s just me. :D

Please keep the backups safe.
Mhm, yeah, Dropbox has definitely been invaluable in regards to this from the get-go, as I do get crashes, maybe like 2-4 times a week... but it's no big deal really
User avatar
Oblomov
Posts: 184
Joined: Mar 4th, ’19, 19:44

Post by Oblomov » Oct 20th, ’21, 14:13

Oblomov wrote: Oct 11th, ’21, 17:04
Marko wrote: Oct 8th, ’21, 16:54 You need to carefully test commands like this. For example, if the destination window is not in focus you could get unwanted results.
I suggest you to test it line by line (comment other lines) to see at which point it breaks.

As said, it is maybe needed to force the window focus by using WinActivate at the beginning of the script
https://www.autohotkey.com/docs/command ... tivate.htm

Code: Select all

WinActivate, ahk_class Chrome_WidgetWin_1
or check if the window is focused before proceeding by using
https://www.autohotkey.com/docs/commands/WinActive.htm

Code: Select all

if not WinActive("ahk_class Chrome_WidgetWin_1")
   return
I see... definitely going to utilize that 'if' a lot more from now on.

So if anything, I can rule out my .fdb getting rather large?
After further testing:

Code: Select all

if not WinActive("ahk_class Framework::CFrame")
return
Unfortunately doesn't quite seem to help... my current hypothesis is that it is because of executing, that is at times a little too fast...

Example of a command with it, btw:

Code: Select all

if not WinActive("ahk_class Framework::CFrame")
return

;Sleep 25
Sleep 50
send, ^a
Sleep 50
send, ^c
sleep 200
Send, "%clipboard%"
Clipwait
;Sleep 50
;Sleep 70
Sleep 100

Send, ^a
Sleep 25
Send, ^c
User avatar
Tom
Posts: 791
Joined: Nov 24th, ’15, 23:39

Post by Tom » Oct 20th, ’21, 18:21

Make sure OneNote is in focus and run your command. Wait until the command ends. What happens?
To slow down the script you can try adding this line to the beginning:

Code: Select all

SetKeyDelay, 20 ;experiment with different values
User avatar
Oblomov
Posts: 184
Joined: Mar 4th, ’19, 19:44

Post by Oblomov » Oct 20th, ’21, 18:59

Tom wrote: Oct 20th, ’21, 18:21 Make sure OneNote is in focus and run your command. Wait until the command ends. What happens?
To slow down the script you can try adding this line to the beginning:

Code: Select all

SetKeyDelay, 20 ;experiment with different values
It's pretty much always in focus, since the 'Window' field below, already contains 'ahk_class ramework::CFrame'

It usually happens like this ➔ I select OneNote ➔ then maybe type something somewhere ➔ then press 'Alt + E' to execute the command (the one above) ➔ like 2 times out of 10 (sometimes more), it 'bugs out' and executes a completely different, longer command... haven't quite figured which one it is, but the suspects I have mind, don't have a combination of 'Alt + E' in them...

>SetKeyDelay, 20
Thanks so much! Will definitely try this and report back if this has done it...
Post Reply