Again Applescript Error -10006
I recorded this script:
tell application "Finder"
activate
set target of Finder window 1 to folder "Documents" of folder "vittorio" of folder "Users" of startup disk
set target of Finder window 1 to folder "COMMISSIONE TRIBUTARIA" of folder "Documents" of folder "vittorio" of folder "Users" of startup disk
set target of Finder window 1 to folder "COMM. TRIB. MIA" of folder "COMMISSIONE TRIBUTARIA" of folder "Documents" of folder "vittorio" of folder "Users" of startup disk
open document file "TESTBatchRun.ffs_batch" of folder "COMM. TRIB. MIA" of folder "COMMISSIONE TRIBUTARIA" of folder "Documents" of folder "vittorio" of folder "Users" of startup disk using application file "RealtimeSync.app" of folder "FreeFileSync_6" of folder "Applications" of startup disk
end tell
Well, I added to the recorded script the last row (open document file etc.)
Now, if I run this script with a finder window on the desktop it works fine, while if I run the script whit Finder not open it returns the following error:
error "Finder" found an error:can't set Finder window 1 to folder \"Documents\" of folder \"Vittorio\" of folder \"Users\" of startup disk." number -10006 from Finder window 1
(error "Finder ha trovato un errore: Non posso impostare Finder window 1 a folder \"Documents\" of folder \"Vittorio\" of folder \"Users\" of startup disk." number -10006 from Finder window 1)
How can I avoid rising the error when the script run even if no finder window open?
Thanks a lot
Applescript editor 2.6.1, Applescript 2.3.2 on iMac 21,5" running OS X 10.9 Mavericks