Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 957657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:44:27+00:00 2026-05-16T00:44:27+00:00

My applescript needs to detect its own filename, and the following runs fine on

  • 0

My applescript needs to detect its own filename, and the following runs fine on Snow Leopard (10.6)

set my_name to name of me as string
display dialog "Name: " & my_name

It displays “Name: AppleScript Editor” when I run it from AppleScript Editor, and it displays “Name: NewTest” when I save it as an application called NewTest.

When I run it on a Leopare (10.5) machine, it complains “Can’t make name of <> into type string.” When I remove the “as string” portion, it runs under Script Editor, returning “Name: Script Editor”, but when saved as an application, it errors and says, “Can’t get name.”

What is different about running in script editor and saving as application under 10.5?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:44:28+00:00Added an answer on May 16, 2026 at 12:44 am

    Here’s another thought although I haven’t checked. One thing that can cause problems is the command “get”. In general when you run a command like “name of me” the command get is implied so you’re really running “get name of me”. The problem is that the implied “get” is not always the case. So sometimes you have to explicitly say “get”. Whenever I have a problem like yours the first thing I try is to add “get” to the command… it’s become habit because you just never know. Note that you can always use the word get and never have that issue. As such, try changing your command to “set my_name to (get name of me)”. I’d be interested to know if that fixes your 10.5 problem. Also note that a name is already a string so there’s no need to coerce the result to a string.

    EDIT:
    I looked through some of my older scripts. I used the following code to get the name. In my notes I have these comments…

    — this will get the name of the application or script without any file extension

    — it is done using the path because when a script is run from the script menu, and you write set myName to name of me, then the result is “applescript runner” instead of the actual name

    — also it assures that you’re getting the name as it appears in the Finder because sometimes the system events process name is different than the Finder name

    on getMyName()
        set myPath to path to me as text
        if myPath ends with ":" then
            set n to -2
        else
            set n to -1
        end if
        set AppleScript's text item delimiters to ":"
        set myName to text item n of myPath
        if (myName contains ".") then
            set AppleScript's text item delimiters to "."
            set myName to text 1 thru text item -2 of myName
        end if
        set AppleScript's text item delimiters to ""
        return myName
    end getMyName
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a mono app for OSX that needs to use AppleScript. I
I have such an AppleScript: tell application Firefox activate set the bounds of the
Is there an objective c version of text delimiters?? Here's the applescript code: set
I have an issue with an applescript I have written. The script needs to
I have the challenge in AppleScript to manipulate a string as follows: Base string
I am working with AppleScript and need to do this: set TextToWrite to #!/bin/bash
I am trying to create an Automator Service that runs an applescript that eventually
I'm trying to set the tracks of a user playlist using AppleScript. I don't
I have an AppleScript: on run set pathName to /Users/Alexander/Documents/GeekTool/DiskCapacityMeter set usedSpace to (do
Using AppleScript, how can I change the background color of cells ranging from A3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.