May 25, 2010

Tweetlib: A DLL Plugin for Tweeting Status Updates via oAuth

Filed under: Announcements,Automation,Scripting,Web/Tech — Marcus Tettmar @ 4:23 pm

As noted yesterday I have been waiting on Twitter to provide xAuth access. They declined, saying it was not appropriate. I’m not really sure why.

No matter, I decided to make a small DLL to simplify Tweeting from Macro Scheduler. It uses the full oAuth interface.

Implementing oAuth in Macro Scheduler code would require lots of VBScript code and would be very complicated (although doable in theory). So instead I decided to create a DLL which you can use in Macro Scheduler to tweet in one line of code.

You can download it here.

And then to post a status update all you need to do is something like this:

Let>message=Hello from Macro Scheduler
LibFunc>%SCRIPT_DIR%\tweetlib.dll,UpdateStatus,r,message,buff,1024

Note that the first time you call UpdateStatus you will be asked to log into Twitter and click “Allow” to authorise Macro Scheduler to access your account. You will then be given a PIN to enter. You only need to do this once. If you ever need to revoke access and start over call the RemoveCredentials function. Your Twitter username and password are NOT stored anywhere. This uses the oAuth authorisation scheme which provides an access token. It is the access token which is stored and this only allows Macro Scheduler to access the API for your account.

The return buffer will contain the XML of the status update operation if successful or an error message if not.

See readme.txt and sample .scp in the zip file. Enjoy.

May 24, 2010

Tweeting from Macro Scheduler Without the API

Filed under: Automation,Scripting,Web/Tech — Marcus Tettmar @ 1:51 pm

A while back I posted an article showing how to Tweet via Twitter‘s API. It uses basic authentication which Twitter plan to turn off in the near future. The alternative, oAuth is awkward for desktop based apps, but xAuth is now available and should be doable in Macro Scheduler. I have requested xAuth access from Twitter and, assuming it’s doable, will try and provide an example once I’ve received it and tried it out.

In the mean time it occurred to me that we don’t really need an API if all we want to do is send a status update. We can do that easily using Macro Scheduler and WebRecorder functions by controlling an instance of Internet Explorer, which can be done in the background.

Below is a script which demonstrates this. It offers a function called LoginToTwitter which need only be called once per session, and an UpdateStatus function to update your status. Just set your Twitter username and password in the first two lines and you should be all set.

Let>TW_USERNAME=XXXXX
Let>TW_PASSWORD=XXXXX

//only need do this once per session
GoSub>LoginToTwitter

GoSub>UpdateStatus,This is a test

GoSub>UpdateStatus,This is a test 2

GoSub>LogOut

// END

//*** SUBROUTINES ***//
SRT>LoadWR
  //load the WebRecorder runtime
  LibLoad>IEAuto.dll,hIE
  If>hIE=0
    MessageModal>Could not load IEAuto.dll, make sure it is in the path or edit the LibLoad line.
    Exit>0
  EndIf
END>LoadWR

SRT>LoginToTwitter
  GoSub>LoadWR
  //open IE
  LibFunc>hIE,CreateIE,ieTwitter,0
  LibFunc>hIE,ShowIE,res,ieTwitter,1

  //log in to Twitter
  LibFunc>hIE,Navigate,r,ieTwitter,http://twitter.com/login
  LibFunc>hIE,WaitIE,r,ieTwitter
  LibFunc>hIE,FormFill,r,ieTwitter,,,session[username_or_email],TW_USERNAME,0
  LibFunc>hIE,FormFill,r,ieTwitter,,,session[password],TW_PASSWORD,submit

  LibFunc>hIE,WaitIE,r,ieTwitter
  Wait>1
  LibFunc>hIE,WaitIE,r,ieTwitter
  Wait>1
END>LoginToTwitter

SRT>UpdateStatus
  LibFunc>hIE,FormFill,r,ieTwitter,,,status,UpdateStatus_VAR_1,submit
  LibFunc>hIE,WaitIE,r,ieTwitter
  Wait>1
END>UpdateStatus

SRT>LogOut
  LibFunc>hIE,KillIE,r,ieTwitter
END>LogOut

You need the IEAuto.DLL library which is installed with WebRecorder.

For a bit of fun the following code copies the currently highlighted text to the clipboard and tweets it. So assigned to a hot key it can be used to tweet any text from any application.

Press CTRL
Send>c
Release CTRL
WaitClipBoard
GetClipBoard>theText
GoSub>UpdateStatus,theText

The real challenge is finding something useful to do with it! 🙂

May 21, 2010

Weekly Forum Round-up

Filed under: Automation,General,Scripting,Testing — Marcus Tettmar @ 10:34 am

