user1786546
user1786546

Reputation: 313

Name Extension in AppleScript Not Working

I am trying to display the extension for a file that I choose. What am I doing wrong?

    set theFile to (choose file with prompt "Select a file to transfer:")
    set ext to name extension of theFile
    display dialog ext as text

Upvotes: 2

Views: 342

Answers (2)

editxm
editxm

Reputation: 11

tell application "Finder" set theFile to choose file {} set ext to name extension of theFile display dialog "la extenxion es " & ext end tell

Upvotes: 1

adayzdone
adayzdone

Reputation: 11238

Try:

tell application "System Events" to set ext to name extension of theFile

Upvotes: 2

Related Questions