Idle handlers and Text files

BNig niggemann at uni-wh.de
Tue Nov 6 09:50:23 EST 2007


Hi,

in my experience at times the Finder can be slow to update a file but most
of the times this is not a problem for me.

If I really depend on the Finder to be up to date on the file I'm creating I
update the Finder with an applescript. This forces the Finder to update the
file.

You can do this from Revolution:

on mouseUp
    
    answer file "choose document"
    if it is empty then exit mouseUp
    
    -- it contains a path to a file including the filename in revolution
style
    put it into theRevPathFile

    -- convert the the path from revolution style to mac style for
applescript
    put revMacFromUnixPath (theRevPathFile) into theFile
    
    -- build the applescript command
    put "tell application " & quote & "Finder" & quote  into
UpDateFileWithAppleScript
    put return & "update file " &  quote & theFile & quote after
UpDateFileWithAppleScript
    put return & "end tell" after UpDateFileWithAppleScript
    
    -- do the applescript
    do UpDateFileWithAppleScript as applescript
    
    -- if something went wrong in the applescript the result is not empty
    if the result is not empty then put the result
    
end mouseUp

of course this only shows how it works, to put it into a mouseUp handler
with a choose file will probably not work on a file, which is not yet
updated by the Finder...

So just take the inner part of the handler and provide it with a complete
path (rev style) to the file you want to update after you created it.

fwiw

Bernd



Mark Schonewille-3 wrote:
> 
> Hi Jonathan,
> 
> 
> The Finder simply updates open windows once in a while, including the  
> desktop. It doesn't matter at which level in the hierarchy they are.  
> However, if you add or remove a folder, the window gets updated  
> instantly.  Not sure that it helps you, but if I do a test writing  
> files to a folder or the desktop, I see the file appear instantly on  
> my local disks, but not that quickly on network disks.
> 
> Best regards,
> 
> Mark Schonewille
> 
> 
> Op 6-nov-2007, om 9:14 heeft Jonathan Scott het volgende geschreven:
> 
>> Howdy,
>> 	Thank you to everyone who pointed me towards my solutions.
>> 	I still don't know exactly what is going on, but here are the  
>> solutions I figured out after receiving your advice:
>>
>> openstack not functioning
>> 	I just put in a new card with nothing on it (as the first card in  
>> the stack).  In it's handler I put in an "on idle" handler that  
>> does nothing but issue "send 'mouseUp'" statements and then moves  
>> the user to another card afterward (to a place where there is no  
>> "on idle" handler).
>>
>> text files not being written
>> 	The big problem was that text files were actually being written.   
>> I just couldn't find them for a few minutes sometimes.  Sometimes  
>> I'd have to wait a very long time for the files to pop up on the  
>> screen.  My assumption was that the finder's ability to update  
>> every viewable portion of the hard drive can take a lot of time.   
>> IOW, the file was there, it was just that the finder hadn't moved  
>> in to update that part of the screen yet.  So, my workaround was to  
>> have all files be saved to a folder on the desktop.  Because the  
>> desktop is closer to the top of the hierarchical structure, it is  
>> probably updated with much greater frequency.  I still don't know  
>> if this is a good decision.  It works though, so I'm happy.
>>
>> 	Thanks again everybody.
>>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 

-- 
View this message in context: http://www.nabble.com/Re%3A-use-revolution-Digest%2C-Vol-50%2C-Issue-10-tf4756652.html#a13608036
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list