• 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
"open" command without full path (OS 9)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"open" command without full path (OS 9)


  • Subject: "open" command without full path (OS 9)
  • From: "Jon Reinsch" <email@hidden>
  • Date: Tue, 25 Feb 2003 10:14:23 -0800

I save the following script to a folder "blah".

tell application Finder
open file foo.txt
end tell

The file "foo.txt" is in the same folder. I open Script Editor, and from it I open my script. When I run it, I get:

Finder got an error: Can't get file "foo.txt".

However, if I move "foo.txt" to the desktop, the script works.

Now, according to the doc at:
http://developer.apple.com/techpubs/macosx/Carbon/interapplicationcomm/AppleScript/AppleScriptLangGuide/index.html
the following applies to "open":
'You can also specify a string with only a filename (" Filename "). In this case, the application attempts to find the file in the current directory. (The current directory is typically the directory where the application was launched, the directory where the application last opened or saved a previous document, or another directory specified by the application. The current directory may be affected by settings in the General Controls control panel.)'

(Presumably the General Controls setting referred to is the one about "When opening or saving a document, take me to...". Changing this setting makes no difference.)

I've double-checked that, before running the script, Script Editor's "Open Script" menu opens to the "blah" folder.

Am I misunderstanding the documentation, or is AppleScript not behaving as advertised? This is a stripped-down version of what I actually want to do, but the key factor is that I cannot know the full path of the file  only that it is in the current directory. I'm using AppleScript 1.8.3 on OS 9.2.2.
_______________________________________________
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.
  • Follow-Ups:
    • Re: "open" command without full path (OS 9)
      • From: Paul Skinner <email@hidden>
  • Prev by Date: Re: Re: Moving a file and changing its name in X
  • Next by Date: Re: Scripting Mail:get selection
  • Previous by thread: FLAME WAR (was Re: Looking into AppleScript (Was: Re: Scripting Mail:get )
  • Next by thread: Re: "open" command without full path (OS 9)
  • Index(es):
    • Date
    • Thread