On Tue, Nov 25, 2003, the following words from Marlyse Comte
[EMAIL PROTECTED], emerged from a plethora of SPAM ...

>I've used in the past successfully 2 scripts to daily backup my Message
>Database and my Address Book
>
>Now, if I select a script via PM's AppleScript pulldown menu, all is well
>and it will backup. BUT, if I just double-click the same script in the
>finder, it will not execute, just open the Script. Fine, I click RUN -
>Result is that the AppleScript itself gets duplicated. 
>
>The path is correct, same script, 2 different behaviors. Any idea how to
>overcome this? 
>
>It's a problem because I used to use iCal to trigger these scripts, but
>it just isn't working anymore. It used to work with having an Alias of
>that script in the iCal folder. Now nothing works.
>
>The duplicate Address Database script looks like this:
>
>set originalAB to "FullPath:Address Database" as string
>
>tell application "Finder"
>       select file originalAB
>       duplicate selection
>end tell

Your script is being duplicated because of the "duplicate selection" line
above. This can be avoided by making sure that the item you want to
duplicate isn't an item selected in the Finder. Changing your script to
something like this should work:

<Begin AppleScript>
set originalAB to "FullPath:Address Database" as string

tell application "Finder"
  duplicate file originalAB
end tell
<End AppleScript>

This isn't necessarily a Panther problem - it was something to be avoided
in earlier OS. As long as the script is given the full path of the
object/file to work with, there is no need to have the Finder select it,
or problems like this can arise.

Although, for a more efficient script, you might want to do something
like this:

<Begin AppleScript>
property originalAB: alias "FullPath:Address Database"

tell application "Finder" to duplicate originalAB
<End AppleScript>

HTH

cheshirekat

-- 
Sometimes even to live is an act of courage.
- Lucius Annaeus Seneca, writer and philosopher

* 867 PowerBook G4 * OS X 10.2.6 * 768 MB Ram *


Reply via email to