November 7, 2014

Macro Scheduler 14.2 – Python, JSON, XML and Auto Documenting Macro Recorder

Filed under: Announcements,Macro Recorder — Marcus Tettmar @ 1:34 pm

I am pleased to announce that we have today released Macro Scheduler 14.2

Amongst other things this new version includes the following great new features:

  • Self Documenting Macro Recorder with snapshots of Windows/Objects being Activated/Clicked on
  • The ability to run Python code within your macros!
  • A native JSON Parser
  • A native XML Parser using XPath

Here’s an overview of these main new features, but for a more complete list of improvements view the history list here.

Self Documenting Macro Recorder

Ever recorded a macro and then tried to edit it but couldn’t figure out which bit did what? Well, now when you record a macro the macro recorder will take snapshots of windows that are activated and objects that you click on. These will be inserted into the script as image comments, right above the line of code they refer to. So, now, it’s easier to see exactly what your macro is doing and which bits you want to edit/copy.

Run Python Code Inside your Macros

In 14.2 there’s a new function called PyExec. It allows you to run real Python code and get back the values of any Python variables you specify. You’ll need to install the Python 2.7 DLL to your Macro Scheduler folder (or compiled .EXE folder) – there’s a link in the help file to a zip file with all the files you need.

You can run any Python code and even use third party Python imports. This is pretty wild IMO – the possibilities are endless. Here’s a simple example:

/*
First ensure Python27.dll and imports are in your Macro Scheduler program folder.
Download and unzip this file:
https://www.mjtnet.com/software/python27.zip
*/

Let>url=http://ip.jsontest.com/

/*
python_code:

import urllib2
import json

# grab data from http://ip.jsontest.com/ - see www.jsontest.com
response = urllib2.urlopen('%url%')

# load the json
dict = json.loads(response.read())

# get the ip member
myip = dict["ip"]

# make a nice string representation of the dict
sdict = json.dumps(dict)

# Anything we print to IO is returned in the PYExec output var
print "All Done"
*/

//Load the Python code to a variable
LabelToVar>python_code,pcode

//Run the code and request the values of the sdict and myip variables ...
PYExec>pcode,output,sdict,myip

//Display the IP address
MessageModal>Your pubic IP is: %myip%

Parsing JSON

In the last few years JSON has become a very popular way to transmit data objects. Most web services now use it so it cannot be ignored. While you can parse JSON using string handling/regex having an easy to use native parser is essential. Enter: JSONParse

In the above Python example we used Python’s own JSON handling to extract an IP address from some JSON retrieved from a web service. Here’s how we can do the exact same thing using native MacroScript code:

HTTPRequest>http://ip.jsontest.com/,,GET,,JSON
JSONParse>JSON,ip,myIP
MessageModal>Your pubic IP is: %myIP%

And here’s an example which gets data out of a more complicated structure:

//Requires Macro Scheduler 14.2

/*
MyJSON:
{ "uid" : "1234", 
  "clients" : ["client1","client2","client3"],
  "people" : [{"Name":"Marcus","Age":"21"},{"Name":"Dorian","Age":"18"}],
  "color" : "red",
  "size" : 14 }
*/

LabelToVar>MyJSON,sJSON

JSONParse>sJSON,uid,result
JSONParse>sJSON,clients,result
JSONParse>sJSON,clients[1],result
JSONParse>sJSON,people[1].Name,result

Parsing XML

Of course XML is also still very popular. Up til now we’ve had to parse XML using substring handling/regex or use Microsoft’s XML object via VBScript – which is a little over-complicated IMO. We now have a simple to use native XML parser function – XMLParse. Here’s an example:

//Requires Macro Scheduler 14.2

LabelToVar>XML,sXML
XMLParse>sXML,/bookstore/book,val,numBooks
Let>k=0
Repeat>k
  Let>k=k+1
  XMLParse>sXML,/bookstore/book[%k%]/title/text(),val,len
  MessageModal>val
Until>k=numBooks

/*
XML:
<?xml version="1.0" encoding="UTF-8"?>




  Everyday Italian
  Giada De Laurentiis
  2005
  30.00



  Harry Potter
  J K. Rowling
  2005
  29.99



  XQuery Kick Start
  James McGovern
  Per Bothner
  Kurt Cagle
  James Linn
  Vaidyanathan Nagarajan
  2003
  49.99



  Learning XML
  Erik T. Ray
  2003
  39.95



*/

How to Download/Upgrade

If you have a valid maintenance plan you can download the update from your account here. If your maintenance has lapsed you can also purchase upgrades and renew maintenance from within your account.

Trial versions can be downloaded here.

October 30, 2014

More SDK Examples – C++ and C##

Filed under: General,Scripting — Marcus Tettmar @ 2:12 pm

Following on from my last post with some examples of using the MacroScript SDK within Python I thought I’d post a simple C# and C++ example. These are the same examples that ship with the MacroScript SDK:

C#

C++

More info on the MacroScript SDK is here.

October 18, 2014

Multiplication by Drawing Lines

Filed under: General — Marcus Tettmar @ 8:10 am

If you have kids here’s a great way to show them how to do long multiplication. They’ll love this:

October 16, 2014

Be Gone Poodle!

Filed under: Announcements,General — Marcus Tettmar @ 9:13 am

Our servers have been patched for Poodle, the SSL3 vulnerability. Basically we’ve just disabled SSL3 and SSL2. These are no longer needed anyway as all modern browsers support their successor, TLS.

