I had a script in system 9 that would launch Quark,
Open Document, place type from text doc into the front most window.
Would like to rewrite it for OSX
--locate QuarkXPress on whatever MAC I'm installing
select file "QuarkXPressâ„¢" of «class cfol» "QuarkXPress" of «class cfol» " PREP APPS" of «class sdsk»
open selection
tell application "Finder"
activate
select file "ColorLog.txt"
set mylist to (read file "ColorLog.txt")
--locate "Master ColorLog.mm" on whatever MAC I'm installing
--select file "Master ColorLog.mm" of folder "¢MasterColorLogFolder" of startup disk
tell application "Finder"
activate
select file "MasterColorLog.mm" of «class cfol» "¢MasterColorLogFolder" of «class cfol» "Mark's Stuff" of «class sdsk»
open selection
end tell
tell application "QuarkXPress"
--set story 1 of text box 1 of page 1 of document 1 to mylist
tell story 1 of text box 1 of page 1 of document 1
set contents of it to mylist
try
on error MsgErr number NroErr
display dialog "" & NroErr & " : " & MsgErr with icon 0
end try
end tell
end tell
end tell
end tell
tell application "Finder"
activate
display dialog "Your Color Log
is Made.
Delete ColorLog.txt"
select file "ColorLog.txt"
delete selection
end tell
Yes I would like someone to write it for me in OSX
I’d also like to know how it is done. I cannot find anything on the web on Quark and OSX applescript.
Plus I was waiting for the book “AppleScript 1-2-3 By Sal Soghoian” to come out. It looks like it never will.
Now I’m thinking about “Danny Goodman’s AppleScript Handbook (Mac OS X Edition)” :o
Any ideas on which book to buy?
I have “AppleScript for Applications: Visual QuickStart Guide” but that is system 9.
That script has never worked, either in OS 9 or OS X. Firstly, reinstate the first line: tell application “Finder”. Then it’ll compile properly. Then supply the full path for the ‘read’ command. Then correct the Finder references so that they reflect the position of the files on your OS X startup disk. Then worry about whether or not it works in OS X.
Danny Goodman’s book is a good one, though my copy is about 10 years old. An OS 9 book, for the most part, is still relivent to OS X. Things have changed but the overall language has not, and you can still write usable scripts using most of the information in a different book. I also use an old AppleScript for Dummies that is about 10 years old as well. I’m sure that there are other good books, but I haven’t bought a newer one. No matter which one you buy they will only be a starting point when you start interacting with other applications. Each application works differently, with its own unique set of commands, properties, classes, and object model. At minimum you want to get any guides for AppleScripting these applications from the program’s developer. You will still need to spend a lot of time playing with them and probably looking at forums like this one as well as those on the developers web sites to get more information, there is a lot of how they work with AppleScript that is not well documented in the guides (which may be out of date anyway). You can also buy some application specific books, though for me they seem a little expensive but I’m not making a living programing.
On to your script. Looking at it I’m not sure what it does. I have been scripting and working in Quark for close to ten years (though not much in the last year or so). I don’t recognize the “.mm” extension (.qxd is the Quark extension if I recall), so that may be the problem. It looks like all you are doing is placing a text file in a document. It doesn’t look like it is doing much more than that or that it would save much time. It might help if you describe the goal of the program and what you need done along the way to achieve that goal.
Also, and I’m not a member of this section, there is a developers section that you can post projects to on the site. Of course the developers will expect to be paid for writing the script for you but you should be able to get some sort of payment from the company that you work for to compensate the person that writes the code for their time if you are going to use it professionaly to save time and increase profitablity (ie make money).
As I said, I’m not a member so I have no reason to plug this route. I don’t see that it is worth the membership fee that is charged to the developers right now with the very limited number of projects that have been posted, especially when some of those are limited to invitation only. I also think that the “sealed” bidding is a bad idea since it hides the overall price structure that is charged per project. This information is good to have “unsealed” because it shows the buyers the going rate of projects to that they might guage the cost of the project that they want to post, and it helps the developers guage the market rate of their services.
No matter what route you go, you really do need to state the purpose of the script, and should state the OS and program versions that you are using. There are minor differences in them, and some things will work in one version that wont in another. If you want to work on the code yourself there are a lot of people here that will help you out. They might even think of better ways to handle it, or take the script further than you intended and save you time in the process. For example, if your goal is to get a list of colors into a document then you could have the script make the neccessary swatches. If you wanted to have a “master list” you could have that saved to the preferences folder and eleminate the need for the user to “Find” the file. You could also have it work both ways, updating the “master list” from the current document or updating the current swatches to match those in the master list.
I have a Quark Document called “Master ColorLog.mm”
I have a script that creates a list in a plain text document called “ColorLog.txt”
I would like the script to open the Quark Document and Paste the list from plain text document
into the front most window.
Setting the path in both System 9 & Tiger, I can just record a script and use that for the path.
But in Panther the script does not read anything when I record a script. So where do I learn about
setiing the path to Quark Document in Panther?
a file path in AppleScript is basically the same in all versions of the OS. It is “HardDrive:Folder:SubFolder:File”. Note the colons seperating the hard drive, folders, and file name. Depending on the use you may have to refer to it as an alias, to do this you write it as alias “HardDrive:Folder:File”. To allow the user to set the path you use the choose file command:
set TheFile to choose file with prompt "Please select the color log file"
This will return an alias to the file which can be coreced to a string for use in other ways.
The Finder uses another form to describe a file path which can be coerced to a string or alias that can be used outside of the Finder tell block, but you shouldn’t need to use this for your script, which should be able to be written without any finder calls. Look at the Standard Scripting Additions dictionary for most of what you need, and Quarks’ dictionary for the rest of it.
When writing a script use your results and event log windows to see what is going on behind the scenes.
Another way to learn your way around AS is to use your ALL of your resources. I’m no pro, but when learning how to script a new app, I like to take a look at the material that the software publisher provides…it’s not always thorough, but it helps.
Quark provides a reference with its install that actually walks you through very similar steps to what you want to do (if I remember correctly). The reference teaches you how to select a file and put text into a document, etc.
But I hate to say it, if you don’t take the time to learn some Applescript basics, you may have luck “cutting and pasting”, but you’ll always be at the mercy of others!
BTW- I’ve learned alot from checking out the sample scripts provided with Quark…most if not all were written by Sal Soghoian. And I find myself constantly using Hanaan Rosenthal’s book for quick reference!
Thanks for the tip on the book by Hanaan Rosenthal.
I noticed that the Second Edition The Comprehensive Guide to Scripting and Automation on Mac OS X,
is due out in Septmeber. The book AppleScript 1-2-3 By Sal Soghoian was due out a while back. I’ve been
waiting for that to come out forever. Think I might just get the 1st edition now,
AppleScript: A Comprehensive Guide to Scripting and Automation on Mac OS X
by Hanaan Rosenthal (Paperback - November 1, 2004
or
Danny Goodman’s AppleScript Handbook (Mac OS X Edition)
by Danny Goodman (Author) (Paperback - 2005)