script

hello, I’m more than a novice in applescript. I would like to have a alert window on certain date (at start up) ex: every 10th and 20th of the month. is that possible with applescript ( I guess so!) and how?
thanks a lot for your help
blandine

It’s absolutely possible. Standard Additions has everything you need:

on run
	set theDay to day of (current date) as text
	if theDay is equal to "10" then
		display dialog theDay
	else if theDay is equal to "20" then
		display dialog theDay
	end if
end run

Just compile the script and drop it into your Startup Items folder. It’ll run at startup,
and run its date check. Just replace “display dialog theDay” with whatever dialog
you wish to display.

-/-
Mikey-San
mike@milesmedia.net

mikey-san@bungie.org wrote:

: It’s absolutely possible. Standard Additions has everything
: you need:
: on run
: set theDay to day of (current date) as text
: if theDay is equal to “10” then
: display dialog theDay
: else if theDay is equal to “20” then
: display dialog theDay
: end if
: end run

This can be simplified a bit, as you don’t actually need the integer-to-string coercion (you don’t need to explicitly declare the run handler either):

set theDay to day of (current date)
if theDay is equal to 10 then
	display dialog "They're Everywhere!"
else if theDay is equal to 20 then
	display dialog "Thank God It's You!"
end if

If the message is the same every time, you can simplify it even further:

set theDay to day of (current date)
if theDay is in {10, 20} then
	display dialog "Frog Blast The Vent Core!"
end if

has :slight_smile:

: hello, I’m more than a novice in applescript. I would like to
: have a alert window on certain date (at start up) ex: every
: 10th and 20th of the month. is that possible with applescript
: ( I guess so!) and how?

: thanks a lot for your help

: blandine

If you don’t startup either on 10th or on 20th, you won’t able to see the alerts. This one will show the related alerts even you startup later, and it won’t show the alert for a day again, if you startup more than once on that day. It also has a snooze function, untill you select “Dismiss”, it will continue to alert you. Script should be in your Startup Items folder and shouldn’t be locked.

property aDID : {0, 0}
property aDAY : {"10", "20"}
property aTXT : {"Reminder message for day 10", "Reminder message for day 20"}
with timeout of 3600 seconds
	set cDay to day of (current date) as text
	repeat with x from 1 to count of items in aDAY
		if cDay is not less than (item x of aDAY) then
			if item x of aDID is equal to 0 then
				beep
				set DTEXT to ("[ Reminder ] " & return & return & ¬
					item x of aDAY as text) & " ? " & item x of aTXT
				set answer to display dialog ¬
					DTEXT buttons ¬
					{"Snooze", "Dismiss"} with icon note
				if button returned of answer is "Dismiss" then
					set item x of aDID to 1
				end if
			end if
		else
			if (item x of aDID) is equal to 1 then
				set (item x of aDID) to 0
			end if
		end if
	end repeat
end timeout

has?

The great Hamish Sanderson?

Wow. There’s a name I’ve not heard in a long time. :slight_smile:

-/-
Mikey-San
mikey-san@bungie.org

thanks to all of you. it’s working and it’s exactely what I was looking for.
blandine

Depending on whether you wish to know the time the computer has idled, or whether you wish to schedule a script at times of day or following certain events or repeatedly try:

Acron http://wrcu.coLgate.edu/sean/Acron/index.html
Akua Sweets http://osaxen.com/index.php3?id=akua_sweets
Cron http://gargravarr.cc.utexas.edu/cron/index.html
Cruise Control http://www.walnutsys.com/
DaemonCron Lite 1.5 http://homepage.mac.com/dcoshel/daemon.html
idle time osax http://osaxen.com/index.php3?id=idle_time
idle time extension http://www.dijas.com/ely-old/files-scripting.html
iDo Script Scheduler http://www.sophisticated.com/software/
Keyquencer http://www.binarysoft.com/kqmac/kqmac.html
MacAT http://gimr.garvan.unsw.edu.au/gerham/macsos/macat/index.html
PowerTask http://www.compsoftspec.com/powertask.html
QuicKeys http://www.quickeys.com/
Scheduler http://hotyellow98.com/jvarela/
Script Scheduler http://www.wmotion.com/products.html
Script Timer http://www.theboss.net/appsmore/
Sleep Commands http://home.earthlink.net/~eagrant/
T-Minus Ten http://home.austin.rr.com/mk/tmt/tmt.html

You may already own iDo, as it came free with OS8 thru 8.6, I think.

: has?
: The great Hamish Sanderson?
: Wow. There’s a name I’ve not heard in a long time. :slight_smile:
: -/-
: Mikey-San
: mikey-san@bungie.org

Shhhhh. Don’t tell. :wink: