• 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: An Applescript Cocktail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: An Applescript Cocktail


  • Subject: Re: An Applescript Cocktail
  • From: Sander Tekelenburg <email@hidden>
  • Date: Thu, 14 Apr 2005 22:04:32 +0200

At 15:59 +0100 UTC, on 2005/04/14, Martin Orpen wrote:

[...]

> with timeout of 3600 seconds
>    set myButton to (items of (display dialog "What task do you want to
>run?" buttons {"daily", "weekly", "monthly"}) as string)
>     if myButton is "daily" then
>        set x to do shell script "sudo /private/etc/daily" with
>administrator privileges
>    end if
>    if myButton is "weekly" then
>        set x to do shell script "sudo /private/etc/weekly" with
>administrator privileges
>    end if
>    if myButton is "monthly" then
>        set x to do shell script "sudo /private/etc/monthly" with
>administrator privileges
>    end if
>    -- ugly, but better than display dialog...
>    choose from list (paragraphs of x) with prompt "Read and then cancel:"
> end timeout
>
>
> Could do with tidying up as it's a bit repetitive...

I use this:

set actionList to (choose from list {"daily", "weekly", "monthly"} with
prompt "Pick 1 or more tasks to run" with multiple selections allowed)
if actionList ‚ false then -- user didn't cancel
	set task_list to ""
	repeat with i in actionList
		set task_list to task_list & " " & i
	end repeat
	do shell script ("sudo periodic" & task_list) with administrator privileges
end if


--
Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: An Applescript Cocktail (From: Martin Orpen <email@hidden>)

  • Prev by Date: Re: Display Dialog
  • Next by Date: RE: Display Dialog - resolved.
  • Previous by thread: Re: An Applescript Cocktail
  • Next by thread: Re: An Applescript Cocktail
  • Index(es):
    • Date
    • Thread