• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Mail Rule problem.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mail Rule problem.


  • Subject: Re: Mail Rule problem.
  • From: Barry Wainwright <email@hidden>
  • Date: Sun, 24 May 2015 08:44:50 +0100

This routine will do the same thing but uses a ‘real’ preference file through system ‘defaults’:



try
-- Get the last time the script was run
set lastRun to date (do shell script "defaults read com.myDomainName.myScriptName last_time")
on error
-- Prefs file doesn't exist yet! Create it.
do shell script "defaults write com.myDomainName.myScriptName last_time " & (quoted form of (((current date) - 1 * days) as text))
-- and set a value for last run that is one day old.
set lastRun to (current date) - 1 * days
end try

-- test how old the last run was
if ((current date) - lastRun) > 10 then
-- and run the routine if it was more than [x] seconds old
beep 2
-- insert your notification routine here
-- finally, write the current time out to the prefs file
do shell script "defaults write com.barryw.myscript last_time " & (quoted form of ((current date) as text))
end if


-- 
Best regards,
Barry Wainwright




On 24 May 2015, at 05:03, Brian Christmas <email@hidden> wrote:

G’day, and thanks S.J. and Axel.

I’m now saving the time variable in the user preferences folder as a .txt file.

Works well.

Regards

Santa



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Mail Rule problem. (From: Brian Christmas <email@hidden>)
 >Re: Mail Rule problem. (From: "S. J. Cunningham" <email@hidden>)
 >Re: Mail Rule problem. (From: Brian Christmas <email@hidden>)

  • Prev by Date: Re: Mail Rule problem.
  • Next by Date: Re: Applescript coding
  • Previous by thread: Re: Mail Rule problem.
  • Next by thread: Re: Mail Rule problem.
  • Index(es):
    • Date
    • Thread