Does AppleScript have image recognition like AutoIt or AutoHotkey - image

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

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.

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.

Related

How to script keyboard clicks in a browser on a mac

The title says it all. I'm trying to script keyboard clicks in the browser (preferably Chrome). It's simple, from the current page I want to tab through 5 elements, then click enter, then repeat.
Right now I'm using a trial of the mac App "Fake" but it seems overly complicated for what I'm trying to do. I'm new to Macs and having trouble figuring out the simplest way to accomplish this. Any suggestions?
I'd take a look at Sikuli. It has a lot of things in its favor:
Comes with a nice starter IDE (or, you can write scripts in your own editor)
You can write Sikuli scripts in Jython, which is nice if you already know (or want to learn) Python
There's a Java API too, should you want to use pure Java
Sikuli's ability to do fuzzy matching of screenshots can be surprisingly robust
Scripts can be run from the command line once you grow out of the IDE (or want to plug the scripts into a continuous integration system)

Quick GUI for your own utilities

What do you guys use if you want to make a quick and dirty Windows GUI as a utility helper for your coding? I had been using AHK but since I do a lot of work in C# I wondered if it were more convenience.
Basically I'm looking for the simplest way to pop a window with some fields and do a little text processing in a Windows desktop environment.
Python and tkinter, or tcl/tk is what I use.
I like to use Linqpad for code prototyping and small tests. Even though its meant for more database stuff, I'm sure you could punch out a GUI really fast in there and save it for future testing. It has a lot of support for C#, but also quite a few other languages. Not sure if this is what you're looking for, but that's what I would use.

What is applescript and what is it used for?

What is applescript and what is it used for?
Applescript's "big advantage" over other scripting languages (which, frankly are much better to use for most tasks) is that it can automate the action of other applications on your Mac (as long as the developer has provided an Applescript dictionary).
This means that, as Philip Regan described, you can get an application like Photoshop to perform a whole bunch of repetitive photo modifications and then tuck those photos away in a folder, for example.
Other than that, one of the notable features of Applescript is its "English-like" syntax. Apple intended for it to be used by everyday people and tried to make its syntax as close to English as they could. This intention ran into a lot of problems, not the least of which was getting the people who were creating Applescript dictionaries for their applications to respect this goal. Apple also originally intended for there to be an Applescript for other human languages as well and there was work done on a "French Applescript" if I recall correctly.
There are now libraries in scripting languages like Python and Ruby for interfacing with Applescript so you can control the applications using Python or Ruby syntax and not using Applescript syntax (which can be extremely annoying to learn for someone coming from a programming background because of its irregularities and "foreignness").
Apple's latest move to bring application scripting to the everyday user is Automator. I suggest you try it out, as it can be quite useful if your aims are encompassed by things everyone does (keep copies of webpages, etc, etc,)
AppleScript is a scripting language that can be used to automate actions on Macintosh computers.
Examples of actions that can be automated with AppleScript include filesystem operations, textual data parsing, running programs and invoking program functionality.
Applescript Wikipedia Entry is a good start
While I concur with the rest of the responders here—there are far too many other websites that have this information—I will tell you what I, personally, actually do with it to hopefully give a more practical understanding of what it can do as opposed to the academic or marketing definitions you'll get at other sites...
I manage a production department for a publishing company and I have dozens upon dozens of scripts that allow me to streamline and/or automate all sorts of processes including:
fully automated page layout of marketing materials, contact sheets, and simple book designs using Excel, XML, and InDesign.
large scale image conversions (typically hundreds of images) with Illustrator and Photoshop.
automatic clean up of files (names, types, and some folder structures) to prep them for archiving.
Essentially, I use Applescript to automate any repetative task so that my folks can do better things with their time than repeating the same mindless mouse clicks over and over again. We just drop the files onto the slave Mac, start the script, and it beeps when it's done.

Script generation using GUI

Is there an example for a project a GUI fro script generation?
The idea is to let a non-programmer use a front end to enter command and simple logic that will translated to runnable
scripts.
The programming language does not meter.
thanks
I would use Qt + python, but the constrains you give are too general. simple logic could not be simple at all.
One of the best example of a GUI that generates scripts that I've seen so far is Apple's Automator. It's good not in the sense that it is has lots of features but that it is intuitive enough that many non-programmers use it to automate tasks. It is basically a flashy implementation of the unix pipe paradigm.
Another successful tool in term of getting non-programmers to write programs is Adobe Photoshop's Actions. It also basically emulates the unix pipe paradigm.
I've personally never seen anything that breaks the pipe paradigm successfully convince non-programmers to write programs. Apart from Excel spreadsheet equations of course - but that is just horrifying to write programs in.
There's no script behind the scenes, but the Grasshopper plug-in for the Rhinoceros CAD system allows you to create algorithms purely visually.
Grasshopper User Forums
It's got an extensive Video and Image gallery which often features the GUI.
I assume you ask for education purposes. Then LOGO is a good option (targeted towards children though).
Edit:
As you say, you want such a thing for an enterprise-like application. I'd go for some markup format such as YAML or XML. The script would be directly editable and be in a well-known language such as Python or Groovy. There might be existing GUI tools for markup languages. If you take this approach, please let me know good examples of such GUI tools.
Specifically for business rules of course there are things like Drools.

Where can I find a graphical command shell?

Terminals and shells are very powerful but can be complicated to learn, especially to get the best out of them. Does anyone know of a more GUI based command shell that helps a user or displays answers in a more friendly way? I'm aware of IPython, but even the syntax of that is somewhat convoluted, although it's a step in the right direction.
Further to this, results could be presented graphically, e.g. wouldn't it be nice to be able to pipe file sizes into a pie chart?
Hotwire is an attempt to combine the power of the traditional command line interface with GUI elements. So it has a GUI side, and tries to be helpful in suggesting commands, and in showing you possible matches from your history. (While there are keyboard shortcuts to do this in bash and other shells, you have to know them ...)
You can use all your common system commands, but a number of key ones have new versions by default which use an object pipeline, and are displayed with a nice GUI view. In particular ls (aka dir) shows lists files and shows them in columns. You can sort by clicking on the column headers, double click on files to open, or double click on directories to move to that directory. The proc command allows you to right click on a process and one of the options is to kill it.
The object pipeline works in a similar way to Microsoft Powershell, allowing commands in the pipe to access object properties directly rather than having to do text processing to extract it.
Hotwire is cross platform (Linux, BSD, Windows, Mac), though it is at an early stage of development. To learn more, install (click on the link for your platform) and work through the simple getting started page.
If you don't like hotwire, you could also look at the list of related projects and ideas maintained on the hotwire wiki.
fish is a Unix shell that focuses on user-friendliness, such as by providing colored highlighting and extensive tab completion.
For a different kind of blend of textual and graphical interface, there's Quicksilver, as well as similar/inspired tools like Launchy, GNOME Do and ENSO.
Is this for Python in particular, or are you just interested in any command shell that has a GUI interface?
If the idea of piping file sizes into a pie chart interests you, you might try PowerGUI, a GUI layer on Microsoft's PowerShell command shell. PowerShell also lets you pipe data from commands into XML, CSV, and other formats that are understood by GUI programs.
GUI-based command shell seems like an oxymoron to me.
Not really? A command shell is just an encapsulated environment in which to execute commands. Why can't they have GUI extensions? We are in the 21st century! :)
Check out http://hotwire-shell.org/
This is along the lines of what I was thinking. It's a shame it uses PyGTK, I'd have preferred PyQT (perhaps a licensing issue?). There look to be some interesting related links from the project as well.
If the idea of piping file sizes into a pie chart interests you, you might try PowerGUI, a GUI layer on [...]
PowerGUI looks like a hobby project I've been working on that organises regularly used tasks. It looks like it organises frequent jobs and formats the output for you. The formatting I see as the end result of the data flow. But it would be nice to be able to tinker with data and then continue to use it.
PowerShell as a command shell is very forgiving for new users and is easy to learn. There is an add-on product (it is a commercial product) called PowerGadgets that would let you pipe file sizes into a pie chart or other types of displays
PowerGadgets looks very interesting. It would be interesting to have things like system monitors so that you could say, read the CPU usage per second and pipe it into a graph.
Is this for Python in particular, or are you just interested in any command shell that has a GUI interface?
Any really, currently, but I like the idea of cross platform, easy to edit, no compiler setup. I use Windows at work and Windows/Linux (Ubuntu)/OSX at home. Python is just an easy solution, and for writing stuff like this is has a lot of libraries already.
Thanks for all the links. Keep them coming. :)
I'm not sure whether you're asking for a shell as in bash/csh, or a shell as in ipython. If it's the later, then I'd recommend looking at Reinteract. While it's still very alpha, it's already a great tool for rapid prototyping in python, and allows embedding of plots, widgets, etc.
GUI-based command shell seems like an oxymoron to me.
The key-word here is Graphical.
If I want a GUI, I want a full-featured GUI. But if I want raw performance, I want a command line.
I'm not exactly sure what you're asking for. You can either have a GUI or a command line. What do you need from a graphical command shell that you couldn't get from a straight GUI?
Also, if you want graphical information about file sizes there are a few applications that do that. One example is WinDirStat.
Also not related to Python, but Ubiquity (a firefox extension) is a graphical command-line-like tool for the web, with a similar spirit to Quicksilver/Launchy/GnomeDo.
I know that Automator in Mac OS X is not a shell but it is the best graphical tool I have ever used to do batch tasks. I think it is worth mentioning here as even I (self-titled as a power user) use it from time to time to rename files or other routines. Although these could be done in a few lines of shell script, the Automator's graphical interface makes me feel like I am not working and it just works.
Check out http://hotwire-shell.org/
PowerShell V2 is developing a graphical command shell, but I don't think that is what you are looking for.
PowerShell as a command shell is very forgiving for new users and is easy to learn. There is an add-on product (it is a commercial product) called PowerGadgets that would let you pipe file sizes into a pie chart or other types of displays. Information about that can be found here.
As for ease of use, PowerShell command follow a Verb-Noun pattern (along with aliases for ease of use from the command line) and is very discoverable. Check out some screencasts I did on using PowerShell at PowerShell Basics.
I found POSH, a GUI for MS PowerShell. This is pretty much what I intended. You have a command-line backend with a WPF GUI frontend. You can pipe results from command to the next and show graphical output.
Maxima provides a mathematical shell (screens) . It is nice that you type in a C-like syntax and receive graphically formatted output.

Resources