Edited

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
fivefive
Posts: 60
Joined: 07 May 2022, 14:16

Edited

Post by fivefive » 23 May 2022, 11:07

Edited
Last edited by fivefive on 12 Mar 2023, 10:41, edited 1 time in total.

User avatar
boiler
Posts: 16926
Joined: 21 Dec 2014, 02:44

Re: Delays when calling the function the 1st time??

Post by boiler » 23 May 2022, 11:38

Run a dummy call to the OCR routine when the script first starts up and then again every so often so that it doesn't spend the time to initialize itself or whatever it's doing when you actually need it. You can have a routine executed regularly by using SetTimer.

fivefive
Posts: 60
Joined: 07 May 2022, 14:16

Re: Delays when calling the function the 1st time??

Post by fivefive » 23 May 2022, 11:43

Edited
Last edited by fivefive on 12 Mar 2023, 10:41, edited 1 time in total.

User avatar
boiler
Posts: 16926
Joined: 21 Dec 2014, 02:44

Re: Delays when calling the function the 1st time??

Post by boiler » 23 May 2022, 11:57

If you need the clipboard not to be touched, then that may be an issue. You may see if you can produce a subset of the OCR routine that you could call that leaves out the part of assigning new content to the clipboard but still keeps the initialization fresh. I don't have time to dig into that myself to know if it's feasible or not.

fivefive
Posts: 60
Joined: 07 May 2022, 14:16

Re: Delays when calling the function the 1st time??

Post by fivefive » 24 May 2022, 09:43

Edited
Last edited by fivefive on 12 Mar 2023, 10:41, edited 1 time in total.

User avatar
boiler
Posts: 16926
Joined: 21 Dec 2014, 02:44

Re: Delays when calling the function the 1st time??

Post by boiler » 24 May 2022, 09:47

I like assigning a null string using the expression assignment operator, like this:

Code: Select all

Clipboard := ""

The versions you asked about also work, but I prefer the above as it doesn't look like an unfinished line of code.

RussF
Posts: 1264
Joined: 05 Aug 2021, 06:36

Re: Delays when calling the function the 1st time??

Post by RussF » 24 May 2022, 09:47

Code: Select all

Clipboard =
or...

Code: Select all

Clipboard := ""
Russ

(Sorry @boiler, we posted at the same time.)

Post Reply

Return to “Ask for Help (v1)”