Home of Macro Scheduler - Macro Tools and Automation Software
If your email software garbles this newsletter, read this issue at mjtnet.com.

Macro Scheduler — March 2009 Newsletter

Macro Scheduler 11.1.05 Update
Podcast: Seattle Children’s Hospital - Testing Under Citrix
T-Shirt Winners for February 2009
Regular Expressions and Easy Patterns.
Other News and Articles
Staying in Touch
t-shirt

Macro Scheduler 11.1.05 Update

Macro Scheduler 11.1.05 Update is now available with the following changes:


- Added: RegEx function with Perl and EasyPatterns support for search and/or replacement.
- Added: CopyFolder, DeleteFolder commands - actually just aliases for CopyFile and DeleteFile
- Added: Option in Debug Menu to change colour of debug line (Debug/Debug Line Color).
- Added: NULLCHAR system variable for null char - Chr(0)
- Changed: Default colour of debug line to make text beneath more visible
- Fixed: CTRL+S causing hang after editor had been opened then closed
- Fixed: Editor menu shortcut keys still working after editor closed
- Fixed: Press End inside subroutine confusing code folding (in order to fix this SRT and corresponding END must have same indent)
- Fixed: Compiled macro set to log to \dev\nul (disable logging) would run slower than with no logging configured
- Fixed: If a non existing destination folder specified in compiler, compiler would crash. Now gives error msg.

Registered Downloads/Upgrades | Evaluation Downloads | New License Sales

Podcast: Seattle Children’s Hospital - Testing Under Citrix

This month's podcast interview is with Gale Dyvig of Seattle Children's Hospital. Gale talks about why they chose Macro Scheduler for automating the testing of their systems running in a Citrix environment; why they chose to replace their existing HP WinRunner scripts with Macro Scheduler scripts; and how they are saving money on licenses and ongoing script maintenance.

Download Listen

T-Shirt Winners for February 2009

Each month I send free MJT Logo T-Shirts to the top three receivers of forum reputation points. This month, T-Shirts go to the following forum members:

JRL: 25 Reputaion Points
armsys: 9 Reputation Points
kpassaur: 6 Reputation Points

Well done guys, and many thanks for continuing to help out others in the forums. Enjoy the T-Shirts.

Find out how you can win a T-Shirt by helping others.

This month I'm also sending a bonus T-Shirt to forum member jpuziano for being so generous and giving points retrospectively to a number of people who have been helpful in the past. Thanks John.

Regular Expressions and Easy Patterns

Don't worry, I'n not going to go into detail on Regular Expressions. I'm no expert. There are other, better, places to go for help with Regular Expressions. Like here. Instead I just wanted to show you how you can now use Regular Expressions, and something far easier called Easy Patterns, in Macro Scheduler 11.1.05.

I don’t know many people who find Regular Expressions easy. If the following makes no sense to you, don’t worry, you’re not alone:

([a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+) *@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)

It’s actually a regular expression pattern which will match an email address in a string. I’m sure you knew that.

Until 11.1.05 to use Regular Expressions in Macro Scheduler you had to use VBScript’s regular expression object:

VBSTART
Function RegExpTest(sEmail)
  RegExpTest = false
  Dim regEx, retVal
  Set regEx = New RegExp
 
  regEx.Pattern ="([a-z0-9!#$%&'*+/=?^_`" & _ 
      "{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)" & _
      "*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)" & _
      "+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)"
 
  regEx.IgnoreCase = true
 
  Set retMatches = regEx.Execute(sEmail)
 
  If retMatches.Count > 0 then
    RegExpTest = retMatches(0).Value
  End If
 
End Function
VBEND
 
VBEval>RegExpTest("My email address is: freddy@mjtnet.com"),theEmail
MessageModal>theEmail

In order to simplify things we have now introduced a native Regular Expression function called, appropriately enough, RegEx:

RegEx>pattern,text,easypatterns,matches_array,
   num_matches,replace_flag[,replace_string,replace_result]

Using this, the following code will find the email address in the given string:

Let>text=My Email Address: freddy@mjtnet.com
Let>pattern=([a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\....[Snipped]
RegEx>pattern,text,0,matches,num,0
MessageModal>matches_1

A bit simpler, as you don’t need to use VBScript. But you still need to use that weird and wonderful regular expression syntax.

Luckily our friends at DataMystic have created something called EasyPatterns which maps real English to regular expression syntax. Thanks to DataMystic we are able to use EasyPatterns in Macro Scheduler. Setting the EasyPatterns flag in the new RegEx command allows us to turn the above into:

Let>text=My Email Address: freddy@mjtnet.com
Let>pattern=[EmailAddress]
RegEx>pattern,text,1,matches,num,0
MessageModal>matches_1

Note the second line has been simplified to Let>pattern=[EmailAddress]. Nice. Now it makes sense!

Check out the EasyPatterns Reference here to find out what else you can do.

The new RegEx function also does search/replace. The following example will replace all IP addresses found in the string with 127.0.0.1:

Let>text=Server: 196.128.1.1; Gateway 196.128.1.10
Let>pattern=[IPAddress]
RegEx>pattern,text,1,matches,num,1,127.0.0.1,text

The following code will remove all null chars from a string:

RegEx>\0,text,0,matches,num,1,,text

A simple back reference example:

Let>text=fff axaxa fffddd bxbxb silly cxcxc
Let>pattern=([a-c])x\1x\1
RegEx>pattern,text,0,matches,num,0
Let>k=0
Repeat>k
  Let>k=k+1
  Let>this_match=matches_%k%
  MessageModal>this_match
Until>k=num

The above code will find and return substrings axaxa, bxbxb an cxcxc.

Remember - you need Macro Scheduler 11.1.05 to use the new RegEx function.

Other News and Articles

Recent blog posts:
View System Windows - Windows and Objects
Image Recognition Common Mistakes
Twitter - What, Why, How?
Generating Random Characters and Strings

Staying in Touch

There are a number of ways of getting in touch with us. For support there's the forums and our help desk. It should be noted that the forums are primarily for peer-to-peer discussion and while I try my best to monitor new posts I may sometimes miss some. In contrast our help desk is monitored continuously and every ticket gets a response.

Feel free to reply to this email if you wish to contact me personally, and I'll do my best to answer, but this mail box does tend to get jammed up with out of office responses and other bounces. So if I miss your email I apologise. If you don't get a response, it's nothing personal - drop me a line via the help desk instead. I can't always be available, but there will always be someone on the support desk.

You can also follow me on twitter: http://twitter.com/marcustettmar

You are receiving this message because you have purchased Macro Scheduler or related software from MJT Net Ltd or have opted to receive news and announcements by subscribing at mjtnet.com. To stop receiving messages from MJT Net Ltd please click here to unsubscribe. You may prefer to subscribe to my RSS feed.