• 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
Subroutine that works only on the 1st run
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subroutine that works only on the 1st run


  • Subject: Subroutine that works only on the 1st run
  • From: Eric Schult <email@hidden>
  • Date: Fri, 08 Feb 2002 15:57:06 -0600

This script works the first time it's run, but fails on any subsequent run,
saying, "The <script> doesn't understand the fileList message. The same
thing happens in both the "on run" and "on open" routines. Can anybody guide
me?

Thanx!

wes

--------------------------

(* CREATES A TEXT FILE ON THE DESKTOP THAT LISTS THE FILES ,
IN A USER-SPECIFIED FOLDER. ALSO WORKS AS A DROPLET FOR ,
MULTIPLE FOLDERS. REQUIRES TANAKA'S OSAX. - ERIC SCHULT *)

on run
tell application "Finder"
set thisFolder to choose folder with prompt "Pick a folder:"
fileList(thisFolder) of me
end tell
end run

on open folderList
repeat with thisFolder in folderList
tell application "Finder"
set isFolder to false
if (folder (thisFolder as string)) exists then
fileList(thisFolder) of me
end if
end tell
end repeat
end open

on fileList(thisFolder)
tell application "Finder"
set fileList to name of every file in thisFolder
writeToFile "" to file ((path to desktop as string) & ,
((name of thisFolder) & ".txt"))
repeat with eachFile in fileList
appendToFile eachFile & return to file ,
((path to desktop as string) & ,
((name of thisFolder) & ".txt"))
end repeat
end tell
end fileList
_______________________________________________
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.

  • Prev by Date: Re: Subroutine that works only on the 1st run
  • Next by Date: Re: How to get frontmost application?
  • Previous by thread: Re: Subroutine that works only on the 1st run
  • Next by thread: Re: Subroutine that works only on the 1st run
  • Index(es):
    • Date
    • Thread