User Name
Password
AppleNova Forums » Programmer's Nook »

Learning AppleScript


Register Members List Calendar Search FAQ Posting Guidelines
Learning AppleScript
Thread Tools
jdcfsu
Veteran Member
 
Join Date: Jun 2006
Location: Florida
 
Old 2009-07-08, 19:19

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?

Code:
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

90% of statistics can be made to say anything 50% of the time.
Website | Twitter
jdcfsu is offline   quote
veryamusing
Member
 
Join Date: Aug 2006
Location: Orlando, Florida
 
Old 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!
veryamusing is offline   quote
jdcfsu
Veteran Member
 
Join Date: Jun 2006
Location: Florida
 
Old 2009-07-16, 12:40

The developer sent me some sample scripts to get me going. My mistake was in using set. It should have read

Code:
open images "Users:Justin:Desktop"
I was trying to do too much I guess.

90% of statistics can be made to say anything 50% of the time.
Website | Twitter
jdcfsu is offline   quote
ekyme
New Member
 
Join Date: Jul 2009
 
Old 2009-07-17, 05:38

Hi

Would be interesting to share your sample scripts as I get some difficulties as well.

Thanks
ekyme is offline   quote
veryamusing
Member
 
Join Date: Aug 2006
Location: Orlando, Florida
 
Old 2009-07-18, 18:26

Quote:
Originally Posted by jdcfsu View Post
The developer sent me some sample scripts to get me going. My mistake was in using set. It should have read

Code:
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!

I believe workers should keep their whole paychecks, don't you?
www.FairTax.org
veryamusing is offline   quote
jdcfsu
Veteran Member
 
Join Date: Jun 2006
Location: Florida
 
Old 2009-07-19, 06:03

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.

90% of statistics can be made to say anything 50% of the time.
Website | Twitter
jdcfsu is offline   quote
Wyatt
On twitter: @bwyatt
 
Join Date: Mar 2005
Location: Near Indianapolis
 
Old 2009-07-20, 08:21

Quote:
Originally Posted by jdcfsu View Post
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.
Wyatt is offline   quote
ShadowOfGed
Travels via TARDIS
 
Join Date: Aug 2005
Location: Earthsea
 
Old 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.

Apparently I call the cops when I see people litter.
ShadowOfGed is offline   quote
jdcfsu
Veteran Member
 
Join Date: Jun 2006
Location: Florida
 
Old 2009-08-05, 08:47

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?
jdcfsu is offline   quote
ShadowOfGed
Travels via TARDIS
 
Join Date: Aug 2005
Location: Earthsea
 
Old 2009-08-05, 14:32

Quote:
Originally Posted by jdcfsu View Post
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.

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.)

Apparently I call the cops when I see people litter.
ShadowOfGed is offline   quote
jdcfsu
Veteran Member
 
Join Date: Jun 2006
Location: Florida
 
Old 2009-08-05, 14:38

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.

90% of statistics can be made to say anything 50% of the time.
Website | Twitter
jdcfsu is offline   quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
Learning a new Language Argento AppleOutsider 6 2008-10-20 17:41
Learning French evan AppleOutsider 18 2007-08-31 17:16
Learning OS X osuchris Apple Products 5 2006-06-21 13:59
Help with applescript: how to get a url with specified name ironlung Programmer's Nook 4 2006-05-01 03:52
Learning Cocoa? pmazer Programmer's Nook 10 2005-11-23 19:56


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 22:33.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2012, AppleNova
AppleNova Slim