• 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: AppleScript release notes released
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript release notes released


  • Subject: Re: AppleScript release notes released
  • From: "Laine Lee" <email@hidden>
  • Date: Mon, 5 Nov 2007 17:20:29 -0500

On 11/5/07 2:37 PM, "Philip Aker" <email@hidden> wrote:

>
> #!/bin/sh
>
> osascript << EOSCRIPT
> set fp to ""
> tell application "System Events"
> set frapp to item 1 of (every application process whose frontmost is
> true)
> set fp to name of frapp
> activate
> set res to (choose from list {"a", "b", "c"} with title "Important"
> default items "b")
> end tell
> tell application fp to activate
> res
> EOSCRIPT

Here's a script by Michelle Steiner gleaned from another recent thread on this list started by her (or him, in which case, my apologies, I dare you to guess my gender by my name) which I adapted into a shebanged version using your suggestion.

#!/usr/bin/osascript
set fp to ""
tell application "System Events"
set frapp to item 1 of (every application process whose frontmost is true)
set fp to name of frapp
activate
set the flag to false
repeat until the flag is true
    try
        set the DialogReturn to (display dialog "Enter the backup interval you wish." default answer "1" buttons {"Hours", "Minutes", "Cancel"} default button "Hours" with title "Set Time Machine Backup Interval")
        set the RawNumber to the text returned of the DialogReturn as number
        set the flag to true
        set the TimeUnit to the button returned of the DialogReturn
    on error msg number num
        if num is -128 then error number -128
        display alert "You must enter a number."
    end try
end repeat
end tell
if the TimeUnit is "Minutes" then
    set the BackupInterval to the RawNumber * minutes
else if the TimeUnit is "Hours" then
    set the BackupInterval to the RawNumber * hours
end if
set the BackupInterval to the BackupInterval as integer
set thePath to ((path to library folder from system domain) as text) & "LaunchDaemons:com.apple.backupd-auto.plist"
do shell script "chmod a+w /System/Library/LaunchDaemons/com.apple.backupd-auto.plist" with administrator privileges
tell application "System Events"
    tell property list file thePath
        set value of property list item "StartInterval" of it to the BackupInterval
    end tell
end tell
do shell script "chmod go-w /System/Library/LaunchDaemons/com.apple.backupd-auto.plist" with administrator privileges
tell application fp to activate


I also see that internal blank lines appear to cause some problems.

Thanks.

Laine Lee
 _______________________________________________
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

  • Prev by Date: iCal and Leopard
  • Next by Date: Re: Creating small page size in InDesign CS3
  • Previous by thread: Re: Choose from list Bug
  • Next by thread: I'm turning Japanese, I thinking I'm turning Japanese using TypeIt4Me...
  • Index(es):
    • Date
    • Thread