I recently made large macros that use the scan screen for image function. Altogether these macros contain at least 1400 unique images to scan for. After creating these, whenever I edit something in km it lags for about six seconds while showing the small black diamond in the bottom right corner of km which seems like an auto save symbol to me. You should see it whenever you edit something. What can i do to stop lagging like this?
Hi, some questions:
-Do you have all of the 1400 image scans in one macro?
-have you tried splitting them into external macros? (so you can call them using
Execute a Macro).
-Have you tried using any other options instead of image scan? (like Menu select)
The image scans are active all the time when editing (notice there's a
True text in them), so I'd guess having 1400 scans at the same time is maxing your CPU.
In addition to the suggestions by @gglick, you might consider this:
- @peternlewis has noted several times that all images in KM are stored as TIFF images, which can make them quite large.
- Every time you make any edit in a Macro, the plist file containing all macros is rewritten.
- If you have a KM sync file, it also is rewritten.
- So, a large number of large images is going to take some time to write to file.
Unfortunately, I don't know of any real, effective, workaround, other than to not use so many Found Image Actions. While these are very powerful, I use the ONLY as a last resort.
Thanks for your responses they really help.
Another way I found to do what I want is to scan the screen for a file instead of an image stored in km. Luckily i have all the images stored in my files. My question now is would this reduce the lag significantly if i replaced the scan for image with scan for file (containing the image)? Also, I have to scan as many as 700 images to find one match. Would scan for file be much slower than scan for image? Speed does matter to me. What i guess is 700 scans or slightly more takes about 35 seconds right now.
35 seconds is a lot. More alternatives:
- Mouse click on X,Y coordinates
maybe if you share what app are you using or your workflow people can give better help.
Yes, because it will reduce the size of your macro file, which I am guessing would be extremely large with 1400 images in it.
Scan for file will not be much slower - Keyboard Maestro will have to read the file, so it will be a little bit, but it should not be a significant proportion of the time.
All that said, I have to say, you are stretching Keyboard Maestro well past its design area. I'm not sure there are any other tools that would do this job better, but it is well outside what I have designed for.