Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

I have a simple Applescript that works in Script Editor

tell application "Keyboard Maestro Engine" 
do script "Search the Web" 
end tell

I add this same script (with escape chars) to my RESOURCES::A_SCRIPT field inside FM.

The RESOURCES table is not connected to the other tables in the graph.

"tell application \"Keyboard Maestro Engine\" 
do script \"Search the Web\" 
end tell"

I've tried this with this field being defined as a Global Storage Field or not.  Similar problems with both.

I have an FM Script called EXECUTE:

Perform Applescript (RESOURCES::A_SCRIPT)

When I run this FM Script I get an error message:

"Error: -2741" / "Expected EOL but found Command Name"

I've have tried rebooting my Mac.

Any ideas?

 

 

If you're using a text field to hold your ApppleScript, then you shouldn't need to escape anything. Just copy-paste the script as is from Script Editor into the field. Do not add quotes, either.

 

Edited by comment

  • Author

Doesn't work.

I just copied the exact same (working) script from Script Editor into the FM Global Storage Text Field (no escape chars or double quotes).

Not accepted.  "Specified Field not found" when "Tell Application" is highlighted.

Edited by fm8443

We are having a communication problem here. There is no way you can get such error when pasting into a text field. You are obviously pasting into a calculation window, but I cannot tell in what context.

  • Author

Yes - its a calculation window that delivers a text result. 

Not following how to put this code into a Text field without quotes?

Edited by fm8443

  • Author

OK I've added this to the FM Script (Native Applescript panel):

tell application "Keyboard Maestro Engine" 
do script "Search the Web" 
end tell

It now works.

But how do I remove this code into a FM RESOURCES::A_SCRIPT field and then have it work similarly?

(I want to do this to build up to a more complex Applescript with parameters from FM.)

 

I've turned RESOURCES::A_SCRIPT field into a Text field and tried pasting the text of the Applescript into the DATA panel (or the CALC panel) of the Auto-Enter screen.  

tell application "Keyboard Maestro Engine" 
do script "Search the Web" 
end tell

I then reference this from the FM Script.  Still get the "Error: -2741"

1 minute ago, fm8443 said:

(I want to do this to build up to a more complex Applescript with parameters from FM.)

 

An example would be useful.  In general, you have two choices:

1. Paste the AppleScript into the global field, then select the Calculated AppleScript option and enter a calculation that modifies the text in the global text field to what you want;

or:

2. Do the entire calculation within the Perform AppleScript step; this is the only option that requires you to escape the AppleScript - and the escaped version would look like this:

"tell application \"Keyboard Maestro Engine\" ¶do script \"Search the Web\" ¶end tell "

Of course, this is just the beginning, before you insert the parameters.

 

  • Author
7 minutes ago, comment said:

1. Paste the AppleScript into the global field, then select the Calculated AppleScript option and enter a calculation that modifies the text in the global text field to what you want;

Doesn't work for me.  Get error as above.

Do you men that I should paste the text of the Applescript into the DATA panel of the Auto-Enter screen of my RESOURCES::A_SCRIPT ?

tell application "Keyboard Maestro Engine" 
do script "Search the Web" 
end tell

And then reference this from my FM Script as this?

Perform Applescript (RESOURCES::A_SCRIPT)

I still get the "Error: -2741"


 

 
11 minutes ago, fm8443 said:

Do you men that I should paste the text of the Applescript into the DATA panel of the Auto-Enter screen of my RESOURCES::A_SCRIPT ?

No. You should paste it into the field itself. Place the field onto a layout, enter Browse mode, click into the field and paste. Do not specify any auto-enter options for the field.

 

Edited by comment

  • Author
16 minutes ago, comment said:

No. You should paste it into the field itself. Place the field onto a layout, enter Browse mode, click into the field and paste.

OK done this on a new global text field.  Created clean new FM script as well.

Getting error -2741 "Expected EOL but found command name"

Also tried your #2 (escape chars etc) and I get no error message/no results!

Sorry, I don't know for sure what you did. Understand also that I don't have Keyboard Maestro, so I don't know what the expected result is here.

I suggest you take a look at this simple demo and see if you can take it from there.

SimpleAS.fp7

  • Author

Thanks for the file.  It works as expected.  It also works when I copy in my Applescript.  

The weird thing is that 12 hours later MY script now works with no error message as I repeatedly got last night.  I made no changes to it at all!

Didn't reboot Mac or restart FM or KM or Safari.

My setup looks exactly the same as yours except I run the FM Script from the FM menu (not from a button).  Thanks again.

14 minutes ago, fm8443 said:

The weird thing is that 12 hours later MY script now works with no error message as I repeatedly got last night.  I made no changes to it at all!

Maybe you have the first computer ever with the caprice feature...

Note that once you have finalized your AppleScript, you should move it from the global field and make it a self-contained calculation within the Perform AppleScroipt[] script step. Otherwise you will lose it if you clone your file.

1 hour ago, comment said:

Maybe you have the first computer ever with the caprice feature...

?  As in Clint Dempsey?  

27 minutes ago, LaRetta said:

As in Clint Dempsey?

I don't get the reference.

 

Hmm ... they have "Caprice Is a Feature Of Dempsey's Game" as the headline -  but the word caprice is nowhere in the text, so it's hard to tell what they mean.

I meant simply that the computer could be acting "weird" because it's capricious. Which is just another way of suggesting that PIBKAC.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.