June 9, 2011

About the MacroScript SDK – How to Run Macro Scheduler Code Within Your Own Applications

Filed under: General,Uncategorized — Marcus Tettmar @ 8:46 am

What Is The MacroScript SDK?

The MacroScript Software Development Kit is a software component that allows developers to use the Macro Scheduler scripting language within their own applications. It comes in ActiveX and DLL form so that almost any programming language, including VB, C#, C++, Delphi, PowerBuilder, etc, can make use of it. It makes it possible for other applications to run Macro Scheduler code internally. As well as run Macro Scheduler code it allows the programmer to query or modify MacroScript variables at any point during execution.

Who Would Use It and Why?

The SDK is aimed at application developers. It is commonly used in projects where some integration is needed with other third party or legacy applications where no API exists, or where the developer needs to provide a means of creating macros within their applications.

For example, DM Software in Denmark used it in their Dialog Manager product to simplify integration with other systems and share data with them, as well as allow their users to create scripts for custom integrations. You can read the case study here.

Why Not Just Compile a Macro with Macro Scheduler Pro and “shell” it?

If all you want to do is have your application run a Macro Scheduler macro to perform some automation, then, sure, all you really need to do is compile your macro to a .exe and then call or “shell” this .exe from your application. E.g. using the VB/VBA Shell function.

This might be fine if that is really all you need to do. But what if you want to get data back from the macro? Let’s say the macro scrapes data from a web page and you need to get this data back into your calling application. This would be difficult to do with an external .exe. While you could use temporary file storage or a database and have your .exe macro write the data out and then read it back in with your application, this requires extra work and validation. You also have to consider the implications of the external macro process being terminated prematurely, perhaps by the user.

With the SDK you can execute script code directly from within your application in whole, or in sections or even one line at a time. And between lines or code sections you can directly query the value of a variable or variables. So using the SDK you have much greater control, there is no need to handle shelling out to an external process, waiting for it to complete and reading/writing to file. Instead you can control the logic flow as you wish and access macro data directly, storing it in local variables as and when needed.

– Control of logic flow
– Direct access to script variables
– No need to start an external process

How Do I Use It?

The MacroScript SDK ships with both an ActiveX and native DLL interface so is compatible with the majority of development environments and languages. A basic set of methods provides access to the functionality and examples are included for VB, VBScript, C++, C# and Delphi.

Here’s a simple example in VB:

    Set MacroScript = CreateObject("MScript.MacroScript")
    MacroScript.Init

    'Run notepad and send some text to it
    MacroScript.RunCode "Run>notepad.exe"
    MacroScript.RunCode "WaitWindowOpen>Untitled - Notepad"
    MacroScript.RunCode "Send>Hello World"

    'set variable x to the value entered in Text1 multiplied by 5
    MacroScript.RunCode "Let>x=" & Text1.Text & "*5"

    'get the value of x and put it in Text2
    Text2.Text = "x=" & MacroScript.GetVar("x")
    MacroScript.Cleanup

In the above example first we demonstrate running some code to start Notepad and send text to it. Next we create a MacroScript variable set to the value supplied in a text box on the form multiplied by 5 and then demonstrate how we can retrieve values back from the script.

As well as run script code you can also run script files and pass parameters into code blocks and scripts as you would command line parameters for regular scripts. In addition the ActiveX has script and parms properties and a Run method for an easy way to apply a script and run it.

For more information click here; download the evaluation which includes full documentation and examples; or read a case study on how DM Software makes use of the SDK in their Healthcare Application.

June 7, 2011

Letting off Steam?

Filed under: General — Marcus Tettmar @ 9:04 am

For the licensing mechanism for our ClipMagic product (ClipMagic is an easy to use Windows Clipboard Extender if you didn’t already know) we adopted a server based activation system. I know that some people have a passionate dislike for software that needs to be activated, but you can’t please everyone. And until now we’ve had no complaints.

Then yesterday we get a ticket with no name and an invalid made-up email address saying simply:

“Unfortunately I purchased your product without realizing it required web authorization. I’ll just use a competing product”.

Now, before I’d seen the email address my immediate reaction was to reply and offer a refund. Perhaps I’m too nice but I don’t see the point in having customers that don’t want to be customers. But then I noticed that if I did reply the email would simply bounce. The “customer” has provided no identifying information at all!

I don’t get it. He says he purchased but doesn’t want it – and won’t activate it. Yet doesn’t want me to know who he/she is and isn’t asking for a refund. So why bother emailing me? Letting off steam perhaps. But it seems odd that there was no request for a refund.

I’ll file it away in our “Strange Emails” category.

May 23, 2011

