views:

67

answers:

2

In AutoHotkey and AutoIt the script is able to recognize images on webpages. Can AppleScript do that? How?

+3  A: 

Short answer... no. Applescript is a tool for controlling other applications. It doesn't have a lot of capabilities itself. It's power is that you can combine the power of other applications into one script. As such you'd have to find a separate application that does the image stuff, then you can use applescript to automate that application.

You might want to look at this program. I watched the demo, it looks really interesting, and it may do what you want. I've never used it personally.

regulus6633
Small point of order... "As such you'd have to find a separate application that does the image stuff, then you can use applescript to automate that application." Yes, but that's if the application has an Applescript API. Otherwise, you're relegated to GUI scripting, if you can get anything at all.
Philip Regan
+1  A: 

The easiest way to do this is unfortunately to use Applescript to get the source for the current browser page. You can then scan the text to recognize the image. As a language though Applescript isn't ideal for this. I'd suggest using Appscript + Python or Appscript + Ruby. Ruby and Python simply have far superior text mining libraries. Combining them with Appscript makes this sort of work pretty easy.

Clark
Would this technique with a flash program?
awakeFromNib
You could find the flash program but not what images are being displayed within flash. You'd just find the tag with the swf file.
Clark