I thought I might start a weekly round up of some of the Macro Scheduler forum posts that caught my eye during the week. Not everyone gets a chance to browse the forums all the time, so it might help to link to some here. Then those that subscribe to the blog via RSS/Email will see them and they’ll also show up in Macro Scheduler’s News Feed window.

The forums are quite active but I won’t link to every little discussion or request for support – just those that demonstrate a new feature, or work as a “how to” or anything else that I think could be useful. We’ll see how it goes.

So here’s my list for week ending 21st May 2010:

How to trim spaces from the ends of, or within, a string

A Progress Bar Demo using Macro Scheduler 12

How to make a custom dialog minimize to the task bar

Putting a status bar with multiple panels on a custom dialog

Finding a drive based on its label (volume name)

Getting the HTML source of a page using WebRecorder

Running Automated Testing scripts in the background via VMWare

May 20, 2010

Sharing and Synchronizing Macros

Filed under: General — Marcus Tettmar @ 3:15 pm

A new feature in Macro Scheduler 12 is the ability to easily share macros with other people on your network, or between desktops.

It has long been possible to work outside of the Macro Scheduler interface and indeed many people already do this. You can use the standalone editor and run or edit macro script files (.scp) directly from Windows Explorer. So to share script files you can store them in a network folder which each person in your team can access.

But until now that had some limitations. Firstly you would have to work outside of the Macro Scheduler interface and secondly, until version 12, scripts weren’t opened exclusively. So if two people were working on a script at the same time the last person to save would overwrite the changes made by the first. Until now Macro Scheduler was not built with network sharing in mind. And of course if you wanted to apply a schedule, trigger, or hot key to a shared macro you would need the Macro Scheduler interface. So would need to import it. Therefore any time it was changed you’d have to re-import it again.

Linked Groups and Exclusive Opens

With Macro Scheduler 12 you can now create “Linked” macro groups. Version 12 also makes sure that when you open a script for editing it is opened exclusively. This means the file is locked and no one else can open it until you’re done.

To create a Linked Group, create a new macro group as you would normally, set the path of the group to point to a network share, and check the “Create Linked Group” box. Give it a name and click OK.

Any macros already in the folder will show up immediately. And if you create a new macro in that group (or move a macro to it) other people with a group linked to the same folder will see those macros too.

So Linked Groups are useful where you want to easily share macros between members of your team or between two desktops – e.g. your desktop and your laptop.

You could also share macros between a developer and several users and prevent the user from being able to edit them by using a network share that you can write to but they only have read only access to. The users would be able to run the macros but not edit them or create new ones in that group.

Note that at present to delete a macro from a Linked Group the file needs to be deleted from the folder using Windows Explorer. This is partly to avoid accidental deletes and to prevent people from moving linked macros. We are considering ways of improving on this in future so that linked groups can be administered more easily within Macro Scheduler. It’s early days for Linked Groups and I’m sure as more people start to use them ideas will start flowing in. So if this is something that becomes popular expect improvements over time.

May 19, 2010

Test Automation Class Update; European Dates

Filed under: Announcements,Automation,Testing — Marcus Tettmar @ 10:06 am

Randy has just reported on his blog that the first run of his new Test Automation class which features Macro Scheduler in the hands-on exercises was a great success.

The next class will be held next month in Rome, Italy on 16/17 June, where Randy will also be presenting a workshop entitled “Innovative Software Testing Approaches“.

So if you’re this side of the pond and looking to improve your skills, with the added advantage of a business trip in a beautiful, historical city, check it out.

May 18, 2010

Macro Scheduler 12 Documentation

Filed under: Announcements — Marcus Tettmar @ 11:12 am

Macro Scheduler 12 ships with a comprehensive help system (.chm). You can hit F1 at any point in the software, click Help on a code builder or press F1 while the cursor is positioned over a command to get context sensitive command help, or choose one of the options in the Help menu.

But if you prefer a different format there are some other options:

Online Help: You can view the documentation online here.

PDF Manual: You can download a 218 page PDF manual for free.

Perfect-bound Dead-tree Manual: You can purchase the 218 page manual in smart physical book form for $19/£19/€19 including world-wide shipping from here.

May 17, 2010

Macro Scheduler 12 is Shipping!

Filed under: Announcements — Marcus Tettmar @ 3:30 pm

Macro Scheduler 12

I am pleased to report that Macro Scheduler 12 is now shipping.

Regular readers will already be well aware of what super new features are available in Macro Scheduler 12 and you will find more detail in the release notes. But here’s a quick summary:

  • Easier to use, more powerful custom dialogs, with more objects and properties and real time event handlers
  • Multi-tabbed editing – edit multiple scripts at once, open scripts from within your code
  • New editing and debugging features
  • Native Excel functions
  • More string functions
  • Process handling functions
  • Array functions
  • Optional local scope
  • Improved Image Recognition
  • 64 bit registry support
  • System tray functions
  • A new loop construct
  • Regex window matching
  • Windows Vista/7 AutoLogon
  • Drag and drop macro import
  • Reorder macro groups
  • Shared macro folders
  • Macro Templates

