What's the best automation or scripting tool to automate repetitive tasks with applications? - scripting

I realize you can script Microsoft Office apps, but I'm looking for something more general that I can apply to other apps, such as Adobe Acrobat, web browsers and other apps with no scripting ability.
I've used AutoIt but it's a bit clunky, especially when trying to debug why a script fails or stalls. Also, getting the timing of actions, such as clicking a button, or selecting a menu item correctly can be a pain.
Are there build tools that could be used for this purpose?

I recommend AutoHotKey. Its syntax is not pretty, but most of the times you don't have to concoct your own scripts, because its community is so large and well organized. Even if you do, the documentation is extensive and good and the forums will answer your questions quickly. The developer is active and responsive, which means that bugs get fixed quickly, and new features are being considered and added.
Since I began using AHK I don't imagine doing without it - it allows to make life on Windows simpler in so many ways.
You can also employ the COM interface from Python and other scripting languages. It is more complex, but you get to use a more powerful language.

I love AutoHotkey (small k...) too, but beside its odd syntax, it has the same lack of debugging tools...
Basically, that's "show msgbox alerts, send strings to file or debugview, trace". Which is OK for most cases, since you rarely write long and complex applications with these tools.
In both tools, and probably all macro softwares, "timing of actions" will be hard to get anyway, because events are asynchronous: most of the time, you don't wait a given time, but you wait for a window to appear. Hoping it is the right one!
There are other automation tools, like Ranorex (I didn't tested it), you can even use some scripting language (Lua, Python) with a library to send messages (WM_XXX) and another to call WinAPI... But tools like AutoIt and AutoHotkey have the advantage of having been extensively tested, so they can handle a large number of behaviors/issues (like waiting for clipboard data to be available, etc.).

Might be a bit much for your needs but AutoMate is very robust and easy to use. Doesn't require any scripting skills as most tasks can be constructed via drag and drop http://www.networkautomation.com/sales/scripting/

Related

How to control any windows program with no available API

What is the best way to control a program's user interface (clicking, entering text, drop down selection, etc) when the program has no available API?
I've heard of AutoHotKey and FlaUI and watched a few videos but haven't seen a great example yet. Before I go too far, is this the best direction/method?
Thanks!
FlaUI is a fully fledged UI Testing library that allows you to automate all aspects of a Windows application. As author of it, I of course recommend it. If you do have a bit of programming know how, it should be fairly easy to use. In case you just want some scripts to run locally, you don't even need Visual Studio or Visual Studio code, you can just use RoslynPad for example and directly create and run your code there.
I use this all the time for small automations, heck even sometimes to input very long passwords in a remote machine where I cannot use copy/paste.

Using scripting to test a program

I've been tasked with testing a Windows program that is essentially a collection of links to various exe files. My job is basically to click all the links to make sure they work (yay!). To makes things a bit easier on myself, I want to create a simple script that will do the clicking for me. I have a programming background (familiar with C/C++, Java), but have never scripted anything before.
Despite googling and searching around on stackoverflow, I wasn't able to find anything that explains what would be involved in creating something like this. I downloaded a program called AutoHotKey (http://www.autohotkey.com/) that seems promising, but before I dive into it I want to see what suggestions you all have.
Thanks!
Never tried autohotkey so I can't give you feedback. But I played around a bit with Sikuli which is agnostic of the UI technology used (working with image recognition). It works fine and you should be able to come up with a working prototype in a couple of hours.
HP Unified Functional Testing (http://www8.hp.com/us/en/software-solutions/unified-functional-testing-automated-testing/) provides similar functionality as Sikuli. As licensed software, it isn't free, but provides a lot more features and support than Sikuli (which is open source) does.

Automation scripts: autoitscript vs ptfbpro

I try to use this 2 projects for primitive gui testing automation:
http://www.ptfbpro.com/
http://www.autoitscript.com/
And I can't make my choice.
Can somebody explain me: why(in 2 or 3 lines) he use one of them(or other please specify)?
I use AutoIt...
because it's free, well documented (not only) from inside of the Scite Editor and you can easily compile your script into a small executable or even create a complete GUI and there is a very good community in the forums and around here. And its Basic-Like Syntax is really easy to understand, there are functions and even a foreach-syntax, dynamic arrays and lots of additional functions from other users... There's good integration with other programming languages and from the use of so many WinAPI functions you lack of very little possibilities. It can automate IE usage without even displaying a browser window and send network packages, you can send Keystrokes like a user sitting in front of your screen and there's the AU3Record Tool which allows you to just record a Macro and replay it or save it as a script and then you can easily optimize it and edit it for your needs. Or use the AutoIt Window Info tool to see all the possible handlings for your application, you can interact with any kind of program output/display according to different algorithms you may invent.
Enough facts? ;-)
Go with Autoit3. It 's a lot more reliable, and you have a complete script language. Ptfbpro is only a tool (not free), nothing more. AUtoit3 has a lot of contributors that can help you in your process, Ptfbpro is dead.
If you want a script taht really do what you want, just go for AutoIt. Ptfbpro can't be used as a professional tool.
Autoit3 as well. You really can't beat it for being free and so easy to use.

Which is better for quickly developing small utilities? AutoIt or AutoHotKey?

Which is better for quickly developing small utilities? AutoIt or AutoHotKey or something else?
I need to develop some small software for which I think using some professional suite like Visual Studio will be overkill. Most of the macro recording tools like AutoIt or AutoHotKey provide enough power to write decent application. Plus they are small and free.
Which option will be good? Using one of these tools or using some other small/free compiler?
They are both pretty good, and can do most of the same things... but I typically use AutoIt over AutoHotKey for the following reasons:
If you need a GUI at all, then you'll need to use AutoIt.
I prefer the syntax of AutoIt over AutoHotKey's. IMO, it is much easier to follow, and pick back up when you need to go back into your code later.
I like that AutoIt makes it very easy to change version numbers, icons, and compression of your compiled scripts (when compiling to exe). The default compression will sometimes cause false positives with some anti-virus software.
Ultimately, though, it really depends on what your requirements are for your small utilities.
Both are really good pieces of software and you will only decide by trying both of them out with tests that check if you can create your small bits of software.
Me personally I would probably investigate AutoIt in depth and if it started to mess me about I would then check AutoHotKey and others.
You can pretty much do whatever you can in one in the other, but I think it breaks down to: (1) short, keyboard shortcut driven utils and (2) more complex, UI driven scripts. For example:
I use AutoHotKey scripts every few minutes, and use AutoHotKey here over AutoIT because it's snappier to launch (ie via keyboard shortcuts).
I use AutoIT scripts every once in a while to do more complex things, such as to run multi-stage tasks that require a UI... or for when I would like to easily produce a compiled .exe

Tools for automating mouse and keyboard events sent to a windows application

What tools are useful for automating clicking through a windows form application? Is this even useful? I see the testers at my company doing this a great deal and it seems like a waste of time.
Check out https://github.com/TestStack/White and http://nunitforms.sourceforge.net/. We've used the White project with success.
Though they're mostly targeted at automating administration tasks or shortcuts for users, Autohotkey and AutoIT let you automate nearly anything you want as far as mouse/keyboard interaction.
Some of the mouse stuff can get tricky when the only way to really tell it what you want to click is an X,Y coordinate, but for automating entirely arbitrary tasks on a Windows machine, it does the trick.
Like I said, they're not necessarily intended for testing purposes, so they're not instrumented for unit test conventions. However, I use them all of the time to automate stuff that isn't testing related.
You can do it programmatically via the Microsoft UI Automation API. There's an MSDN Magazine article about it.
Integrates well with unit test frameworks. A better option than the coordinate-based script runners because you don't have to rewrite scripts when layouts change.
There's a couple out there. They all hook into the windows API to log item clicks, and then reproduce them to test.
We're now mostly web based (using WatiN), but we used to use Mercury Quicktest.
Don't use Quicktest, it's awful for a tremendously long list of reasons.
This is what i was looking for.
Check out http://www.codeplex.com/white and http://nunitforms.sourceforge.net/. We've used the White project with success.