folder action extension out of memory

Hope everyone is having a good day, because surely am not. Does anyone have any experience with the folder actions extension running out of memory? I’m trying to run a script when files are added to the folder, but the Finder returns the folder actions extension has run out of memory error.
Thanks in advance, BC

: Hope everyone is having a good day, because surely am not. Does anyone have
: any experience with the folder actions extension running out of memory?
: I’m trying to run a script when files are added to the folder, but the
: Finder returns the folder actions extension has run out of memory error.
: Thanks in advance, BC
Could you post your script? Jean-baptiste LE STANG

: Could you post your script? Jean-baptiste LE STANG
Sure thing. The folder action handler is basically just ripped off from the applescript help menu. I’ll spare you the painful details of the rest of the script unless you’re really up for a bludgeoning.
–Activates the script when a file is added to the folder on adding folder items to this_folder after receiving added_items
if copy_check_indicator is true then
–Checks the status of the “added_items” files
set added_items to my CheckAddedItems(the_added_items)
if added_items is {} then return “no valid items”
end if
repeat with i from 1 to (number of items in added_items)
set current_item to item i of added_items
set file_to_send to my PreflightFile(current_item)
if file_to_send is not null then
–Transfers the file_to_send file to the target_server with the designated login info
–Also sends the appropriate emails
my SendFile(file_to_send, target_server, this_username, this_password, email_addresses)
end if
end repeat
–quit all of the applications
try
with timeout of 10 seconds
tell application “Fetch 4.0.1”
quit
end tell
end timeout
end try
try
with timeout of 10 seconds
tell application “Outlook Express”
quit
end tell
end timeout
end try
try
with timeout of 10 seconds
tell application “QuarkXPress™ 4.11”
quit
end tell
end timeout
end try
end adding folder items to
on CheckAddedItems(added_items)
–check the transfer status of every added file to determine if
–each file has completed being moved into the attached folder
set not_busy_items to {}
repeat with i from 1 to (number of items in added_items)
set this_item to (item i of added_items)
if my CheckBusyStatus(this_item) is false then
set the end of the not_busy_items to this_item
end if
end repeat end CheckAddedItems
–This procedure waits for all the folder contents to transfer on CheckBusyStatus(this_item)
if last character of (this_item as text) is “:” then
set the check_flag to false
–look for files that are still transferring
repeat
tell application “Finder”
try
set busy_items to the name of every file of entire contents of this_item ¬
whose file type begins with “bzy”
on error
set the busy_items to {}
end try
end tell
if the check_flag is true and the busy_items is {} then
return false
end if
–pause for the “folder_check_delay_time” that was declared at the beginning of the program
delay folder_check_delay_time
–set the flag and check again
set the check_flag to true
end repeat
–The passed item is a single file.
–Checks the label of the item. If it matches the “special_label_index”,
–then it has already been processed so ignore.
else
tell application “Finder”
if (label index of this_item) as integer is special_label_index then
return “ignore”
end if
end tell
set the check_flag to false
repeat
tell application “Finder”
set item_file_type to the file type of this_item
end tell
if check_flag is true and item_file_type does not start with “bzy” then
tell application “Finder”
set label index of this_item to special_label_index
end tell
–give the Finder time to change the label
delay item_check_delay_time
return false
else if item_file_type does not start with “bzy” then
–set the flag and check again
set check_flag to true
end if
–pause for the “item_check_delay_time” that was set at the beginning of the program
delay item_check_delay_time
end repeat
end if end CheckBusyStatus

those first two lines aren’t strung together like they appear in the last message. Sorry about that.

: Hope everyone is having a good day, because surely am not. Does anyone have
: any experience with the folder actions extension running out of memory?
: I’m trying to run a script when files are added to the folder, but the
: Finder returns the folder actions extension has run out of memory error.
I don’t use Folder Actions but I’ve seen others mention the same problem.
If I recall correctly, the advice was to increase the RAM allotted to the
extension.
Rob

: Hi Bob,
: Maybe you can try using the actual script from here:
: ftp://ftp.apple.com/developer/Development_Kits/AppleScript/Sample_Scripts/Folder_Actions_Scripts/
: instead of I don’t know how you got it out of the Help menu. Also, How many
: files are you dropping onto the folder? What system are you running if you
: haven’t mentioned it already? Do you need help in increasing the memory to
: an extension? Do you have ResEdit?
It looks like the scripts at that FTP site are using the same code that I snagged from the help menu, but I’ll give it a closer look. I’m currently just dropping one file on the folder, but I need it to be able to handle multiple files at a time. I’m running OS 9.2.2 on a P.O.S. Imac, which unfortunately is one of the requirements for this script. While speaking with one of our developers yesterday he had mentioned that we might be able to use ResEdit to bumb up the memory, but we weren’t sure if that was a safe thing to do. Is this a common practice?
I also attempted (unsuccessfully) to save the majority of the script out seperately and just call a run script from the folder action script. Anybody have any input on whether this is a viable option or not?
Thanks for all of the input, everybody…
-Bob

: It looks like the scripts at that FTP site are using the same code that I
: snagged from the help menu, but I’ll give it a closer look. I’m currently
: just dropping one file on the folder, but I need it to be able to handle
: multiple files at a time. I’m running OS 9.2.2 on a P.O.S. Imac, which
: unfortunately is one of the requirements for this script. While speaking
: with one of our developers yesterday he had mentioned that we might be
: able to use ResEdit to bumb up the memory, but we weren’t sure if that was
: a safe thing to do. Is this a common practice?
I’ve never done it with an extension but I have with the Finder and it caused
no problems (it solved them). As mentioned earlier in the thread, others
have bumped up the extension’s RAM and it helped to overcome the
problem that you are seeing. I’d advise you to save a copy of the original
extension just in case something goes wrong (always prudent when
attempting something like this). :slight_smile:
Rob

Hi Bob,
Maybe you can try using the actual script from here:
ftp://ftp.apple.com/developer/Development_Kits/AppleScript/Sample_Scripts/Folder_Actions_Scripts/
instead of I don’t know how you got it out of the Help menu. Also, How many files are you dropping onto the folder? What system are you running if you haven’t mentioned it already? Do you need help in increasing the memory to an extension? Do you have ResEdit?
Later, Kel.