Text and OS X
Text and OS X
- Subject: Text and OS X
- From: Shane Stanley <email@hidden>
- Date: Wed, 24 Apr 2002 21:18:41 +1000
I have a script to do something in Excel 98, like this:
set aFile to choose file
set aFile to (aFile as text)
tell application "Microsoft Excel"
Open aFile
end tell
This works fine in 9.x, but in OS X, at least with several versions of
1.8.2b, I get this in the log:
----
tell current application
choose file
--> alias "Macintosh HD:Users:shane:Documents:Jobs:Trendex stuff:Summary"
end tell
tell Application "Microsoft Excel"
Open "Macintosh HD:Users:shane:Documents:Jobs:Trendex stuff:Summary"
end tell
Script 3untitled 32 finished
--> Microsoft Excel got an error: '' could not be found. Check the spelling
of the file name, and verify that the file location is correct.
If you are trying to open the file from your list of most recently used
files on the File menu, make sure that the file has not been renamed, moved,
or deleted.
----
Now, if I hard code the file path, it works fine. But I also found it works
fine if I run this version:
set aFile to choose file
set aFile to (aFile as text)
display dialog "!" default answer aFile giving up after 1
set aFile to text returned of result
tell application "Microsoft Excel"
Open aFile
end tell
for which the log says:
----
tell current application
choose file
--> alias "Macintosh HD:Users:shane:Documents:Jobs:Trendex stuff:Summary"
display dialog "!" default answer "Macintosh
HD:Users:shane:Documents:Jobs:Trendex stuff:Summary" giving up after 1
--> { text returned:"Macintosh HD:Users:shane:Documents:Jobs:Trendex
stuff:Summary", button returned:"", gave up:true}
end tell
tell Application "Microsoft Excel"
Open "Macintosh HD:Users:shane:Documents:Jobs:Trendex stuff:Summary"
--> Workbook "Summary"
end tell
----
I'd dearly love some kind of explanation...
--
Shane Stanley, email@hidden
_______________________________________________
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.