• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: New to AS... What am I doing wrong?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >New to AS... What am I doing wrong? (From: CP <email@hidden>)

  • Prev by Date: Re: Move and resize the window
  • Next by Date: Re: do visual basic
  • Previous by thread: New to AS... What am I doing wrong?
  • Next by thread: Re: New to AS... What am I doing wrong?
  • Index(es):
    • Date
    • Thread