• 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: Can't get every document file of every folder of startup disk whose creator type = "MSIE"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't get every document file of every folder of startup disk whose creator type = "MSIE"


  • Subject: Re: Can't get every document file of every folder of startup disk whose creator type = "MSIE"
  • From: Bill Hernandez <email@hidden>
  • Date: Mon, 18 Dec 2006 21:14:47 -0600


On Dec 18, 2006, at 7:20 PM, deivy petrescu wrote:

tell application "Finder"
-- Find any Explorer HTML documents

-- ALL OF THESE GENERATE THE FOLLOWING ERROR
-- Finder got an error: Can't get every document file of every folder of startup disk whose creator type = "MSIE"



set aList to get (every document file of every folder of the startup disk) whose (creator type is "MSIE")
repeat with f_ref in aList
set the (creator type) of f_ref to "sfri" -- Change the creator type to Safari
end repeat
end tell

Bill,
I believe it does not work because you are being a bit too ambitious with the "Finder".
If you select some smaller folders you should be able to do it.
But ditch the repeat loop.
This code works here:


set l to alias "BuiaBuio:Users:deivy:Desktop:Ex_Dtop_folder:"
-- the line below is really one line
tell application "Finder" to x set the creator type of (every document file of (every folder) of l) whose (name contains ".txt") to "R*ch"


Deivy

Deivy,

I'm big on writing re-useable functions, which in the case of AppleScript makes for huge overhead, slows things down, and wreaks havoc with memory utilization, particularly recursive routines, and kills the "Finder".

I can see I need to re-adjust my thinking and stop treating Applescript as if it were "C"

processDirectory(thisFolder) worked fine, but is not nearly as simple as your single line of code...

-- +---------+---------+---------+---------+---------
on processDirectory(thisFolder)
tell application "Finder"
try
set aItems to (get every item of folder thisFolder)
on error
set aItems to {}
end try
end tell
repeat with I from 1 to the count of aItems
set thisItem to (item I of aItems as alias)
set itemInfo to info for thisItem
set itemName to (name of itemInfo)
if ((folder of itemInfo) is true) then
my processDirectory(thisItem) -- It is a FOLDER
else if ((visible of itemInfo is true) and (alias of itemInfo is false)) then
if ((file creator of itemInfo) is in aCreatorTypes) then
set aFound to aFound & (POSIX path of thisItem)
tell application "Finder" to set creator type of thisItem to "R*ch"
else
-- DO NOTHING
end if
end if
end repeat
end processDirectory
-- +---------+---------+---------+---------+---------


Normally what I do is do a search using the Cmd-F at the Finder level, and once I have the selection, I do something with it. Unfortunately searching for [creator] is "somevalue" always fails, and returns no records, it appears to be broken in OSX 10.4.8

tell application "Finder"
   set aSel to selection
   repeat with f_ref in aSel
   ...

Using Cmd-F

If you use [Type] is "TEXT" that works fine
or [Extension name] is "txt" is OK also

but using

  [creator] is "MSIE", or [creator] is "sfri" or [creator] is "R*ch"

all fail, so I had to resort to some other way to get a selection...

Thanks very much,

Bill Hernandez
Plano, Texas


_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden
References: 
 >Want to get the full path of the mailbox (From: Robert Nicholson <email@hidden>)
 >Can't get every document file of every folder of startup disk whose creator type = "MSIE" (From: Bill Hernandez <email@hidden>)
 >Re: Can't get every document file of every folder of startup disk whose creator type = "MSIE" (From: deivy petrescu <email@hidden>)

  • Prev by Date: Re: Can't get every document file of every folder of startup disk whose creator type = "MSIE"
  • Next by Date: Re: Can't get every document file of every folder of startup disk whose creator type = "MSIE"
  • Previous by thread: Re: Can't get every document file of every folder of startup disk whose creator type = "MSIE"
  • Next by thread: Re: Can't get every document file of every folder of startup disk whose creator type = "MSIE"
  • Index(es):
    • Date
    • Thread