Newbie can't get logic right. Please help.

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Jaylee
Junior Coder
Posts: 45
Joined: Wed Feb 08, 2006 4:48 am

Newbie can't get logic right. Please help.

Post by Jaylee » Wed Feb 08, 2006 5:25 am

Hello,

Firstly, thank you for providing this excellent method of communicating issues and solutions between users. I have found a great deal of assistance in here well before I joined the forum.

However, I have been through many of the posts in this forum and thought I had found the answer to my question posted by Bob Hansen but I simply could not get it to work although, apparently, the original poster was able to do so.

I am running MS V6.0.0.14 (on WinXP SP2) as this is the latest available registered copy from my employer.

I simply cannot get the logic to work when I check for the presence of a window.

The code I'm using is as follows (as suggested by Bob Hansen):
IfWindowOpen>MyWindow*,Continue,End
Label>Continue
SetFocus>MyWindow*
...
Do stuff
...
Label>End
When I try to run this with no window open (because that's when I need to change what I'm doing), I get an error message to say the specified window could not be found. I know this. What I need is the ability to continue with other instructions if there is no window.

The reason for this is that the rest of the code I have is processing an unknown number of email messages several times a day. They are opened, a further action is made, they are moved to a different folder, closed, then the steps are repeated. Eventually, I get to the end in each scheduled run. So, if the message window is not present, I want the macro to end. Currently, I get the error message and my workaround is to have a another macro triggered by a windowevent to Abort the error, thus ending the macro but this is really ugly and should not be necessary.

I would greatly appreciate any assistance, bearing in mind that I only started playing with MS a few weeks ago and have absolutely NO experience in programming.

Thanking you in advance ... :D

J.

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Feb 08, 2006 6:27 am

Hi,

If you are using v6 you will have to use this syntax:

IfWindowOpen>MyWindowTitle*,WindowOpen

//If we get here the window is NOT open
//so put the code you want to do here when the window
//is NOT open (if any)

Goto>DoneWindowCheck

Label>WindowOpen

//If we get here the window IS open
//put code here you want to do when window IS open

Label>DoneWindowCheck

//End of window check - continue with script here
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Jaylee
Junior Coder
Posts: 45
Joined: Wed Feb 08, 2006 4:48 am

Post by Jaylee » Thu Feb 09, 2006 3:11 am

Hello Marcus,

Thank you so much. This works beautifully!

I am investigating upgrading to Version 8 in the near future.

This is truly a wonderful product you have built. I am now processing approx 300 emails a day without having to lift a finger and I can use the time to do other productive work. I only wish I had found this years ago!

Kind regards,
J. :D

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts