Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Create a list of login (startup) items' paths' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create a list of login (startup) items' paths
Authored by: robJ on Nov 28, '05 03:12:29PM
Here's a simple AppleScript script that will also generate a text file (login_items.txt) on the desktop.
 set paths_ to ""
 tell application "System Events"
  set loi to properties of login items
  repeat with i in loi
   set paths_ to paths_ & ("Path = " & (quoted form of path of i) & return)
  end repeat
 end tell

 write_to_file(paths_, (path to desktop as text) & "login_items.txt", false)

 to write_to_file(this_data, target_file, append_data)
  try
   set the target_file to the target_file as text
   set the open_target_file to ¬
    open for access file target_file with write permission
   if append_data is false then ¬
    set eof of the open_target_file to 0
   write this_data to the open_target_file starting at eof
   close access the open_target_file
   return true
  on error
   try
    close access file target_file
   end try
   return false
  end try
 end write_to_file


[ Reply to This | # ]
Create a list of login (startup) items' paths
Authored by: efge on Nov 28, '05 05:34:37PM

Yeah and here's a one-line shell script that does the same thing:

#!/bin/sh
defaults read loginwindow | fgrep 'Path =' | sed -E 's/.*"(.*)".*/\1/' > ~/Desktop/login_items.txt

(assuming this forum doesn't bork the backslash before the 1 -- stupid forum code)



[ Reply to This | # ]