I just wrote my first “this thing could be usefull to someone else besides me” script.
I would like some advice from all the experts on this forum beofre i send it out to all of my friends. I tried to think of all the possible things that could go wrong and i added code to prevent them. Last think I want is to forget to do something or do something wrong and be tar and fethered by my friends.
The script replaces the BootPanel that you see on startup.
on split(theText, delim)
-- Spliting sub written by brian
set theStuff to {}
repeat while theText is not ""
set loc to the offset of delim in theText
if loc is 0 then
set theStuff to theStuff & {(items 1 through (length of theText) of theText as string)}
set theText to ""
else
set theStuff to theStuff & {(items 1 through (loc - 1) of theText as string)}
set theText to (items (loc + 1) through (length of theText) of theText as string)
end if
end repeat
theStuff
end split
-- The rest of the program written by Alex Camilo. With help from [url=http://www.macscripter.net]www.macscripter.net[/url]
on open the_files
if the (count of the_files) is equal to 1 then
set File_String to item 1 of the_files as string
set File_Path to item 1 of the_files
set File_Name to the last item of split(File_String, ":")
if File_Name is equal to "BootPanel.pdf" then
try
do shell script "cp " & (quoted form of POSIX path of File_Path) & " /System/Library/CoreServices/SystemStarter/QuartzDisplay.bundle/Resources/" with administrator privileges
on error theerror
display dialog theerror
end try
else
display dialog "Your file is not named "BootPanel.pdf""
end if
else
display dialog "Please drag ONLY ONE file onto this icon."
end if
end open
on run
tell application "Finder"
set theContainer to container of (path to me) as string
end tell
display dialog "Drag the new BootPanel.pdf file onto this program to update your startup screen. You can create your own BootPanel.pdf by saving an image of your choice" buttons {"Restore the default BootPanel", "Quit"} default button 2
if the button returned of the result is equal to "Restore the default BootPanel" then
try
do shell script "cp " & (quoted form of POSIX path of (theContainer as string)) & "BootImageloader.app/BootPanel.pdf" & " /System/Library/CoreServices/SystemStarter/QuartzDisplay.bundle/Resources/" with administrator privileges
on error theerror
display dialog theerror
end try
end if
end run
the file “BootPanel.pdf” is copied into the app’s resource folder in a folder that i created called images.