AppleScript "alarm string" path to external script

I’m struggling to figure out the format for setting a path to an external script.

What I want to do is set a Smart Rule that looks for invoices that aren’t marked as “paid”, and have it set a Reminder on that invoice, with the Alarm set as “Execute External Script” and the external script set to an AppleScript I have saved in the appropriate folder (~/Library/Application Scripts/com.devon-technologies.think3/Reminders/Unpaid Invoice.scpt).

The script I have set for the Smart Rule is:

on performSmartRule(theRecords)
	tell application id "DNtp"
		set due_date to current date
		set due_date to due_date + 3600 * 24 * 7
		repeat with theRecord in theRecords
			tell theRecord to make new reminder with properties {schedule:once, alarm:external script, alarm string:"Macintosh HD:Users:lnelson:Library:Application Scripts:com.devon-technologies.think3:Reminders:Unpaid Invoice.scpt", due date:due_date}
		end repeat
	end tell
end performSmartRule

I’ve tried formatting the alarm string:path-to-script as many different ways as I can imagine and I still can’t figure out how to properly get it to set the “Unpaid Invoice” script as the external script.

Can someone show me what I’m doing wrong? I’ll be your best friend forever.

Welcome @heylesterco

Use the POSIX path of the script, not the HFS path, e.g., Users/Me/…/….

Just tried this:

-- Remind me next week
-- Created by Christian Grunenberg on Thu Jan 15 2015.
-- Copyright (c) 2015. All rights reserved.

on performSmartRule(theRecords)
	tell application id "DNtp"
		set due_date to current date
		set due_date to due_date + 3600 * 24 * 7
		repeat with theRecord in theRecords
			tell theRecord to make new reminder with properties {schedule:once, alarm:external script, alarm string:"Users/lnelson/Library/Application Scripts/com.devon-technologies.think3/Reminders/Unpaid Invoice.scpt", due date:due_date}
		end repeat
	end tell
end performSmartRule

…And it still wasn’t working. It correctly set the alarm to “Execute External Script,” but didn’t set the external script to anything.

Finally changed “Users/lnelson/…” to “~/…”—which I swear I’ve tried before—and it worked! So if anyone else runs into this problem, give that a try. And if you, like me, swear you’ve tried it before, give it a try again haha.

Thanks for your help!

Mine worked without a hitch…

Screen Shot 2022-04-11 at 06.30.50 PM

But you’re welcome :slight_smile:

Actually it should be /Users/Me/...

The path is wrong, it must begin with a slash "/Users…“