December 18, 2008

The Telnet Functions – Get POP3 Message Count

Filed under: Automation,Scripting — Marcus Tettmar @ 1:41 pm

Recently in a forum post, “Getting New Email Message counts” terencepjf asked:

Does anyone know a way to get a count of New Email messages:

1) Without downloading all the messages
2) Count of messages in Inbox Sub-Folders

RetrievePOP3 works but the files need to be downloaded.”

My answer is to use the Telnet functions. You might not realise that POP3 – the protocol used to download email – is a Telnet protocol. You can Telnet into your POP3 server and see the messages waiting. POP3 usually runs on port 110, so you would telnet into the mail server on port 110. Try this from a command prompt (you type the italics):

telnet your.mail.server 110
+OK Hello there.
user your_username
+OK Password required
pass your_password
+OK Logged in
STAT
+OK 3 325657

So you simply issue “user” followed by your username, then “pass” followed by your password to log in. There are then various commands you can issue. STAT returns the number of messages waiting on the server and their size. Note that STAT returns a string in the format:

+OK MESSAGE_COUNT MESSAGE_SIZE

There are other commands you could use: LIST gets a list of the messages on the server, with their sizes. RETR n would retrieve one of them.

So we could use the STAT command to get the number of messages on the server. This is a useful exercise in the Macro Scheduler Telnet functions:

TelnetConnect – connect to a telnet server
TelnetSend – send a string to a telnet server
TelnetWaitFor – wait for a specific response and returns the text received
TelnetClose – close the session

So here’s the code to connect to a pop3 server, enter username and password and issue the STAT command, then disconnect:

TelnetConnect>mail.server.com,110,pop3
TelnetSend>pop3,user YOUR_USER_NAME%CRLF%
TelnetWaitFor>pop3,Password required,5,resp
TelnetSend>pop3,pass YOUR_PASSWORD%CRLF%
TelnetWaitFor>pop3,logged in,5,resp
TelnetSend>pop3,STAT%CRLF%
TelnetWaitFor>pop3,OK,5,resp
TelnetClose>pop3

Line 1 connects to the mail server on port 110 and returns a session variable which we will use to access this session with the other commands.

Line 2 sends “user YOUR_USER_NAME”. Note that we also send a CRLF, otherwise it would be as if we didn’t press return. Nothing happens until the telnet server receives a CRLF.

Line 3 waits for “Password required” to be returned. We then know the server is ready to receive the password.

Line 4 sends “pass YOUR_PASSWORD” followed by the obligatory CRLF.

Line 5 waits for “logged in” to be returned.

Line 6 then sends the STAT command and Line 7 waits for it to complete (waits for “OK”).

The TelnetWaitFor command returns the response in a variable, which we have called “resp” above. We can now parse this to determine the number of messages waiting. As noted above STAT returns the message count in the second column. So we just need to do:

Separate>resp,SPACE,parts
Let>count=parts_2
MessageModal>There are %count% messages waiting

In other words, we split the returned lines into an array delimited by the SPACE character. So we end up with three entries, where the second is the one we want.

So the full script to connect to a mail server and retrieve the message count is:

TelnetConnect>mail.server.com,110,pop3
TelnetSend>pop3,user YOUR_USERNAME%CRLF%
TelnetWaitFor>pop3,Password required,5,resp
TelnetSend>pop3,pass YOUR_PASSWORD%CRLF%
TelnetWaitFor>pop3,logged in,5,resp
TelnetSend>pop3,STAT%CRLF%
TelnetWaitFor>pop3,OK,5,resp
TelnetClose>pop3
Separate>resp,SPACE,parts
Let>count=parts_2
MessageModal>There are %count% messages waiting

Only 11 lines of code. It will work quickly and transparently without having to download anything to disc. More to the point, it’s a useful example on how to use the Telnet functions. Hope you find it helpful.

December 17, 2008

WebRecorder and Workflow Designer Updates

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

WebRecorder and IEAuto.DLL have been updated to 2.06 and 2.04 respectively with the following changes:

WebRecorder: Fixed URL address combo box to correctly autocomplete.
IEAuto.DLL: Added ExtractTagByName function to extract tag data by name or ID
IEAuto.DLL: Added ExtractTableByName function to extract table by name or ID

