Re: I need to allow a web page to fully load before saving
Re: I need to allow a web page to fully load before saving
- Subject: Re: I need to allow a web page to fully load before saving
- From: julius <email@hidden>
- Date: Sat, 06 Nov 2010 23:24:39 +0100
Title: Re: I need to allow a web page to fully load before saving
In the script ADD - DUPLICATE TO FOLDERS from Sal Soghoian ©1998 Apple Computer
was a routine used that would check the file type of the added item. If you are downloading a PDF, you can check the status of that PDF:
As long as it's file type is "bzy", your download is not complete. Moreover, you can use a dedicated download-folder, items (in your case PDF’s) already existing/added previously in that folder will be ignored due to their label_index. Here’s the routine of the script that checks the status of the added/dowloaded items:
Property: item_check_delay_time : 2
Property: folder_check_delay_time : 3
Property: special_label_index : 7
on check_busy_status(this_item)
-- a folder can contain items partially transfered
-- this routine will wait for all the folder contents to transfer
if the last character of (this_item as text) is ":" then
set the check_flag to false
repeat
-- look for any files within the folder that are still transferring
tell application "Finder"
try
set the busy_items to the name of every file of the 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
-- pause for the indicated time
delay the folder_check_delay_time
-- set the flag and check again
set the check_flag to true
end repeat
else -- the passed item is a single file, suitcase, clipping, etc.
-- check the label of the item. If it is the marked label, then it's already been processed so ignore.
tell application "Finder"
if (the label index of this_item) as integer is the special_label_index then
return "ignore"
end if
end tell
set the check_flag to false
repeat
tell application "Finder"
set the item_file_type to the file type of this_item
end tell
if the check_flag is true and ¬
the item_file_type does not start with "bzy" then
tell application "Finder"
set the label index of this_item to the special_label_index
end tell
-- allow the Finder time to change the label
delay the item_check_delay_time
return false
else if the item_file_type does not start with "bzy" then
-- set the flag and check again
set the check_flag to true
end if
-- pause for the indicated time
delay the item_check_delay_time
end repeat
end if
end check_busy_status
Pascal van den Bulck
--
ditisjulius.nl
graphic design & dtp
_______________________________________________
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/archives/applescript-users
This email sent to email@hidden