Marcus' Macro Blog

Tips and News on Macro Recording and Automating Windows with Macro Scheduler

Archive for the ‘General’ Category



What is Robotic Process Automation (RPA)?

Wednesday, October 11th, 2017 by Marcus Tettmar

Our longstanding customers will know we’ve never really been into jargon here at MJT. Jargon in the IT industry tends to come and go. And there’s something quite amusing about a term that pops up and is touted as being some amazing new thing when it simply describes something we’ve been doing here at MJT Net Ltd for 20 years! On the other hand any term that helps to describe what we do is useful and I suppose it’s nice to know that finally, after all this time, what we do in our little niche of the IT world now has a name: Robotic Process Automation or RPA.

So those of you who have been using Macro Scheduler for a while know what RPA is, even if you’ve never called it that.

Robotic Process Automation tools allow you to create “bots” (we’ve always called them macros) to automate business processes (often by simulating a user). With RPA we automate repetitive tasks – taking the robot out of the human – freeing people up for more value-adding activities.

Our customers have been automating their processes robotically for years, ever since Macro Scheduler was first released way back in 1997.

Morning Rant

Friday, August 11th, 2017 by Marcus Tettmar

A customer filing PayPal disputes rather than emailing us and then, despite confirming that they have the software, failing to cancel the dispute and PayPal finding in their favour, leaving us out of pocket!

PayPal is costly and causes so many accounting headaches it isn’t true. I’ve a good mind to remove it from our site. How many people only buy because we accept PayPal? Anyone?

Another “customer” asking us to write a script, watching us write code, seeing it working, speaking favourably throughout the project at every step, never voicing any concern and then refusing to pay at the end. What’s the answer, lawyers and contracts, which would mean we’d have to put the prices up, or just stop offering script development services? Answers below.

Maybe give up completely. It isn’t what it used to be. This was fun in the early Internet days. Now it just feels like everyone wants something for nothing. Convince me otherwise below.

Our 20th Year!

Monday, February 6th, 2017 by Marcus Tettmar

Happy New Year! A somewhat belated new year greeting, but one that comes with the realisation that this year marks the 20th year of Macro Scheduler. The first version was released way back in 1997!

20 years! Quite amazing. It all happened by accident really and I certainly didn’t expect it to still be going strong 20 years later. In fact it’s stronger than ever.

Thanks so much to all of our customers for all your support and feedback, helping to make Macro Scheduler the product it is. Some of you have been around since that very first year and still use the software today, and that makes me very proud.

Here’s to another 20 years!

Templates and Default Templates

Wednesday, January 25th, 2017 by Marcus Tettmar

Did you know you can create script templates to use when you create new macros in Macro Scheduler?

When you create a new macro you can choose File/New Macro from Template. This allows you to browse for a .scp file to use as a template. There are some pre-built templates in the Templates subfolder of the program folder which by default you will be presented with.

To create your own templates just create a script as normal or use the standalone editor and export it to a name and folder of your choice. You can then use it later with the “New Macro from Template” option.

If you’re always writing the same stuff when you create a new macro – e.g. maybe you have a standard way of documenting your macros with a code block at the top, you might find default templates really useful. You will probably have noticed that “from the factory” Macro Scheduler puts some comments at the top of all new scripts. You can change this or add your own comments/code by creating a default template.

To create a default template create a script file called default.scp and store it in a Templates subfolder beneath your main macro folder (usually My Documents\Macro Scheduler 14). This default template will then be loaded whenever you create a new macro using File/New Macro.

Image Recognition Kudos

Thursday, January 12th, 2017 by Marcus Tettmar

It’s always nice to receive unsolicited praise. I thought I would share this with you which was sent into us from one of our customers, Lee Hightire:

“You have an Incredibly Awesome product! I just used the Image Recognition tool to help me get at an item in the Sys Tray (needed to pause syncing of OneDrive). I was beating my head against the wall trying other methods, and the Image Recognition tool essentially wrote the code (and trust me, I needed it to do so). I just wanted to say thanks.”

Toast Notification Window for your Scripts

Wednesday, September 7th, 2016 by Marcus Tettmar

Over in the forums dtaylor has posted a script library which allows you to show a small notification window in the lower right of your screen. Useful for reporting on progress during your script, in loops etc.

Grab it here.

Capture Screen Text using OCR

Friday, August 5th, 2016 by Marcus Tettmar

Here’s a way to get screen text from any application – even from an image – using OCR and a free open source tool called Tesseract.