Workflow Designer was also updated for the latest Macro Scheduler script engine. Also fixed a bug with the trial version which could show an access violation on startup.

WebRecorder | Workflow Designer

December 15, 2008

Mass Import of Scripts and Groups to v11

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

Because Macro Scheduler 11 saves scripts with Unicode encoding, and previous versions understand only ANSI encoding the decision was made to install Macro Scheduler 11 into its own folder, with its own data folder and registry hive. By keeping it entirely separate from previous versions it can run side by side with a previous version without any chance of scripts being prevented from being opened in the old version. If you open a script up in v11, save it, and then try to open it in v10 it will appear corrupt (though this is recoverable – more in a sec). So for those that will continue to use v10 for a while it is sensible to keep things separate.

However, if you are happy and ready just to point v11 at your existing setup you can do so quickly by exiting Macro Scheduler and modifying the following registry entry:

HKCU\Software\MJTNET\MSched11 – DataDir

Replace the value of DataDir with the path to your existing Macro Scheduler macro folder.

You’ll also want to copy comdef.ini from the Samples folder in the Macro Scheduler 11 Program Files folder into the macro folder above, overwriting the previous one – this contains the function definitions for the code builder – so you’ll want the v11 one.

Alternatively, if you still want to run v10 but want a complete copy, copy the entire contents of your v10 macro folder to the v11 macro folder (apart from comdef.ini). Then open up groups.ini and do a search/replace on the root macro folder so that all groups are now pointing at the new v11 folder.

In either case, make sure you exit Macro Scheduler fully first.

If you ever need to open a script in v10 (or earlier) that was edited/saved/created with v11 then do one of the following:

1. Open it in v11 and select File/Save As and select “ANSI Script Files” in the “Save as type” box, or,
2. Open it in Notepad, do File/Save As and select “ANSI” in the Encoding drop down.

Macro Scheduler 11.0.32 Update

Filed under: Announcements — Marcus Tettmar @ 9:57 am

Macro Scheduler 11.0.32 Update is now available with the following fixes:

Fixed: Issue with Base64 sometimes not decoding properly.
Fixed: News Feed Notification showing error if no connection.
Fixed: -HIDE for compiled macro showing taskbar icon when dialog displayed.

Registered Downloads/Upgrades | Evaluation Downloads | New License Sales

December 9, 2008

Direct Access 2.0 – Text Shortcuts

Filed under: Announcements,General — Marcus Tettmar @ 9:07 pm

Direct Access - Text Replacement MacrosVersion 2.0 of Direct Access, a great text replacement, text shortcut tool, was released by our friends at Nagarsoft today.

Direct Access lets you assign actions and autoreplacements to text abbreviations. I use it to launch frequently used applications. E.g. I’ve assigned the text “ftp” to Filezila, my FTP client. So now, wherever I am in Windows, whatever application I’m in I can just type “ftp” and hit F12 and Filezilla is launched.

You can also use it for text replacements and text insertions. E.g. type “sig” when you need to insert your signature into an email or usenet or forum post. And of course you can also have Direct Access run Macro Scheduler macros. So you can make text shortcuts that run Macro Scheduler macros whatever application you are working in.

Version 2.0 has a redesigned interface to enhance ease of use; support for inserting rich text; network support for sharing action groups between PCs; confirming commands with delimiter keys such as SPACE and ENTER; and more.

Because Direct Access compliments Macro Scheduler so well we’ve arranged a special discount for Macro Scheduler customers. Macro Scheduler users can get 25% off the regular price of Direct Access. Registered users will find a discount coupon in the secure download area.

Congratulations to Nagarsoft on a great update to an already superb tool. Check it out.

December 8, 2008

Macro Scheduler 11.0.31 Update

Filed under: Announcements — Marcus Tettmar @ 10:42 am

Macro Scheduler 11.0.31 Update is now available with the following fixes:

