Hottest Free Downloads - DownloadPipe.com Over 197,000 downloads! Bookmark Now!
DownloadPipe.com - New Downloads Every Minute
 SEARCH:
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Folder Action & temporary files

 
   Mac (Home) -> Apple Scripts RSS
Next:  how to disconnect macbook video display  
Author Message
Florian

External


Since: Mar 18, 2008
Posts: 6



(Msg. 1) Posted: Fri Dec 12, 2008 2:33 pm
Post subject: Folder Action & temporary files
Archived from groups: alt>comp>lang>applescript (more info?)

Hello,

i am trying to write a Folder Action AppleScript which should attached
to my download folder.
In this applescript-code i do several modifications i.e. i
unquarantine the files, color them using labels etc...

But i realize one big problem which is related (at least i tihnk so)
with running downloads and temporary files created by the browsers
(safari & firefox)

the folder action is triggered before the download had finished and i
guess folder actions don't get retriggered if a temp file is renamed
to its final filename, but some of the actions (like file-renaming)
can only be done if the file-transfer is done.

so lets look on my code:


property DELAY_TIME_SECONDS : 5 -- How long to wait between checking
file size.

on adding folder items to thisFolder after receiving theItems
repeat with f in theItems
set oldSize to 0
set newSize to -1
-- When newSize equals oldSize, it means the copy is complete
because the size hasn't changed.
repeat while newSize ≠ oldSize
-- Get the file size.
set oldSize to size of (info for f)
delay DELAY_TIME_SECONDS
-- Sample the size again after delay for comparison.
set newSize to size of (info for f)
end repeat
--
-- Do your processing here on file f.
-- im just trying to show a small dialog here where my actions/
modifications should happen for the file
display dialog "download finished"
--
-- thats where my processing should start for each
file
end repeat
-- Or start processing here to wait for all files to be complete.
end adding folder items to



END
I am wondering if my guess with the temorary files is causing my
problems as i guess my applescriot code itself should work.

Would be great if someone else could give me a hint regarding this
problem
Best regards
fidel
Back to top
Login to vote
Florian

External


Since: Mar 18, 2008
Posts: 6