Those using IE7 or lower (why oh why!?) will, by default, not be able to load www.mjtnet.com without making a small change.

If for some unearthly reason (there really isn’t one) you HAVE to use one of those ancient browsers you can simply go into advanced settings, disable SSL2 and SSL3 and enable TLS 1.0.

But why bother doing that when you can just upgrade. Even those of you stuck using XP can upgrade to IE8 (or use a better alternative).

But if you need to do that you won’t be reading this unless you’ve connected via a different browser/PC!

According to our server logs 3% of visitors last month were using IE7 or less. That’s a low enough figure not to worry about lost visits and, anyway, it’s time these browsers and SSL3 were consigned to the scrap heap once and for all. Any other workarounds or fixes are just delaying the inevitable.

21% of visitors are still using IE8. They’re probably stuck on XP. I can’t wait to see that figure drop below 1%.

October 15, 2014

Gaming Marathon in Aid of Doernbecher Children’s Hospital

Filed under: General — Marcus Tettmar @ 11:54 am

On October 25th MJT Net employee Dorian Ellis is taking part in a 24 hour gaming marathon to raise money for Doernbecher Children’s Hospital, a hospital local to Dorian which has treated children of friends of his.

When Dorian isn’t answering Macro Scheduler support tickets he’s often to be found playing on-line games, so this fundraiser combines his passion with a cause close to his heart.

Please check out his page and, if you can, make a small donation and let’s see if we can help Dorian reach his target of $1000. Thank you.

October 14, 2014

The Macro Scheduler MacroScript SDK in Python

Filed under: Automation,Scripting — Marcus Tettmar @ 2:19 pm

Did you know there was a Macro Scheduler SDK? It allows you to run Macro Scheduler code from right within your own apps. You can run and interact with MacroScript code within VB, C++, C#, Delphi, VBScript … or any other programming language which lets you use a COM object or Win native DLL.

It even works in Python. Here’s a small example which uses the screen image recognition functionality to find and click on the Windows Start button:

Another slightly more complex example which opens Notepad and types into it. It also demonstrates how you can call chunks of code at a time instead of all at once and set and get the value of script variables during execution. It also gets the result of the script set via MACRO_RESULT:

More information about the MacroScript SDK can be found here.

A number of customers have used the SDK to build macro-ing capabilities into their own products and/or create tighter integrations between their own software and automation routines using MacroScript.

If you’re interested in trialling a copy or getting pricing info drop us a line.

September 30, 2014

Testimonial – Radio Station Automation

Filed under: General,Success Stories — Marcus Tettmar @ 8:43 am

It’s always interesting to hear what our customers use Macro Scheduler for. So many use cases. Here’s one from Mark Croom:

For the convenience of listeners to the radio stations I work with, the program is doing some file handling tasks that put artist and title information onto our website and into radiotext on RBDS-capable radios, during programming that is supplied by satellite networks rather than through the local automation.

Works great and I can see the amazing flexibility of Macro Scheduler for other automation uses.

Mark Croom
Kinshipradio.org

September 22, 2014

Binary and Kids

Filed under: General — Marcus Tettmar @ 10:57 am

I taught my son Ben, who is 8, to count in binary last night.

It was fun. He struggles with math, but this seemed like a revelation for him. So simple, so powerful.

I realised he didn’t know what is inside a microchip – that a computer is just a box of switches. That when a sprite moves across the screen there are essentially just lots of little lights being switched on and off quickly. That 1s and 0s, ons and offs – two simple states – power our world, helped send men to the moon.

I sensed a Eureka moment for him. Almost wonder if in fact we’re teaching kids the wrong way around. Binary is so fundamental, so important, fun and easy. Teach kids to add and multiply in binary and I’m sure it will better prepare them for doing the same in decimal. If nothing else the fact that this has something to do with computers is probably a little incentive in getting them to pay attention.

I didn’t learn binary until half way through secondary school. I have no idea if/when schools teach it now.

Kids use tablets, smartphones, video games and computers all the time. Do they know what’s inside?

September 4, 2014

How to Share Macros with Other Network Users

Filed under: General — Marcus Tettmar @ 12:33 pm

We’ve added a new article to our help desk: How to Share Macros with Other Network users

August 8, 2014

Detect Which Web Page IE Is On – Keep It Simple

Filed under: Automation,Scripting — Marcus Tettmar @ 9:43 am

Today we had two different support requests asking how to have a Macro Scheduler macro determine which page IE is on.

One person was asking about using Image Recognition for that. You could also use the IE functions to examine the HTML or look for the existence of a specific HTML element.

You could do one of those, sure, but I think that’s over complicating things.

My motto is “keep things simple”.

IE’s Window Title adopts the page title of the web page it is displaying. IE also shows the URL in the address bar. So why not just look at one of those. Like this:

//Two simple methods to see which page IE is at.

//Method One - Just look at the window title
IfWindowOpen>Bing - Internet Explorer
  //Bing is open - do this
Else
  IfWindowOpen>Google - Internet Explorer
     //Google is open - do that 
  Endif
Endif

//Method Two - Look at the Actual URL in the URL bar - I used the Wizard to get this code and then altered the window title to make it a substring match
UIGetValue>- Internet Explorer*,{"Address"},curVals,Positions,nHeight
Position>google.co.uk,curVals,1,pGoogle
If>pGoogle>0
  //must be at google
Else
  //must be somewhere else
  Position>bing.com,curVals,1,pBing
  If>pBing>0
    //must be at bing
  Endif
Endif
« Newer PostsOlder Posts »