Hello,
I am practicing working with id’s to open up files.
I want my files to open up in Quark 7.31 not 8.
I have my script pointing to open the correct application when I get the id, but when I run it, I guess quark 8 has the same id and it opens it there. Is there a way to pinpoint the application of choice?
tell application "Finder"
open document file "STYLE SHEET" of folder "Quark files for class" of folder "Quark 6.0" of folder " babs training 2009" of folder "school files" of folder "Documents" of home using application file id "com.quark.QuarkXPress"
end tell
This is the script I used to get the id name:
tell application "Finder"
id of application file "QuarkXpress.app" of folder "QuarkXpress 7.01" of folder "Applications" of the startup disk
end tell
Does anyone know a better way to get the exact id of a particular version of an application.
Hi Craig,
hmmm.OK…I tried replacing it in a few places your this method, in both the open and at the end with id, but neither compiles.
Where exactly does this go in the script…sorry to be so dense, trying to learn this through tutorials, so I not very fluid with where things go yet.
thanks!
babs
I am suggesting to not use the id but target the application directly.
Try this. I added “.qxd” to the end of “STYLE SHEET” so if it is not needed you should remove it
from this example.
Also, double check that this is the correct path to Quark 7 on your machine.
tell application "/Applications/QuarkXpress 7.01/QuarkXpress.app"
open ((path to documents folder as string) & "school files:babs training 2009:Quark 6.0:Quark files for class:STYLE SHEET.qxd")
end tell
I was using the ID because that was the advice in this book…but I do see in the book where they talk about these paths…however…it didn’t work…
I did have to change which version of quark to use, to 7.0, but I still get an error "QuarkXpress got an error: “can’t make some data into the expected type”
So, I tried to remove the as string and it did two interesting things:
It opened a file, but gave me that same message at the end
It opened a test quark file sitting in the Documents Folder
You can use the open-command with the -a-parameter to specify the full path to the application.
set myApplication to chooseApplication without appList
set fileToOpen to (choose file with prompt "Choose the file to open")
openFile(fileToOpen, myApplication)
on chooseApplication given appList:flag
set myApp to missing value
if flag is true then
set myApp to choose application
else
set flag to choose file with prompt "Choose an application"
end if
return myApp
end chooseApplication
on openFile(aFile, anApp) -- missing value for anApp if default
if anApp is missing value then
do shell script "open " & quoted form of (POSIX path of aFile)
else
do shell script "open " & quoted form of (POSIX path of aFile) & " -a " & quoted form of (POSIX path of anApp)
end if
end openFile
Thanks…it worked…the shell script stuff is way above me, but since, that is the second comment on this post using it, I guess I should add that to my learning
Do you know any good resources for learning shell scripts?
thanks for all your help!!!
babs
Not at all. I actually don’t even know how to use shell scripts myself. I know the basics. The terminal for instance works with POSIXes i[/i]. In those paths there can’t be a space (or they have to be preceded by a backslash i or instead of replacing all spaces, you can put quotes around them. If you’re looking for a command, you can use Google. For example: “open file with terminal”. And the first link you get is Open files from the Terminal with the appropriate application - Mac OS X Hints.
Ow yeah, and if you want to know more about the command, you can type in man before it. Like:
Since Ief2 already has mentioned the “man” command I thought it well worth mentioning the appropos command which you give a word describing what you want to do.
Then you can get back some proposals for commands you might use to solve your task.
There are many good Shell scripting primers out there.