Added: SetDialogObjectColor function
Change: Binary File Import now surrounds label and data in block comment to prevent an attempt to execute it
Fixed: SMTPSendMail not setting result code correctly
Fixed: Shift-Esc to Stop Window showing in GetWindowList
Fixed: Error in compiled macro if /NOSTOPKEY compiled in as last option
Fixed: Dialog Designer: After copying an object to clipboard, cannot paste it
Fixed: Dialog Designer: “Pinned to Designer” not staying pinned while moving design form
Fixed: Y array result variable default missing from FindImagePos code builder
Fixed: Index out of bounds error if start debug step from last blank line in script
Fixed: News Feed Notification was dependent on Show News Feed on Startup
Fixed: Main form shows correctly when clicking news feed notification
Fixed: Issue with Folder Browse button on Custom Dialog

Registered Downloads/Upgrades | Evaluation Downloads | New License Sales

December 5, 2008

Automated Software Testing Success

Filed under: General,Testing — Marcus Tettmar @ 5:20 pm

A couple of great posts in the new Software Testing forum are demonstrating the power of Macro Scheduler for automated testing.

Antonius Momac says in this post:

I’ve looked at more than 8 other automation tools. Some were from the big companies with many products like IBM (rational), HP/Mercury, and other more focused shops like Automated QA, Tethy Solutions, Redstone (eggplant) ….. However, the application I was putting under test was very particular. In fact, plain and simple, Macro Scheduler was the only tool that worked.

In this post Gale Dyvig said:

We found the problem with object orientated test tools like WinRunner, QTP, SilkTest, etc is the partial or nonexistant support for the objects under test. As new technologies are created the problem gets worse.

These tools have image based workarounds, but they need the script to specify the image location on the screen. We tried some workarounds based on a WINAPI command similar to GetPixelColor to find the images. It worked but was nowhere as well developed or convenient to use as Macro Scheduler’s FindImagePos. If you have bmp’s the images your application will display, you can write a script before the application is coded.

Macro Scheduler and AppNav are great because the same solution works for all technologies runnable on Windows. Because the solution is image based it works in development, independent test, and production environments.

Are you using Macro Scheduler for automated software testing? If so please post an introduction in the Software Testing forum. I’d love to know more about how people are using Macro Scheduler in automated software testing scenarios.

December 4, 2008

Another Update: Build 11.0.28

Filed under: Announcements — Marcus Tettmar @ 5:38 pm

I’ve just made another update available – 11.0.28:

Fixed: Issue with StringReplace could cause unresponsiveness
Fixed: SMTPSendMail: some email clients not deciphering attachment filenames

Apologies for two updates so soon after release. Doesn’t seem to matter what we do something crops up after release. We do need to work on improving testing in the future, but I hope our ability to release fixes quickly makes up for the small issues encountered. I do believe in releasing small fixes often rather than rolling them all up into large less frequent updates. You can always skip an update if it doesn’t affect you. Thanks for your understanding.

Macro Scheduler 11.0.27 Update

Filed under: Announcements — Marcus Tettmar @ 9:08 am

Macro Scheduler 11.0.27 Update is now available with the following fixes:

Fixed: SMTP failing to connect if SMTP_TIMEOUT not set.
Fixed: Syntax highlighting being halted by “dialog” keyword.
Fixed: _WRITE_LOG_FILE missing from syntax highlighter.

Registered Downloads/Upgrades | Evaluation Downloads | New License Sales

December 2, 2008

Macro Scheduler 11 is Shipping!

Filed under: Announcements — Marcus Tettmar @ 5:07 pm

I’m pleased to report that Macro Scheduler 11 is now available!

Here’s a summary of what’s new.

* A completely overhauled script editor with even better code folding and bookmark support and improved syntax highlighting. The advanced editor and macro properties windows have been combined into one to make things much simpler and give easy access to things like the custom dialog designer and the debugger. Feedback from beta testers is that the new editor and combined macro properties window has made Macro Scheduler much easier to use.

Macro Scheduler 11 Editor

* Macro Scheduler 11 has full Unicode support. Finally use any language characters in your scripts, detect Unicode text and output Unicode text.

* Competely overhauled FTP functions with added TLS/SSL support and support for more flavours of FTP server.

* Added SSL support to HTTPRequest

* With v11 you can compile macros in “console app” mode and write to STDOUT

* We’ve added the ability to embed any kind of file in a script, and export it at runtime.

* And more.

Release notes are here.

If you have current upgrade protection you can download v11 now from the registered download area. Upgrades can also be purchased by logging into registered downloads. Or for new licenses go here.

Thanks to all who helped beta test this new version!

Older Posts »