• 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: "set name" not working - newbie question -urgent
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: "set name" not working - newbie question -urgent


  • Subject: RE: "set name" not working - newbie question -urgent
  • From: Joe Kelly <email@hidden>
  • Date: Fri, 12 Apr 2002 10:33:56 -0700

Tracy Vanderwerf wrote:
>
> I am trying to rename a file. This works outside of my
> script, which has
>
> a run handler. My code is in a subroutine that is using Stuffit
> Expander. After my file is expanded, it has the name 41275.A.1 (I have
> trashed the original 41275.A prior to this). I want to rename the
> expanded file to 41275.A. I am getting an error on selecting
> the folder
> fileContainer. As I said, this works fine outside the script:
>
> if got_new_expandpath then
> getcontainer2(save_filepath)
> display dialog "fileContainer = " & fileContainer
> set oldDelimiters to AppleScript's text item delimiters
> set AppleScript's text item delimiters to {":"}
> set COPY_ARTID to the last text item of new_expandpath as string
> set AppleScript's text item delimiters to oldDelimiters
> display dialog "after setting text item COPY_ARTID = " &
> COPY_ARTID
> tell application "Finder"
> try
> select folder fileContainer
> select file COPY_ARTID of folder fileContainer
> set name of selection to ARTID
> on error
> display dialog "error on select "
> end try
> end tell
> end if
>
>
> Thanks in advance for your help. (MAC OS 9.0.4, AppleScript 1.4.3)

I don't know what the problem is, but here are some suggestions:

1) don't use the Finder command "select". It is not necessary. You can
simply reduce the three lines in your try block to one line:
set name of (file COPY_ARTID of folder fileContainer) to ARTID

2) Add parameters to your "on error" statement for better clarity:
on error msg number num
display dialog "Caught error: " & msg & " ID=" & num
end try

This will give you the OSStatus number of the error.


3) What exactly does fileContainer look like?

joe
_______________________________________________
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.

  • Prev by Date: Re: "set name" not working - newbie question -urgent
  • Next by Date: [Fwd: Re: "set name" not working - newbie question -urgent]
  • Previous by thread: Re: "set name" not working - newbie question -urgent
  • Next by thread: [Fwd: Re: "set name" not working - newbie question -urgent]
  • Index(es):
    • Date
    • Thread