• 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: Scripting System Preferences in MacOS X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting System Preferences in MacOS X


  • Subject: Re: Scripting System Preferences in MacOS X
  • From: Martin Michel <email@hidden>
  • Date: Fri, 8 Feb 2002 16:16:51 +0100

Try this one as an example, only works under Mac OS 9:

--+++Properties+++
property SystemFolders : {}
property UserList : {}

--+++Main Routines+++
on run
with timeout of 6000 seconds
set SystemFolders to {}
set UserList to {}
my DiskChecker()
end timeout
end run


on DiskChecker()
tell application "Finder"
activate
get every disk
set allDisks to result

repeat with theDisk in allDisks
if ejectable of theDisk is false then
if local volume of theDisk is true then
my SystemFolderCheck(theDisk)
end if
end if
end repeat

if SystemFolders is {} then
display dialog ,
"So verwirrend es auch ist: Es wurden keine Systemordner auf den lokalen Festplatten gefunden..." buttons {"Na sowas..."} default button 1 with icon stop giving up after 10
return
else
my UserSystemChooser()
end if

end tell
end DiskChecker

on SystemFolderCheck(validdisk)
tell application "Finder"
activate
if exists folder "Systemordner" in validdisk then
set validdisknameA to name of validdisk
set ClassicSystemFolder to validdisknameA & ":" & "Systemordner" & ":" & "System" as string
set SystemFolders to SystemFolders & ClassicSystemFolder
set UserListItemA to validdisknameA & " (Classic OS)" as string
set UserList to UserList & UserListItemA

if not (exists folder "System") in validdisk then
return
else if exists folder "System" in validdisk then
if exists folder "Library" in validdisk then
set validdisknameB to name of validdisk
set MOXSystemFolderA to validdisknameB & ":" & "System" & ":" & "Library" & ":" & "CoreServices" & ":" & "BootX" as string
set SystemFolders to SystemFolders & MOXSystemFolderA
set UserListItemB to validdisknameB & " (Mac OS X)" as string
set UserList to UserList & UserListItemB
end if
end if
else if not (exists folder "Systemordner" in validdisk) then
if exists folder "System" in validdisk then
if exists folder "Library" in validdisk then
set validdisknameC to name of validdisk
set MOXSystemFolderB to validdisknameC & ":" & "System" & ":" & "Library" & ":" & "CoreServices" & ":" & "BootX" as string
set SystemFolders to SystemFolders & MOXSystemFolderB
set UserListItemC to validdisknameC & " (Mac OS X)" as string
set UserList to UserList & UserListItemC
end if
end if
end if
end tell
end SystemFolderCheck


on UserSystemChooser()
tell application "Finder"
activate
choose from list UserList with prompt "Wdhlen Sie ein Startvolume aus:"

if result is not false then

set UserChoice to result as string

set SystemFolderIdentifyer to 0

repeat with theItem in UserList
if UserChoice = theItem as string then
set SystemFolderIdentifyer to SystemFolderIdentifyer + 1
get item SystemFolderIdentifyer of SystemFolders as string
set choosenSystemFolder to result
else
set SystemFolderIdentifyer to SystemFolderIdentifyer + 1
end if
end repeat

my StartVolumeSetter(choosenSystemFolder)

else
return
end if
end tell
end UserSystemChooser


on StartVolumeSetter(thechoosenSystemFolder)
tell application "Finder"
activate
display dialog "Bitte warten Sie einen Moment, das Vffnen des Kontrollfeldes Startvolume dauert etwa 5 Sekunden..." buttons {""} default button 1 giving up after 3
end tell
tell application "Startvolume"
activate

try
set startup system folder alias to alias thechoosenSystemFolder
set localboot to true
on error
tell application "Finder"
activate
display dialog ,
"Leider hat das Einstellen des Startvolumes nicht geklappt." buttons {"Schade..."} default button 1 with icon stop giving up after 10
end tell
end try
quit
end tell
end StartVolumeSetter
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
References: 
 >Scripting System Preferences in MacOS X (From: Francisco Hirsch <email@hidden>)

  • Prev by Date: Scripting System Preferences in MacOS X
  • Next by Date: Re: How to get frontmost application?
  • Previous by thread: Scripting System Preferences in MacOS X
  • Next by thread: Re: Scripting System Preferences in MacOS X
  • Index(es):
    • Date
    • Thread