Re: My folder action problem
Re: My folder action problem
- Subject: Re: My folder action problem
- From: Olivier Destrebecq <email@hidden>
- Date: Thu, 09 Aug 2001 15:19:56 -0500
well user interaction might not be available, but you can use a log file to
check on your data. You might have to open and close the file after each
instruction so that if you exit the script prematurely you still close the
file and can ge to its content afterwards.
here is a quick exemple:
the only problem with that one is that whenever you call the open function
on the file, you actually clear the file, i don't remember how to set the
entry point for writing in a file.
And every time you run the script you need to delete the log file
olivier
global FileRef
global logfile
global FileName
on adding folder items to parent_folder after receiving added_items
set FileName to "Testing5"
tell application "Finder" to make new file with properties
{name:FileName}
set FileRef to result
tell application "Finder" of machine "Groovy Grape iMac DV" of zone
"Engineering (5th Floor, PCN)"
my OpenFile()
tell application "Finder" to write "1" to FileRef
my CloseFile()
set nameList to the name of every process
my OpenFile()
tell application "Finder" to write nameList to FileRef
my CloseFile()
if nameList contains "Impressor 1.0.1.app" then
set theLabel to 1
else
set theLabel to 0
end if
end tell
end adding folder items to
on OpenFile()
tell application "Finder"
open for access FileRef with write permission
end tell
end OpenFile
on CloseFile()
tell application "Finder" to close access FileRef
end CloseFile
>
From: Luis Oliveira <email@hidden>
>
Date: Thu, 09 Aug 2001 17:41:17 +0100
>
To: Olivier Destrebecq <email@hidden>
>
Cc: <email@hidden>
>
Subject: Re: My folder action problem
>
>
Hi Olivier,
>
>
Unfortunately you can't use display dialog inside a tell app "Finder" of
>
machine..., and as soon as you drop a file inside the folder it gives the
>
error -2753. It doesn't tell you the name of the variable that is giving the
>
problem
>
>
>
./ luis oliveira
>
>
>
>
> did you try to put some display dialog "your variable" to check that they
>
> are what you expect?
>
>
>
> olivier
>
>
>
Original message
>
>
> Hi everyone,
>
>
>
> Sorry to insist on this question but can anyone tell why is this folder
>
> action giving me error -2753 everytime I run it
>
>
>
> -------------------------------------------------------------------
>
>
>
> property disk_name : path to startup disk
>
> property storage_folder : " 04 Rev. pag."
>
>
>
>
>
> on adding folder items to this_folder after receiving added_items
>
> tell application "Finder" of machine "Impressor" of zone "Producao"
>
> set nameList to the name of every process
>
> if nameList contains "Impressor 1.0.1.app" then
>
> set theLabel to 1
>
> else
>
> set theLabel to 0
>
> end if
>
> end tell
>
> set aData to my getDate(current date)
>
> repeat with ThisItem in added_items
>
> tell application "Finder"
>
> set the label index of ThisItem to theLabel
>
> AkuaCopy ThisItem to "Paginas:Cad. p/ acabar:Testes:" with
>
> overwriting
>
> set the name of ThisItem to ("x" & name of ThisItem)
>
> move file ThisItem to folder (storage_folder & aData as string)
>
> of disk disk_name with replacing
>
> end tell
>
> end repeat
>
> end adding folder items to
>
>
>
>
>
>
>
> on getDate(theDate)
>
> -- French Vanilla Date Handler -- Format: dd/mm/yyyy
>
> copy theDate to b
>
> set month of b to January
>
> set theShortDate to text -2 thru -1 of ("0" & (theDate's day) + 1) & "/"
>
> & ,
>
> text -2 thru -1 of ("0" & (1 + (theDate - b + 1314864) div 2629728))
>
> & ,
>
> "/" & (text -2 thru -1 of (year of theDate as string))
>
> end getDate
>
>
>
> -----------------------------------------------------------------------
>
>
>
> If I remove this piece of code,
>
>
>
> tell application "Finder" of machine "Impressor" of zone "Producao"
>
> set nameList to the name of every process
>
> if nameList contains "Impressor 1.0.1.app" then
>
> set theLabel to 1
>
> else
>
> set theLabel to 0
>
> end if
>
> end tell
>
>
>
> From the script everything runs ok. In the Applescript Language Guide in the
>
> section of Applescript errors this error is documented as
>
>
>
> -2753 The variable <name> is not defined
>
>
>
> What variable in this case ? Should be something inside the tell app
>
> "Finder" of machine ... Anyone ? This thing is driving me mad.
>
>
>
>
>
> Thanks
>
>
>
> ./ luis oliveira
>
_______________________________________________
>
applescript-users mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
>
From: Luis Oliveira <email@hidden>
>
Date: Thu, 09 Aug 2001 17:41:17 +0100
>
To: Olivier Destrebecq <email@hidden>
>
Cc: <email@hidden>
>
Subject: Re: My folder action problem
>
>
Hi Olivier,
>
>
Unfortunately you can't use display dialog inside a tell app "Finder" of
>
machine..., and as soon as you drop a file inside the folder it gives the
>
error -2753. It doesn't tell you the name of the variable that is giving the
>
problem
>
>
>
./ luis oliveira
>
>
>
>
> did you try to put some display dialog "your variable" to check that they
>
> are what you expect?
>
>
>
> olivier
>
>
>
Original message
>
>
> Hi everyone,
>
>
>
> Sorry to insist on this question but can anyone tell why is this folder
>
> action giving me error -2753 everytime I run it
>
>
>
> -------------------------------------------------------------------
>
>
>
> property disk_name : path to startup disk
>
> property storage_folder : " 04 Rev. pag."
>
>
>
>
>
> on adding folder items to this_folder after receiving added_items
>
> tell application "Finder" of machine "Impressor" of zone "Producao"
>
> set nameList to the name of every process
>
> if nameList contains "Impressor 1.0.1.app" then
>
> set theLabel to 1
>
> else
>
> set theLabel to 0
>
> end if
>
> end tell
>
> set aData to my getDate(current date)
>
> repeat with ThisItem in added_items
>
> tell application "Finder"
>
> set the label index of ThisItem to theLabel
>
> AkuaCopy ThisItem to "Paginas:Cad. p/ acabar:Testes:" with
>
> overwriting
>
> set the name of ThisItem to ("x" & name of ThisItem)
>
> move file ThisItem to folder (storage_folder & aData as string)
>
> of disk disk_name with replacing
>
> end tell
>
> end repeat
>
> end adding folder items to
>
>
>
>
>
>
>
> on getDate(theDate)
>
> -- French Vanilla Date Handler -- Format: dd/mm/yyyy
>
> copy theDate to b
>
> set month of b to January
>
> set theShortDate to text -2 thru -1 of ("0" & (theDate's day) + 1) & "/"
>
> & ,
>
> text -2 thru -1 of ("0" & (1 + (theDate - b + 1314864) div 2629728))
>
> & ,
>
> "/" & (text -2 thru -1 of (year of theDate as string))
>
> end getDate
>
>
>
> -----------------------------------------------------------------------
>
>
>
> If I remove this piece of code,
>
>
>
> tell application "Finder" of machine "Impressor" of zone "Producao"
>
> set nameList to the name of every process
>
> if nameList contains "Impressor 1.0.1.app" then
>
> set theLabel to 1
>
> else
>
> set theLabel to 0
>
> end if
>
> end tell
>
>
>
> From the script everything runs ok. In the Applescript Language Guide in the
>
> section of Applescript errors this error is documented as
>
>
>
> -2753 The variable <name> is not defined
>
>
>
> What variable in this case ? Should be something inside the tell app
>
> "Finder" of machine ... Anyone ? This thing is driving me mad.
>
>
>
>
>
> Thanks
>
>
>
> ./ luis oliveira
>
_______________________________________________
>
applescript-users mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/applescript-users