This may be a simple issue, but I’m having no luck getting AppleWorks to do what I’d like, and I’ve been reading that it’s a difficult program to script, so I thought I’d ask the experts.
What I’d like to do is apply a font and size to a whole document. I can do this if I first Select All, but I’d rather avoid using that keystroke everytime I do this. (If I could get AppleWorks to insert text from a file correctly, I wouldn’t need to do this so frequently.)
Here’s the latest iteration of the script that I thought ought to work. I’ve tried many variations, but can’t get AppleScript to select all text for me or to apply font and size properties to all the text of the document.
tell application "AppleWorks 6"
set font of text body to "Times"
set size of text body to 12
end tell
Any help with this will be much appreciated.
Kendall
Model: G4 desktop
AppleScript: 1.9.3
Operating System: Mac OS X (10.3.9)
Well, I’ve done it to myself this time! The script you helped me write worked fine until I tried one more thing. The goal, of course, was to make a macro using the script, and so I wanted to assign it a keyboard shortcut, using System Preferences>Keyboard & Mouse>Keyboard Shortcuts.
It seemed to work (the shortcut was displayed beside my script in the Scripts menu in AppleWorks 6. But when I tried to use it, I got an error, and now I get the same error (An unexpected error occurred. #18960) every time I try to run a script from the scripts menu. It does work if I don’t use the scripts menu to do it (if I run the script from the Script Editor), so I might have a work-around, but I’d like to find out what’s happening and fix AppleWorks, if possible.
I may try reinstalling the program as a last resort, but I thought scripters who have used Keyboard Shorcuts to activate scripts in AppleWorks or other programs may have encountered this problem and have a solution. I have also asked the AWUG forum about this problem, but again, my guess is the scripters will more likely have experienced this problem.
Any advice on removing this error would be greatly appreciated. I did trash the preferences files in my Home Library already, and that didn’t help. Furthermore, if anyone knows how to assign Keyboard Shortcuts in AppleWorks, I’d love to know how.
Yvan Koenig helped me with this in the Apple discussions for AppleWorks. I need to save the script as an app for it to work from the AppleWorks menu. I thought it had, but that was with the help of another program (Keyboard Maestro) to launch the script. With the application script in the AppleWorks script directory, I don’t get the error.