I have a macro that collects information from a web page, so I start by checking the value of %SafariURL% to ensure I'm on the right page. The first action in the macro is "Pause until %SafariURL% is not empty". For trouble shooting purposes I have timed this action: most of the time it completes in less than 0.2 seconds, but occasionally takes 40-70 seconds, and sometimes it never completes (or i give up). I added a timeout after 10 seconds as a bandaid.
I have looked at all the other threads here that seem related so I can say the following ..
MacBook Pro 2021 (M1 chip), macOS Sonoma (14.6.1), Safari 17.6 and KM 11.0.3. Safai is at the front and active and the relevant window is fully displayed and loaded. (I'm only using two web sites for this and the issue randomly shows up on either). Rebooting has not effect. Reloading the page sometimes works but not always... so it appears that something is occasionaly preventing the %SafariURL% token from being filled.
So my question is ... does anyone have any idea where I should look for the cause of this intermittent issue?
I am not sure, but Safari probably has to be the active app for this to work. If some other app has become active, it may not work. Did you validate that Safari was always active? Did you validate that Safari always had an active tab open?
I'm not sure, but those are my thoughts. Sometimes my thoughts don't help a lot.
Did you check the KM Engine log file? Maybe an error is showing up there. It's worth looking.
Safari is the only window on screen but I guess something else may have become active ... how would I confirm that?
Here is an extract from the Engine log when the issue happened... two times in a row and then went away (third time was a charm in that case)
2024-09-19 15:35:47 Execute macro β61)Transfrer Data from Safari to Genealogy Clipboard β from trigger The Hot Key ββ₯β§C is pressed
2024-09-19 15:35:48 Internal AppleScript timed out
Last message repeated 11 times
2024-09-19 15:35:57 Action 15638349 timeout exceeded. Macro β61)Transfrer Data from Safari to Genealogy Clipboard β cancelled (while executing Pause Until Conditions are Met).
2024-09-19 15:36:11 Execute macro β61)Transfrer Data from Safari to Genealogy Clipboard β from trigger The Hot Key ββ₯β§C is pressed
2024-09-19 15:36:12 Internal AppleScript timed out
Last message repeated 11 times
2024-09-19 15:36:22 Action 15638349 timeout exceeded. Macro β61)Transfrer Data from Safari to Genealogy Clipboard β cancelled (while executing Pause Until Conditions are Met).
2024-09-19 15:40:31 Execute macro β61)Transfrer Data from Safari to Genealogy Clipboard β from trigger The Hot Key ββ₯β§C is pressed
What would cause "internal AppleScript" to time out?
I donβt know, but that might be an important clue so we should look into that. Maybe you need to isolate the actions in your macro to see which one is causing that error.
Ok thanks. As this is an intermittent problem I can't force it to happen, but I will keep an eye on the system menu and the Engine log. The step in the macro that shows the error is the very first step... the "pause until %SafariURL% is not empty" action.... which I presume causes the AppleScript error while it's looking at an empty token???
As the wiki says, the KM browser tokens use AppleScript to query the browser so "internal AppleScript" must surely refer to that interaction. As to why that timeout is happening I guess only Peter Lewis might know. You might want to ask him.
Does it only happen on one particular site? As @tiffle says, KM uses AppleScript to get the browser URL -- but I think that AppleScript is then doing it via JavaScript. Perhaps something on the site is blocking/delaying JS execution, sometimes to the point of the action timing out?
Nige, I'm only using this Macro with two sites, ancestry.com and findmypast.com... It happens VERY intermittently but on both randomly.
As luck would have it, the phenomenon occurred earlier today. I was using a page on findmypast.com , Safari is only visible app, and the macro timed out (notification) so I relaunched the macro and carefully watched the name of the app in the upper left of the screen per Airy's note... it never changed from "Safari". I then reloaded the page and tried the macro two more times... both tries timed out but "Safari" was always the app and Engine log shows the "AppleScript timed out" 11 times each time as in the example above.
So next I swiped to a second desktop, performed a few tasks in another app and then swiped back to the desktop where Safair lives and the page still showing... now the macro worked flawlessly.... and has continued to do so for several hours and many uses since.
I'll try to keep notes of what happens immediately before / after this oddity to see if anything springs to mind, but as far as I can tell everything is always the same, and the macro works more than 90% of the time. I suspect this will be one of those things that will always be a mystery... and maybe when I move to Sequoia it will go away (hope springs eternal!)