(Msg. 2) Posted: Fri Dec 12, 2008 3:11 pm
Post subject: Re: Folder Action & temporary files [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Dave,

may i ask why you suggest not to use Folder Actions ?
Is it that unstable / broken ?

Thank you for the fast response.
Best regards
fidel
Back to top
Login to vote
Dave Balderstone

External


Since: May 31, 2006
Posts: 850



(Msg. 3) Posted: Fri Dec 12, 2008 4:36 pm
Post subject: Re: Folder Action & temporary files [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

This message is not archived
Back to top
Login to vote
Dave Balderstone

External


Since: May 31, 2006
Posts: 850



(Msg. 4) Posted: Fri Dec 12, 2008 7:30 pm
Post subject: Re: Folder Action & temporary files [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

This message is not archived
Back to top
Login to vote
Jolly Roger

External


Since: Nov 05, 2007
Posts: 1218



(Msg. 5) Posted: Fri Dec 12, 2008 7:44 pm
Post subject: Re: Folder Action & temporary files [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <121220081930039107%dave@N_O_T_T_H_I_Sbalderstone.ca>,
Dave Balderstone <dave RemoveThis @N_O_T_T_H_I_Sbalderstone.ca> wrote:

> In article
> <8a2522be-9125-4ef9-9cad-94d19851653f RemoveThis @u18g2000pro.googlegroups.com>,
> Florian <fidel RemoveThis @vido.info> wrote:
>
> > may i ask why you suggest not to use Folder Actions ?
> > Is it that unstable / broken ?
>
> I've found them unreliable.

Strange. They've always worked fine for me.

--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR
Back to top
Login to vote
Dave Balderstone

External


Since: May 31, 2006
Posts: 850



(Msg. 6) Posted: Fri Dec 12, 2008 8:03 pm
Post subject: Re: Folder Action & temporary files [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

This message is not archived
Back to top
Login to vote
Hans Besjes

External


Since: Dec 13, 2008
Posts: 1



(Msg. 7) Posted: Sat Dec 13, 2008 7:08 am
Post subject: Re: Folder Action & temporary files [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Florian,

On 12/12/2008 23:33:10 Florian <fidel.DeleteThis@vido.info> wrote:

i am trying to write a Folder Action AppleScript which should attached to

> my download folder. In this applescript-code i do several modifications
> i.e. i unquarantine the files, color them using labels etc...

> But i realize one big problem which is related (at least i tihnk so) with
> running downloads and temporary files created by the browsers (safari &
> firefox)

> the folder action is triggered before the download had finished and i
> guess folder actions don't get retriggered if a temp file is renamed to
> its final filename, but some of the actions (like file-renaming) can only
> be done if the file-transfer is done.


I don't think the file really is renamed. I think once the download completes (Name.download file) a new file is created with the contant and the name of the downloaded file "Name".
I you have a download file selected in the Finder when it is downloading, that selection will be lost when the download finishes and the new file is created, replacing the download file...

May you should try triggering only on (the creation of) files that have no .download extension. Download extension files can have other "problems" as well.
If you do not OK the Safari message "This file is an application..." (with HTML files), this file download will not finish, and the final file/finale name will not be created...

Even cancelling such a download leaves the already downloaded part of a downloadfile (file.download) intact. This has te be removed manually...

Hans Besjes


> so lets look on my code:

> property DELAY_TIME_SECONDS : 5 -- How long to wait between checking file
> size.

> on adding folder items to thisFolder after receiving theItems repeat with
> f in theItems set oldSize to 0 set newSize to -1 -- When newSize equals
> oldSize, it means the copy is complete because the size hasn't changed.
> repeat while newSize ≠ oldSize -- Get the file size. set oldSize to
> size of (info for f) delay DELAY_TIME_SECONDS -- Sample the size again
> after delay for comparison. set newSize to size of (info for f) end
> repeat -- -- Do your processing here on file f. -- im just trying to show
> a small dialog here where my actions/ modifications should happen for the
> file display dialog "download finished" -- -- thats where my processing
> should start for each file end repeat -- Or start processing here to wait
> for all files to be complete. end adding folder items to

> END I am wondering if my guess with the temorary files is causing my
> problems as i guess my applescriot code itself should work.

> Would be great if someone else could give me a hint regarding this problem
> Best regards fidel
Back to top
Login to vote
Jolly Roger

External


Since: Nov 05, 2007
Posts: 1218



(Msg. 8) Posted: Sat Dec 13, 2008 9:46 am
Post subject: Re: Folder Action & temporary files [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <121220082003410208%dave@N_O_T_T_H_I_Sbalderstone.ca>,
Dave Balderstone <dave DeleteThis @N_O_T_T_H_I_Sbalderstone.ca> wrote:

> In article <jollyroger-7ACF2E.19442912122008 DeleteThis @news.individual.net>,
> Jolly Roger <jollyroger DeleteThis @pobox.com> wrote:
>
> > In article <121220081930039107%dave@N_O_T_T_H_I_Sbalderstone.ca>,
> > Dave Balderstone <dave DeleteThis @N_O_T_T_H_I_Sbalderstone.ca> wrote:
> >
> > > In article
> > > <8a2522be-9125-4ef9-9cad-94d19851653f DeleteThis @u18g2000pro.googlegroups.com>,
> > > Florian <fidel DeleteThis @vido.info> wrote:
> > >
> > > > may i ask why you suggest not to use Folder Actions ?
> > > > Is it that unstable / broken ?
> > >
> > > I've found them unreliable.
> >
> > Strange. They've always worked fine for me.
>
> Strange. They haven't for me.
>
> What have you used them for? That's probably the difference.

Well, here's one use case:

I use MT-NewsWatcher's "Shared Newsrc" feature, which stores my
subscription and group status information in a "newsrc" file on my FTP
server here at home. I also keep a copy of the Filters.xml file exported
from MT-NewsWatcher there, as well as a text file containing my Usenet
signature. I have a folder called "Upload News Stuff" with a folder
action attached that automatically uploads these files to the same
location on the FTP server whenever I drop file them it. It works great.

I've used folder action scripts to do things like convert images from
one format to another, and things like that in the past as well.

--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR
Back to top
Login to vote
Dave Balderstone

External


Since: May 31, 2006
Posts: 850



(Msg. 9) Posted: Sat Dec 13, 2008 10:22 am
Post subject: Re: Folder Action & temporary files [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

This message is not archived
Back to top
Login to vote
Display posts from previous:   
Related Topics:
folder actions - need to move files back to where they cam.. - When a file is dropped in a folder with a folder action attached the file is moved to the folder as usual. (Except in cases where the file must be copied due to permissions.) Is it possible for my script to move the files back to their "home" o...

Adding New Folder - Below is script that I need to create a new folder in the same folder as the location of the script. It runs and compiles but the folder is never created. I have checked other areas and no folder is created at all even though I don't get an error from....

Desktop folder - Hi, How to obtain the name of the current user ? (to access to his desktop folder) ? Thanks in advance MS

Folder Actions and child folders - I've been playing around with Folder Actions (very cool!), wondering if it's possible to get a Folder Action to trigger when a *child folder* is changed. i.e. attach the action to ParentFolder, then trigger when a file is added to ChildFolder or..

add Finder items of folder to Toast - Hi, the following errors because Finder classes can't be converted for Toast: tell application "Finder" set sourceItems to a reference to (items of folder sourceFolderPath) end tell application "Toast 6 Titanium" add to current...
       Mac (Home) -> Apple Scripts All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum
Categories:
 Windows Forums
 Game Forums
 Linux Forums
  Mac Forums
 PDA Forums
 Mobile Forums
  Top  |  Store  |  RSS Feeds RSS  |  Data Feeds  |  Advertise  |  Submit  |  Bookmark  |  Newsletter  |  Contact