Can an AppleScript rename itself?

I have a script app (running in SheepShaver emulating Mac OS 9.0.4) that tests whether another script is running and makes it quit if the other script it is running, or launches the other script if the other script is not running.

The script app is called Background Enable/Disable. Is it possible for it to change its name to Background Enable after it shuts down the other script, and then change its name to Background Disable after it launches the other script? I know this is unlikely, but the scripters on this forum have many deep abilities.

I know that was doable on previous OS version.

somthing like:

set myPath to path to me as alias
tell application "Finder" to set the name of myPath to "Background Enable"

Amazing! Works perfectly. Thank you!

1 Like