View Full Version : Learning AppleScript
I'm playing with AppleScript trying to learn the language and am running into a little snag. I'm trying to create a script that will take all the images on the Desktop and then take them into Picturesque, resize them and save them into a folder on the Desktop. Problem is I keep getting an error saying that "no result was returned from some part of this expression." The part highlighted after the error reports is the first set line: set open images etc. I assume it's looking for something else to happen after the open, but I can't figure it out. Any suggestions?
tell application "Picturesque"
set open images to open "Users:Justin:Desktop"
set save all images to location to save all images to location "Users:Justin:Desktop:Completed" with properties
{fileType:PNG, hideFileExtension:true, maximumWidth:100}
end tell
veryamusing
2009-07-14, 10:06
I'm probably not qualified to answer your question, but is "save all images to location" supposed to be repeated? Just stuck out to me is all...
Good luck!
The developer sent me some sample scripts to get me going. My mistake was in using set. It should have read
open images "Users:Justin:Desktop"
I was trying to do too much I guess.
Hi
Would be interesting to share your sample scripts as I get some difficulties as well.
Thanks
veryamusing
2009-07-18, 18:26
The developer sent me some sample scripts to get me going. My mistake was in using set. It should have read
open images "Users:Justin:Desktop"
I was trying to do too much I guess.
Can you say which developer? Is this developer the author of a book or something? If you're finding it helpful, I'd love to know about it too!
It's the developer of the Picturesque app. He sent me a few sample scripts focused on his app. I've not found a website that I've liked yet.
It's the developer of the Picturesque app. He sent me a few sample scripts focused on his app. I've not found a website that I've liked yet.
Have you looked through the Applescript documentation on Apple's developer site? It's free to sign up and download docs.
ShadowOfGed
2009-08-05, 02:05
What is your end goal in learning AppleScript? I personally find the language terribly difficult to use / master, but the application scriptability is exposed through another fantastic API called the ScriptingBridge framework. This exposes the same functionality in a manner that is usable from Python, Ruby, and Objective-C (at the core).
As a programmer, I personally find the latter method to be much easier. The AppleScript grammar is often called a read-only language; you can't understand what it does until it's written, and then it reads like plain English. The opposite is Perl, being a write-only language. :lol:
The end goal would be to be able to use it when needed and to give me something to learn. I'm curious about ScriptingBridge. Any suggested resources?
ShadowOfGed
2009-08-05, 14:32
The end goal would be to be able to use it when needed and to give me something to learn. I'm curious about ScriptingBridge. Any suggested resources?
Scripting Bridge Programming Guide (http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/Introduction/Introduction.html).
If you want to write AppleScripts that you can use to automate frequent user tasks, your best bet is AppleScript. There are facilities for adding them to the Services menu, I believe. However, if you want to use it from other programs to automate things *not* invoked by the user, ScriptingBridge is probably your best bet.
Of course, using the ScriptingBridge framework requires you already be familiar with Objective-C, or at least the use of Objective-C frameworks from within Python or Ruby. (I prefer Python, myself.)
Thank you. Yeah, my interest was peeked by the automation aspect of AppleScript, especially in getting images and such ready for the web. But I'll check out Scripting Bridge as well and see what flushes out.
vBulletin® v3.6.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.