Why Can’t I Colour My Dialog Buttons?

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

Some people have asked why they can’t change the colour of a button that they place onto a custom dialog.

The short answer is that these buttons are standard Windows buttons and are drawn by Windows. And Windows has some “rules”.

Microsoft lays down some design guidelines. Take a look at this document here which says:

If you use standard windows and Windows controls, these border styles are supplied for your application automatically. If you create your own controls, your application should map the colors of those controls to the appropriate system colors so that the controls fit in the overall design of the interface when the user changes the basic system colors.

So, a standard control, like a dialog button will adopt the colour and design as decided by Windows and the user’s system wide preferences and we as the programmer have little or no control over it. Idealistically this is a good thing.

I believe that convention helps usability. If all buttons look alike a user knows it’s a button and so it’s purpose and functionality is obvious.

Of course, there are exceptions and sometimes there may be a reason (justified or not) for ignoring the guidelines and making a button look like something very different, e.g. in a game. So how do you do it? Well, obviously you don’t use standard Button objects.

On the whole Macro Scheduler dialogs are meant to be just that – standard looking Windows dialogs, designed for requesting data from users or giving them choices and controlling macros.

If you want complete freedom to design something snazzy then arguably you are using the wrong technology and should be considering something like Flash or HTML instead. And there’s no reason why such an interface can’t trigger Macro Scheduler macros anyway.

Having said that there are some things you can do to make more glorified looking dialog “buttons”. One option is to use Image objects. Don’t forget that you can respond to a mouse click on any object, so you can easily have a clickable image. You can trap other events too – such as mouse over events. So if you want to be really clever you can have your image’s mouse over event change the image, e.g. to one with a slightly different border style so that the user knows it is the active “button”.

April 26, 2011

Authenticate Your EXEs – Discounted Code Signing

Filed under: Announcements,General — Marcus Tettmar @ 10:14 am

What is Code Signing?

Since XP, when you download an executable file from the Internet the browser checks the file’s Authenticode signature. This verifies who the publisher is. You get a dialog asking if you wish to download software from this publisher. If there is no signature the warning is more severe and it says something like:

The publisher could not be verified. Are you sure you want to run this software? This file does not have a valid digital signature that verifies its publisher. You should only run software from publishers you trust.

In some cases you will also get a similar warning when running applications that haven’t been signed, especially if the executable resides on a network drive. Apps that have been signed are trusted more by the operating system. Vista and Windows 7 are more fussy and certain types of app must be signed.

Code signing protects against tampering and impersonation. If a signed app is tampered with or modified in some way the signature becomes invalid and so the user will be warned when they try to run it.

How does it work?

A publisher applies for a digital certificate from a Certification Authority like Comodo or Verisign. Using the Microsoft Authenticode tools the publisher can sign their applications with their digital certificate. The signing tool basically makes a hash of the code and their private key and appends the signature to the end of the executable. If the code is later modified the signature will therefore be invalid as it is partially based on the application’s code itself.

Should I sign EXEs Compiled with Macro Scheduler?

If you distribute compiled macros to others, or let people download them from the web you should definitely be signing them. Users can then see who the publisher is and be sure that the file hasn’t been modified in any way, and will no longer see the unknown publisher warning presented by the web browser/operating system.

So how do I sign my EXEs?

First you need to obtain an Authenticode Certificate. We have negotiated a very helpful 10% discount for our customers off the price of Comodo Code Signing certificates supplied by K Software, an official Comodo Reseller. K Software prices are already extremely competitive and now, as a Macro Scheduler user, you get an extra 10% off.

The certificate used to sign our software, including Macro Scheduler was supplied by K Software. So you know you are in good company! 🙂

To find out more and place an order visit K Software’s Code Signing page. To get your 10% log into the Macro Scheduler Registered Customer area to obtain your special discount code.

You also need the code signing tools. These come with the Microsoft Platform SDK and can be downloaded here:
Platform SDK Redistributable: CAPICOM

Once installed, launch SignTool.exe to sign your EXE. For command line options see: Sign Tool (SignTool.exe)

For more step by step help Jeff Wilcox has written an excellent article about code signing and authenticode. It covers everything from the order process through the tools you’ll need to do the signing. Read the article about code signing here.

February 10, 2011

Rewarding Feedback

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

I received this in an email yesterday and just had to share it:

“Thank you for a truly superior product! I used this at a previous place of employment and developed a system to autopopulate our very static software. When the software vender sent training staff they were so impressed they offered me a job! I now work for them and have you to thank for it!”

It’s not always easy running a small software company. But receiving feedback like that certainly makes up for a lot of hard work.

February 3, 2011

