Re: New to AS... What am I doing wrong?
Re: New to AS... What am I doing wrong?
- Subject: Re: New to AS... What am I doing wrong?
- From: Andrew Oliver <email@hidden>
- Date: Wed, 10 Mar 2004 09:45:39 -0800
At first glance, you're saying:
>
duplicate templateFile to (s as string)
You can't duplicate a file into a string. Makes no sense.
You need to coerce the destination to a disk or folder (i.e. some container
that identifies where the duplicate file should go). Try:
duplicate templateFile to folder (s as string)
Andrew
:)
On 3/10/04 9:06 AM, "CP" <email@hidden> wrote:
>
Hey everyone, I read through these lists from time to time but have
>
never posted. I'm pretty new to AppleScript, but I understand some of
>
the fundamentals so far. I'm trying to modify a script that came with
>
the "BigCat" contextual menu plugin. The CM just lets you choose & run
>
one of the apple scripts located in a folder in the library.
>
>
So I'm trying to modify this script that copies the path of the
>
specified file or location to the clipboard. If you just select a
>
blank area of a window, it'll copy the directory path of that window.
>
So heres the original:
>
>
on main(filelist)
>
>
set s to ""
>
set ctitems to count of items in filelist
>
>
repeat with i from 1 to ctitems
>
set s to s & ((item i of filelist) as string)
>
if i < ctitems then
>
set s to s & ", "
>
end if
>
end repeat
>
>
set the clipboard to (s as string)
>
>
end main
>
>
>
And I'm trying to get it to copy a file from a specific location to the
>
location that the original script adds to the clipboard.
>
Like so:
>
>
on main(filelist)
>
>
set s to ""
>
set templateFile to ""
>
set ctitems to count of items in filelist
>
>
repeat with i from 1 to ctitems
>
set s to s & ((item i of filelist) as string)
>
if i < ctitems then
>
set s to s & ", "
>
end if
>
end repeat
>
>
set the clipboard to (s as string)
>
>
set templateFile to "Macintosh
>
HD:Users:cpruitt:Desktop:americanexpress.com/paperles.textClipping"
>
>
tell application "Finder"
>
activate
>
duplicate templateFile to (s as string) --"Macintosh
>
HD:Users:cpruitt:"
>
end tell
>
>
end main
>
>
>
It seems to still copy 's' to the clipboard, but wont copy the file to
>
that location. If I manually use a path (commented out) instead of a
>
variable it works fine. Anyone have any thoughts on what I need to
>
change to get it to work?
>
>
Thanks from the new guy...
>
>
>
- Cliff
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.