|
|
Some improvements
I like this script, but after playing around with it for a little while I found a couple of things that could do with improving. First, the standard Login Items launches everything in the background, which looks much nicer (well, to me anyway).
Second, if you rename the aliases (e.g., to set the launching order), process hiding no longer works because the script uses the alias name rather than the name of the original item.
Actually, it's also just occured to me that the second one would also prevent you from "hiding" documents. (hack, hack :)
Here's an updated version of the script that fixes these:
property pPathToLoginItemsFolder : "" -- The script will set this value.I haven't tested it extensively, but it appears to do the job. Hope you find it useful!
Some improvements
I had some problems with another applescript login item as well as some problems with other user accounts with this tip.
Some improvements
Your script's great, thanks! I started with it, adding growl notifications. so here it is:
(Took out the comments to not be repetitive here. I also took out the delay. One thing I'm not sure about is how to get the path for the grolwhelper - here it's hardcoded).
property pPathToLoginItemsFolder : "" -- The script will set this value.
set loginItemsList to {} -- The script will set this value.
setupGrowl()
tell application "Finder"
set pPathToLoginItemsFolder to ((container of (path to me) as alias) as text) & "Login Items:"
set loginItemsList to every alias file of folder pPathToLoginItemsFolder
end tell
repeat with i in loginItemsList
tell application "Finder"
set originalItem to original item of i
if (class of originalItem is application file) then
tell me to launch application (originalItem as string)
if (comment of i is "hide") then
set visible of process ((displayed name of originalItem) as text) to false
end if
else
open originalItem
if (comment of i is "hide") then
set appName to ¬
(displayed name of application file id (creator type of originalItem)) as text
set visible of process appName to false
end if
end if
end tell
set justAppName to getAppName(originalItem as string)
tell application "GrowlHelperApp"
notify with name ¬
"Program started" title ¬
"The following program launched" description justAppName ¬
application name ¬
"Custom login items" icon of application justAppName
end tell
end repeat
on setupGrowl()
tell application "System Events"
set isRunning to ¬
(count of (every process whose name is "GrowlHelperApp")) > 0
end tell
if (isRunning = 0) then
open application ¬
"Macintosh HD:Library:PreferencePanes:Growl.prefPane:Contents:Resources:GrowlHelperApp.app"
delay 2
end if
tell application "GrowlHelperApp"
set the allNotificationsList to {"Program started"}
set the enabledNotificationsList to {"Program started"}
register as application ¬
"Custom login items" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Script Editor"
end tell
end setupGrowl
on getAppName(thePath)
set oldDelims to AppleScript's text item delimiters
try
set AppleScript's text item delimiters to {":"}
set withExt to the last text item in (thePath as string) as string
set AppleScript's text item delimiters to {"."}
set withoutExt to the first text item in withExt as string
set AppleScript's text item delimiters to oldDelims
return withoutExt
on error
set AppleScript's text item delimiters to oldDelims
end try
end getAppName
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.13 seconds |
|