A Few Site Changes – New Helpdesk and Sharing Links

Filed under: Announcements,General — Marcus Tettmar @ 10:36 am

For years now we’ve been making do with a less-than-perfect open source ticketing system. We’ve lived with missing attachments, emails not always getting through and the lack of embedded images, some garbled mime encodings and various other missing features.

Finally we have a brand spanking new helpdesk. It’s over at help.mjtnet.com. You can still email us as usual. And if you’ve emailed us recently you may have noticed the receipt of some snazzier looking emails containing your ticket history. You can also submit and view the status of tickets online. You may also have noticed that a “Feedback” tab has appeared to the left of the website. This is a quick way to send us a message from whatever page you are on (except the forums – we figured if you’re on the forums you would want to post a forum message not send an email).

Another new feature on the website is social networking sharing buttons. You’ll notice Twitter and Facebook buttons on each blog post. Facebook “like” buttons have also now appeared after every forum post, and at the top of every page you’ll see Facebook, Twitter and other bookmark buttons. So if you see a post or page you like please share it, or bookmark it and help introduce people to the world of Macro Scheduler!

Don’t forget you can also connect with us and other Macro Scheduler fans on the Macro Scheduler Facebook page, or follow my occasional tweets on Twitter.

So, whether by Facebook, Twitter, Forum, Email or Helpdesk, I look forward to chatting with you. 🙂

December 14, 2010

15% Off T-Shirts Today at Zazzle

Filed under: Announcements,General — Marcus Tettmar @ 3:43 pm

Thought I’d share this: I just noticed that Zazzle are currently offering 15% of all orders today (14th December) only with code JINGLESALE75. Also free shipping on orders over $50. More details are here. So if you were thinking of grabbing a shirt (even if it’s not one of ours!) now could be a good time!

December 13, 2010

Macro Scheduler T-Shirts and Merchandise

Filed under: Announcements,General — Marcus Tettmar @ 10:54 am

With Christmas round the corner I thought I might post a reminder that we have a number of official logo T-shirts, mugs and mouse mats available via Zazzle.com:

November 30, 2010

Video Tutorial – Macro Scheduler for Non-Technical Beginners – Part 1

Filed under: Announcements,General,Tutorials — Marcus Tettmar @ 10:57 am

Following my recent request for video tutorial contributions long-time Macro Scheduler user Peter Begelsdorf has stepped up to the plate and put together a short tutorial aimed at the non-technical beginner.

This slick three minute video introduces the fundamental, yet very important, SendText and Press commands and shows beginners how to create a simple text macro assigned to a hot key.

Peter is now planning to create a sequel to expand on the basics and explain how to execute a file and wait for a program to be ready.

While many of my regular readers may be amongst the more technical and experienced Macro Scheduler users I think these new videos will be a great help to newcomers to the software.

Peter Bengelsdorf is a media integration consultant who was a newspaper editor when he started using Macro Scheduler more than a decade ago. For his contribution Peter has been awarded free future Macro Scheduler updates and a WebRecorder license.

If you would like to create a video tutorial or have ideas for one, please let me know. We’re giving away licenses and future upates to video contributors.

This tutorial has been added to the Video Tutorials page.

November 23, 2010

Support Email Rant

Filed under: General — Marcus Tettmar @ 5:02 pm

I received the following email today (I have paraphrased and anonymised it to protect the innocent):

“We were given a Macro Scheduler script to run on our system that someone else wrote which we are trying to use with your trial version. It doesn’t work. Your product seems to be very flaky and unreliable. Is this a feature of the trial version?”.

Now, when I read an email like that I have to breathe carefully and compose myself. To see what’s wrong with it let’s reword the same message as if it were talking about a different product:

“We were given a VBScript file which someone else wrote and we are trying to run it on our system but having problems. Microsoft VBScript must be very buggy!”

Yeh, so because a script that someone else built using a particular product is buggy the user thinks it is the product that is buggy. It seems not to have occurred to them that the script they were given is clearly not put together very well, or at least not written to run on their system. It hasn’t crossed their mind to report back to the person who wrote the script. For all we know the person who wrote it never intended it to be run on any other system but his/hers anyway.

You can build all kinds of dodgy, bug-ridden and dangerous software with C++. Does that mean Microsoft Visual Studio has a bug?

I’ve downloaded lots of dodgy VBscript code snippets, buggy PHP files and Perl scripts that fail to do what the author says they do, or need tweaking to work on my system. It never occurred to me to blame the VBScript, PHP or Perl interpreters. Next time rather than email the author of the code I’ll email Microsoft, PHP.com or Larry Wall instead.

Sheesh.

« Newer PostsOlder Posts »