• 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: Can a script change its own name?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can a script change its own name?


  • Subject: Re: Can a script change its own name?
  • From: Jan Pieter Kunst <email@hidden>
  • Date: Sun, 27 May 2001 15:39:02 +0200

Bill Briggs (email@hidden) schreef op 27-05-2001 15:08 :

> At 2:07 PM +0200 27/05/01, Jan Pieter Kunst wrote:
>> I suspect that it is not possible to have the script change its own
>> name while it is running.
>
> No, you can do it. Did you save it as an application, or try to run
> it from the editor you are using? Here's some quick and dirty code
> that works fine for me when saved as an application.
>
> - web
>
> property myName : "on"
> tell application "Finder"
> set x to path to me
> if name of x is "on" then
> set name of x to "off"
> else if name of x is "off" then
> set name of x to "on"
> end if
> end tell


Indeed, that works. I experimented with "me" in the Script Editor first, but
I noticed that it seemed to refer to the Script Editor application instead
of the script. I didn't realize that the referent of "me" would probably
change if the script was saved as an application.

I also didn't realize that I had to use the name of a path instead of the
name of a file.

Thanks!

Jan Pieter.-


  • Follow-Ups:
    • Re: Can a script change its own name?
      • From: Paul Berkowitz <email@hidden>
    • Re: Can a script change its own name?
      • From: Bill Briggs <email@hidden>
References: 
 >Re: Can a script change its own name? (From: Bill Briggs <email@hidden>)

  • Prev by Date: Re: Can a script change its own name?
  • Next by Date: Re: Can a script change its own name?
  • Previous by thread: Re: Can a script change its own name?
  • Next by thread: Re: Can a script change its own name?
  • Index(es):
    • Date
    • Thread