Calling Applescript in an external file

Hi Nick
This new feature of creating extensions has changed my workflows in big way, wondering if you would consider

  1. limit of 30 extensions ( I use contextual extensions based on app or workflow), 30 is not enough :innocent
  2. A way of calling complied applescript which are in folder (cud be dropBox or iCloud)

Its a request, plz consider
Thank you

(1)

You can increase the extensions limit by pasting the following command in Terminal (99 is just an example):

defaults write com.pilotmoon.popclip MaxNumberOfExtensions -int 99

then Quit and restart PopClip.

(2)

A way of calling complied applescript which are in folder (cud be dropBox or iCloud)

Not sure what you mean by this. Can you describe it in more detail?

Edit: I think this is what you mean:

# popclip
name: External AppleScript
icon: A
applescript: |
  set myScriptPath to ((path to home folder as text) & "Dropbox:Hello.scpt")
  set myScript to load script file myScriptPath
  run myScript
2 Likes

Thanks Nick, very helpful, this works perfect.

I want to pass the selected text to the complied script, saved on desktop as “TextEditNew.scpt”

-- example .applescript file with placeholder strings:
tell application "TextEdit"
 activate
 set theDocument to make new document
 set text of theDocument to ("{popclip text} - Clipped from {popclip browser url}")
end tell

On wiki, says → need a .json file to call script, and pass parameters
wondering with “Extension Snippets” how can v pass parameters in above script as “{popclip text}”
or to a named Handler in the Script (as below)
Thank you

on newDocument(theText, theUrl) --this is a handler
  tell application "TextEdit"
    activate
    set theDocument to make new document
    set text of theDocument to (theText & " - Clipped from " & theUrl)
  end tell
end newDocument

To do it with a snippet, you would have to do indirectly like this (because a snippet can’t reference an AppleScript file directly):

# popclip
name: External AppleScript Handler
icon: Ax
applescript: |
  set myScript to load script file ((path to desktop folder as text) & "TextEditNew.scpt")
  myScript's newDocument("{popclip text}", "{popclip url})

(I got this from macos - How to call a specific subroutine of an AppleScript from another AppleScript? - Ask Different)