Re: Newbie question -Applescript and Filemaker problems
Re: Newbie question -Applescript and Filemaker problems
- Subject: Re: Newbie question -Applescript and Filemaker problems
- From: email@hidden
- Date: Sun, 7 Apr 2002 00:44:32 EST
Oh yeah, you're a newbie : > Welcome aboard!
You have this line
set Filepic to item i of every item of the entire contents of
chosen_folder as text
and then never use Filepic. I suggest using it thusly
set Filepic to item i of every item of the entire contents of
chosen_folder
-- "as text" removed from the above line
set FileName to (name of Filepic) as text
instead of
set FileName to name of item i of every item of the entire contents of
chosen_folder as text
and so forth. This avoids multiple repetitive invocations of "entire
contents" (but see below). To further speed things up, put this line above
the repeat loop
set everyItem to every item of the entire contents of chosen_folder
then the Filepic line becomes
set Filepic to item i of everyItem
Now I'm thinking that "Filepic" is the wrong name for this variable. How
about "thisItem"?
You don't say if you are using classic or OSX. The classic Finder is
painfully slow anyway. The above changes get you to "barely tolerable" speed.
Also, I believe there is a longstanding bug in "entire contents." I don't use
it. Others here can speak more to that issue. It may well be fixed in OSX.
For classic, Akua Sweets has a command "the entries in" that I've found quite
useful instead of "entire contents".
It will be interesting to see how many responses beat this to the list, since
I'm on digest.
Jeff Baumann
email@hidden
www.linkedresources.com
cc please, on digest
In a message dated 4/6/02 6:49:53 PM, email@hidden wrote:
>
Greetings!
>
I have managed to write a script that catalogs the contents of a folder and
>
adds items to a filemaker database. The problem I have is that it is
soooooo
>
slow. Can anyone please tell me if there is a way to make this faster.
>
Thanks
>
Andy
>
>
set the chosen_folder to (choose folder with prompt "Pick the folder
>
containing the files to catalog:")
>
tell application "Finder"
>
set FileName to ""
>
set FilePath to ""
>
set FileCreation to ""
>
set FileModified to ""
>
set FileCreator to ""
>
set FileType to ""
>
set Filepic to ""
>
repeat with i from 1 to count of every item in the chosen_folder
>
set Filepic to item i of every item of the entire contents of
>
chosen_folder as text
>
set FileName to name of item i of every item of the entire contents
of
>
chosen_folder as text
>
set FilePath to item i of every item of the entire contents of
>
chosen_folder as text
>
set FileKind to kind of item i of every item of the entire contents
of
>
chosen_folder
>
set FileCreation to creation date of item i of every item of the
>
entire contents of chosen_folder
>
set FileModified to modification date of item i of every item of the
>
entire contents of chosen_folder
>
set FileCreator to creator type of item i of every item of the
entire
>
contents of chosen_folder
>
set FileType to file type of item i of every item of the entire
>
contents of chosen_folder
>
set FileSize to size of item i of every item of the entire contents
of
>
chosen_folder
>
set FilePhysicalSize to physical size of item i of every item of the
>
entire contents of chosen_folder
>
>
tell application "FileMaker Pro"
>
set myNewRecord to (create new record)
>
set cell "name" of myNewRecord to FileName
>
set cell "where" of myNewRecord to FilePath
>
set cell "kind" of myNewRecord to FileKind as text
>
set cell "fileCreated" of myNewRecord to FileCreation as string
>
set cell "fileModified" of myNewRecord to FileModified as string
>
set cell "Creator" of myNewRecord to FileCreator as string
>
set cell "type" of myNewRecord to FileType as string
>
set cell "physical size" of myNewRecord to FilePhysicalSize as
>
number
>
set cell "size" of myNewRecord to FileSize as number
>
end tell
>
end repeat
>
end tell
_______________________________________________
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.