Re: An Applescript Cocktail
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