• 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: Add to startup items
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add to startup items


  • Subject: Re: Add to startup items
  • From: "Thomas C." <email@hidden>
  • Date: Thu, 20 May 2004 14:43:18 +0200

Thanks a lot Bill, that's exactly what I was looking for :-)

Thomas

Bill White wrote :

To remove items you could do something like this:

---------- BEGIN SCRIPT ----------

tell application "System Events"

set loginItems to name of every login item

set appName to item 1 of (choose from list loginItems with prompt
"Remove what?")

delete (every login item whose name is appName)

end tell

----------- END SCRIPT -----------

To add items, I use the following droplet:

---------- BEGIN SCRIPT ----------

on run

set theApp to choose file of type {"APPL"}
my addtologin(theApp)

end run

on open theFiles

repeat with theApp in theFiles

tell application "Finder"

if kind of theApp is not folder then my addtologin(theApp)

end tell

end repeat

end open

on trimName(thisApp) -- gets rid of .app extension

set AppleScript's text item delimiters to ".app"

set trimmedAppName to text item 1 of thisApp

set AppleScript's text item delimiters to ""

return trimmedAppName

end trimName

on addtologin(thisApp) -- adds an item to login items

set appPath to POSIX path of thisApp

tell application "System Events"

set appName to name of thisApp
set shortName to my trimName(appName)

if shortName is not in (name of every login item) then
make login item at end with properties {path:appPath}
end if

end tell

end addtologin

----------- END SCRIPT -----------

Hope that helps,

Bill
_______________________________________________
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: 
 >Re: Add to startup items (From: Bill White <email@hidden>)

  • Prev by Date: Re: ID CS book content
  • Next by Date: Re: applescript-users digest, Vol 3 #2696 - 14 msgs
  • Previous by thread: Re: Add to startup items
  • Next by thread: Saving HTML from Entourage
  • Index(es):
    • Date
    • Thread