For a complete list and more detail please see the release notes.

Registered users with maintenance can download from the registered user area. Or to purchase an upgrade log into your account and follow the links. A 30 day evaluation is available here.

May 14, 2010

Remove Unnecessary Obstacles

Filed under: Automation — Marcus Tettmar @ 10:48 am

When considering how to automate something, it’s often worth thinking about whether or not you can change the process a little first.

An example that often comes up is the need to automate the retrieval and processing of a particular email message. Many people will already have a manual process that involves, not surprisingly, their email client, e.g. Outlook. They’ll have a filter set up that moves the email they want to look at into a specific folder. Then they’ll take each of the emails in that folder in turn and do whatever it is they need to do to them, such as pull out some information and put it in an Excel file or database or something.

The user’s first thought when he decides to automate something like this is to have Macro Scheduler manipulate Microsoft Outlook to find the email and parse it.

That’s all very well, and is certainly achievable but it does add a rather awkward obstacle into the mix that needs to be navigated around: Outlook.

Look at what we actually want to do. We have some form of email that gets sent, and we want to parse it and perform some action based on it. Outlook just happens to be what we are currently using to read that email. We’re using it because we’re human and Outlook was designed for humans. But it isn’t the only way to read email. The email exists quite happily without it. We could use a different email client. Or remove the need for an email client altogether.

Macro Scheduler can retrieve email directly from a POP3 server, download the email messages to files and then process them. So we can remove Outlook – or any other email client – from the process entirely.

“Wait”, I hear you say, “What about my other email? I don’t want Macro Scheduler messing up my Facebook notifications, birthday reminders, blog updates and work emails” (notice the order of priority there). Well, don’t worry about that, there are several options. Macro Scheduler’s POP3 commands can be set to leave emails on the server and we could set the script up to search the downloaded email and look for only the pertinent messages.

But Ideally we have control at the sending end. We could set up a dedicated email account which these emails get sent to. That simplifies selecting which email needs to be processed. If that is not possible what about creating a new email account (it could be a free webmail account if you don’t have control over your own mail server) and then set up your filtering rule in Outlook, or whatever client you normally use, to forward the desired emails to that email account? This means the only emails in that account are the ones Macro Scheduler should process, thus simplifying the script which now needs only to collect all email in the mail box and can delete it afterwards.

Of course you can take this concept of removing obstacles as far as you like and in the most ideal world whatever it is that sends emails and whatever it is you want the information extracted from those emails inserted into would have a more direct form of communication between each other. But the world is not always ideal and we don’t always have control over the entire sequence of events. At least consider removing unnecessary obstacles from the part of the process you do have control over.

Retrieving and parsing email is just one example. The concept of simplifying a process applies elsewhere too. E.g. moving and copying files using Windows Explorer: instead of automating Windows Explorer by sending keystrokes and mouse events, use the built in file handling commands; pulling data out of a database: don’t automate your database query tool’s front end, access the data directly using SQL; Getting data from an Excel file: no need to try and manipulate Excel via user simulation, you can query the data directly; and so on.

When you sit down and automate a manual process some of the steps in that process might be things you can replace or skip altogether.

May 13, 2010

New Software Testing Course Featuring Macro Scheduler

Filed under: Testing — Marcus Tettmar @ 10:11 am

If you’re new to Automated Software Testing or looking to expand your knowledge you wouldn’t go far wrong with Randy Rices’ training courses.

Rice Consulting specialise in software testing training, certification and consulting. Their new Practical Software Test Automation course focuses on the basics of software test automation and expands on those topics to learn some of the deeper issues of test automation. The course includes hands on exercises using Macro Scheduler.

The course is aimed at Software Testers, Test Automators, Developers and Test Managers.

I’m told an e-learning version of the course is also in the works and I’ll let you know more when I hear about it.

May 12, 2010

Version 12 Dialog Stuff

Filed under: Uncategorized — Marcus Tettmar @ 9:09 am

For you dialog old-timers used to the way dialogs work in v11 and earlier I’ve posted a crib sheet for the new system here:

http://www.mjtnet.com/usergroup/viewtopic.php?t=6110

sarver311 has posted an example of a dialog that implements a drill down lookup list and demonstrates some of the new techniques:

http://www.mjtnet.com/usergroup/viewtopic.php?t=6161

If you have any nice dialog examples or tricks you wish to share please post them to the beta forum.

JRL points out that since Macro Scheduler is built with Delphi most of the dialog objects and properties are inherited from Delphi so for more detailed information about them the Delphi documentation can be consulted:

http://www.mjtnet.com/usergroup/viewtopic.php?t=6162

Older Posts »