Re: tab delimeted log file
Re: tab delimeted log file
- Subject: Re: tab delimeted log file
- From: Brian <email@hidden>
- Date: Fri, 06 Apr 2001 18:16:42 -0400
Manu thanks to everyone for the kind help.
here's the (mostly) working script I ended up with. I say mostly because:
I haven't yet figured out how to debug the NotMoved handler (is it as simple
as changing the exists queries to True for testing and reverting to False
for the deployed production script?)
Nor have I figured out how to write both the ToBeMoved values and the
NotMoved values to the same log file. So for now I'm happy enough with the
ToBeMoved values in a log with any omissions being de facto NotMoved
problems.
global the_date
global ToBeMoved
global LogName
on adding folder items to this_folder after receiving added_items
tell application "Finder"
set move_list to every item of this_folder whose label index is not 3
move move_list to folder "target" of disk "data"
set the label index of every item of this_folder to 3
my makeLog(move_list)
my CheckMove(move_list)
set dp to (path to desktop) as text
set LogName to "Push Log"
set file_ref to open for access file (dp & LogName) with write permission
set eof_value to get eof file_ref
write ToBeMoved & return to file_ref starting at (eof_value + 1)
close access file_ref
end tell
end adding folder items to
on makeLog(move_list)
set ToBeMoved to ""
repeat with i in move_list
set i to i as string -- coerce alias to string
set the_date to {month, day, year} of (current date)
set the_time to (time string) of (current date)
set ToBeMoved to ToBeMoved & i & tab & the_date & tab & the_time & return
end repeat
end makeLog
(*
this is the part I'm unsure how to check....
*)
on CheckMove(move_list)
set NotMoved to ""
repeat with i in move_list
tell application "Finder"
set itsName to name of i -- coerce alias to file name
set itsPath to "
data:target:" & itsName as alias
exists itsPath -- does file exist at new location?
set theExistence to the result
if theExistence is false then -- file does not exist at new location
set i to i as string -- coerce alias to string
set NotMoved to NotMoved & i & tab & "didn't copy" & return
end if
end tell
end repeat
end CheckMove
>
Date: Wed, 4 Apr 2001 16:41:15 +0200
>
To: email@hidden
>
From: Sander Tekelenburg <email@hidden>
>
Subject: Re: tab delimeted log file
>
-----BEGIN PGP SIGNED MESSAGE-----
>
Hash: SHA1
>
At 00:28 -0400 UTC, on 04/04/2001, Brian wrote:
>
> Forgive the blatant cry for help but I've noticed how generously many users
>
> of this forum will offer snippets or complete scripts to help newbies like
>
> myself out....
>
Posted scripts and/or snippets thereof are useful as examples only. If all
>
you need to do is copy & paste you'll never learn to do anything yourself and
>
remain dependant on others. You won't see any of that in this message. If
>
you're still interested, read on:
<snip>
I did. Thanks very much!!!
Brian