how to control processes within finder?

Hi

I have a simple script showing me invisible files and folders in finder.

tell application “Finder” to quit
do shell script “defaults write com.apple.finder AppleShowAllFiles true”
delay 1
tell application “Finder” to launch

If there is running a long lasting job (e.g. a copy of a large folder or somesthing else), I get at least one error message which I cannot control. How can I check if finder is busy with such a task? Any hints or tips? Thanks in advance.

Regards
Lazybaer

hi lb,

this may be off topic, but i use a script to show invisible files and folders that does not require me to restart the finder. you may find it useful:

property file_List : "#!/bin/sh 
/bin/ls -a "

on diskCheck(thePath)
	set unixString to ("cd " & thePath & ";" & file_List)
	set showFiles to (do shell script "sh -c " & quoted form of unixString with administrator privileges)
	set stringToBeDisplayed to "Here is a list of the files on your drive:  " & "
	" & showFiles
	set tempVar to display dialog stringToBeDisplayed buttons {"Exit", "Refresh"} default button "Refresh"
	set theButtonPressed to button returned of tempVar
	if theButtonPressed is "Refresh" then
		diskCheck(thePath)
	end if
end diskCheck


set thePath to "/Volumes/" & "\"" & the text returned of (display dialog "Put the name of the Hard Drive you want to check in the box:  " default answer "") & "\""
diskCheck(thePath)

of course, this script could be improved upon depending on what you want it to do. hope that helps.