First, you need to download and install Tesseract. You can get it here.

Tesseract is a command line utility. The most basic syntax is:

tesseract.exe input_image_file output_text_file

So you could call it from a Macro Scheduler script something like this:

//Capture screen to bmp file - you could instead capture only a window or use FindObject to get coordinates of a specific object
GetScreenRes>X2,Y2
ScreenCapture>0,0,X2,Y2,%SCRIPT_DIR%\screen.bmp

//run tesseract on the screen grab and output to temporary file
Let>RP_WAIT=1
Let>RP_WINDOWMODE=0
Run>"C:\Program Files (x86)\Tesseract-OCR\tesseract.exe" "%SCRIPT_DIR%\screen.bmp" "%SCRIPT_DIR%\tmp"

//read temporary file into memory and delete it
ReadFile>%SCRIPT_DIR%\tmp.txt,theText
DeleteFile>%SCRIPT_DIR%\tmp.txt

//Display the text in a message box
MessageModal>theText

This example simply captures the entire screen. You probably wouldn’t normally want to do this. Instead you could capture a specific window:

//Capture just the Notepad Window
SetFocus>Untitled - Notepad
GetWindowPos>Untitled - Notepad,X1,Y1
GetWindowSize>Untitled - Notepad,w,h
ScreenCapture>X1,Y1,{%X1%+%w%},{%Y1%+%h%},%SCRIPT_DIR%\screen.bmp

Or even a specific object:

//capture just the editor portion of notepad ...
SetFocus>Untitled - Notepad
GetWindowHandle>Untitled - Notepad,hWndParent
FindObject>hWndParent,Edit,,1,hWnd,X1,Y1,X2,Y2,result
ScreenCapture>X1,Y1,X2,Y2,%SCRIPT_DIR%\screen.bmp

Either way you then have a screen bitmap you can pass into Tesseract.

Once you’ve retrieved the text you would probably want to parse it, using e.g. RegEx. Here’s an article on a RegEx expression useful for parsing out data.

How to Run an Access Macro from Macro Scheduler

Thursday, August 4th, 2016 by Marcus Tettmar

Recently someone asked in the forums how to “Automatically Detect MS Office Install Location” so that they could run an Access macro.

Well, there are ways to get the path of an installed Office application, but it isn’t necessary in order to run an Access macro. This is a rehash of my forum answer:

You can run an Access macro via the command line using the /x switch. The ExecuteFile command lets you pass parameters. So you could just do this:

ExecuteFile>%USERDOCUMENTS_DIR%\MyDb.accdb,/x Macro1

This will open the DB and run macro “Macro1″. Note my DB is in my documents folder here so I’m just using USERDOCUMENTRS_DIR but this could be any path.

Here’s a list of other command line switches.

For more control you could use VBScript:

VBSTART
  Sub RunMacro(accessfile,macroname)
    dim accessApp
    set accessApp = createObject("Access.Application")
    accessApp.OpenCurrentDataBase(accessfile)
    'comment next line out if you don't want access to be visible
    accessApp.visible = true
    accessApp.DoCmd.RunMacro macroname
    'you can run a subroutine or function in module code instead if you want:
    'accessApp.run "routinename"
    accessApp.Quit
    set accessApp = nothing
  End Sub
VBEND

VBRun>RunMacro,%USERDOCUMENTS_DIR%\MyDb.accdb,Macro1

This gives you more control – you could make it invisible, and as you can see you could run VBA code instead if you want – or access any of the other methods. Anything you can do inside Access you can do here – by converting VBA to VBScript:

http://help.mjtnet.com/article/19-converting-office-vba-to-vbscript

But if you do really want to get the path, how about querying the mime-type in the registry:

RegistryReadKey>HKEY_CLASSES_ROOT,ms-access\shell\open\command,,accPath
ExtractFilePath>accPath,accPath

Enjoy!

Relative Paths for Portable Macros – SCRIPT_DIR and BMP_DIR Explained [Recap]

Monday, July 25th, 2016 by Marcus Tettmar

Are your macros reading from other files? Find out how to avoid hard coding file paths and use relative folders:

http://help.mjtnet.com/article/167-relative-paths-for-portable-macros-explaining-scriptdir-and-bmpdir

What do you want to see in Macro Scheduler?

Wednesday, July 20th, 2016 by Marcus Tettmar

What would you like to see added to Macro Scheduler? Comment below.

  • You are currently browsing the archives for the General category.

      • Archives

    • Categories