Extracting file location to Downloads folder

Normally an AppleScript waits. It will execute the commands, functions, whatnot, in order, not asynchronously. Of course, there may be some glitches when external things are involved, like saving a huge file to disk.

But in AppleScript you also have the dalay command, similar to the Pause action in KM. Try to place it on different locations in the script and see if it changes something. If you think it is a timing issue.

Syntax is like this:

delay 0.8

waits for 0.8 seconds.

Thank you, I have been testing it in different places for a while now. Increasing the seconds to see how it reacts

Currently I’m reading thru your script, but it is a bit hard without Daylight installed. Probably will install this the next days, but not tonight.

Didn’t I install it 2 years ago, for some similar testing or debugging…? :wink:

You probably have :slightly_smiling_face: would saving the applescript results to a variable slow KM down moving on and allow it to complete the script properly?

This (line 64)…

tell application "Keyboard Maestro Engine"
	setvariable "fileLocation" to result
end tell

…is meant to refer to what? (Which result, I mean)

You had already saved result to theFIle in the previous Tell block, no?

Any reason you are leveraging result here? Syntactically all seems correct (AFAICT without Daylight). I’m only asking for confirmation if you are doing what you intended to do.

I want to save the result so that if it does contain < then I know that the code was not executed properly.

Yes, that’s what I meant. result was already saved to theFIle, no?

Yes result is saved to theFIle, I am also saving it as KM variable so that I can receive a notification when it is not triggered for a certain line.

No. I think this leads to nowhere nothing, at least not efficiently.

I will install Daylight one of the next days, then we’ll see.

Maybe some guys here, more experienced with AppleScript than me, will spot some errors in your script in the meantime…

But I won’t let you down. I’ll try my best, promised. Just not tonight, and probably not tomorrow.

I won't need it after Thursday, thanks for your help. The deadline is Thursday :slight_smile:

Removing the save variable has made a difference thank you for your advice.

I propose you one thing:

Try to build a Minimal Example.

This is also often called “isolating the issue”. (Not exactly the same, but pretty much.)

Strip off as many actions as possible from your macro until the issue disappears (or the core functionality of the macro stops working).

I know, in your case it is probably (but not definitly) related to the AppleScript. Do the same as said above in addition with the AppleScript: Strip off as many functions, variables, lines as possible until the issue stops appearing — or the core functions of the script stop working.

Just try to remove as much as possible: any secondary features, anything that isn’t essential (in terms of script mechanics), while still being able to produce the issue.

Then post the stripped down script and macro. This will greatly help to get a solution.

Besides that, it often happens that in the process of building a minimal example (i.e. trying to isolate the thing) the issue suddenly becomes obvious “like the shining sun” [replace this with a good idiomatic expression]. I have experienced this countless times.

I’m not saying this to say something, it’s a serious recommendation that may help you to get a solution until Thursday. I will try to help you maybe tomorrow or Thursday afternoon, but if you could already do some “preparation work” (i.e. trying to isolate the issue or build a Minimal Example), we have better chances.


PS:

For example, inside the whole “eval” stuff (we have 3 of them), remove everything but the obligatory one(s). If in the process of doing that you notice that the issue has went away, you have made a major leap towards a working script.

1 Like

So, does it (sufficiently) work now, or do you still need help? If yes, I will install the Daylight trial.

1 Like

Hi Tom, thank you for your advice. I managed to resolve it by putting a repeat action on the AppleScript so the system triggers the AppleScript twice.

That’s great!