Jump to content
Macro Express Forums

Set of logics


tocmo0nlord
 Share

Recommended Posts

I’ll be honest that I don’t know exactly what it is you’re looking for. However, based on what I think you’re asking, I’ll give you a rough example of a complex If/Then macro.

 

Since most of my more complex macros are work-related, a lot of the built-in information would be unrecognizable to you, and a lot of it would be confidential, so I'm building a completely made up example.

 

// This section checks to see if Notepad is NOT on top. It also checks to see if Word is NOT on top.

If Not Window Title "notepad" on top

AND

If Not Window Title "Microsoft Word" on top

 

// If both "NOT" conditions are met - meaning that neither window is on top -

// the macro checks to see if Notepad is running.

// If Notepad is running, the macro brings it to the top.

If Window Title "notepad" is running

Activate Window: "notepad"

 

// If Notepad is NOT running, the macro uses the ELSE command

// followed by an embedded IF command to check if Word is Running.

Else

 

// If Word is running, the macro activates it.

If Window Title "Microsoft Word" is running

Activate Window: "Microsoft Word"

 

// If Word is NOT running, the macro uses another ELSE to move

// on to the next option.

Else

 

// At this point, the macro knows that Word and Notepad are not running.

// So it launches Notepad.

Text Box Display: Launching

Program Launch: "notepad.exe"

Wait For Window Title: "notepad"

Text Box Close: Launching

// This END IF closes the embedded "If Word is Running" statement

End If

// This END IF closes the "If Notepad is running" statement

End If

// This END IF closes the original "If notepad OR word not on top" statement.

End If

 

Honestly, though, you'll learn a WHOLE lot more by reading the Help files and playing around with the Sample macros came with Macro Express. They're labled samples.mex most likely in your Macro Express folder. There are a lot of them, and they show off a lot of the functionality of Macro Express. Hours of fun and education.

 

Plus, the macro express website has tons of user-made macros free to download. They are extremely useful for learning how to build macros of your own. Some of them may even be perfectly suited for your own needs. You can find them here: http://www.macros.com/share.htm

 

Because of text-wrapping issues on the forum, I won't put the actual code in a codebox, but I will attach the full macro so you can import it.

Complex_If_Then.mex

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...