Jump to content
Macro Express Forums

Your "best" Macro Express script


Recommended Posts

Having been on this forum for years, it's clear the forum draws individuals who really "get" and depend on Macro Express. To the other contributors to this forum, I ask: What is your best Macro Express script? Perhaps the question should be, what is your most useful script? "Useful" might mean that the script...

 

... is the one you activate regularly.

... is the one that you absolutely rely on.

... saves you time. (How much time?)

... saves you effort.

... took considerable effort to develop.

... fixes a bedevilling computer problem or inconsistency.

... is one you are proud of.

... is elegant, or clever, or surprisingly simple.

 

In responding, consider including code snippets, describing the challenges you faced while developing the script, and sharing the "back story" of your script -- for example, what circumstances led you to consider writing the script?

Link to comment
Share on other sites

I have written some very complex and powerful macros. A hospital back east had banks of computers running a macro I wrote around the clock for years. But the two that I have gotten the most use out of are simple.

The first one simply types a date stamp. I use it in file names, notes on task, and dozens of other places. I'm amused at how often that's useful

The second is a task tracking number. I type "TTN..." and it looks up the last number, increments it, and types out something like "TTN4521". I create tasks in Outlook with this in the subject, tag emails, time logs, task folders, and many other things. Later it's easy to find all relevant correspondence, file, whatever. And I have another "TTNR" which re-types the last number.

Funny that I've written so many complex and powerful macros, and yet this is what I use most.  Of course when professionally developing macros, one doesn't use those oneself. 

On a related note, I don't write as many macros as I did. I have been programming now for years and when it comes to automating most things, a proper program is better. Like web scraping. MEP is just not suited for that kind of stuff. But what MEP is great at is things like this. The little macros that save seconds a hundred times a day. Also things that are semi-automatic. Like a macro to file a PDF file from a scan where the user has to answer some questions and the macro blasts though all the menus and dialogs. One just can't beat it for things like that. 

  • Like 1
Link to comment
Share on other sites

That's a difficult one! No single macro would warrant the title of 'my best' and if I compiled a short list of 'most useful' from the couple of thousand I've written it would cover a wide spectrum.

Used up to scores of times a day

- Sizing and positioning windows (mainly File Explorer folder)

- Opening frequently used folders

- Typing frequently used text with shortkeys (file and folder paths, signatures, email addresses, my name and address, phone numbers, regular phrases like 'Best wishes', etc)

- Typing date & time with shortkey '=dt' Wednesday 7 August 2019, 1402

- When saving a series of files (such as when browsing images or text etc that I need for videos), a click close to the right of 'Save As...' (or variations) saves it as xyz-05 if the previous was xyz-04

-  In all my applications, middle clicking its title to display a menu of macros, sometimes via subfolders

- When creating a Text Box Display command, generate 'VariableName = ' to the left of '%VariableName%' with a single click

-Etc

 

Infrequently used but invaluable

- During my frequent work in Google Earth, Google Maps, Memory-Map, etc: finding/copying/moving places and tracks between them; changing properties of multiple tracks, etc

- On average once or twice a week, but many more directly after a walking holiday: from the GPX file of a walk recorded on my iPhone, automatically creating an Excel spreadsheet like that I showed in the recent thread about VBA, plus a profile like this: https://www.dropbox.com/s/63dwbplk410mj80/20190709Falmouth-Portscatho-r483-m6.7-PS.jpg?raw=1

(That's one of my most complex macros, calling a dozen submacros, some of which use VBA and some use Python scripts I've written in PaintShop Pro. I'd say it's probably the one I'm most proud of.)

One of Cory's, with only minor adaptation by me: 'Search and report on macro text'.

- Etc

 

--------------------

 

I'd like to have used the 'Last run time' column to give a more objective reply on the first category, but

(a) It doesn't include submacros

(b) It gets destroyed when a new version is installed

 

 

 

  • Like 1
Link to comment
Share on other sites

I constantly use two ShortKey macros to insert the full path to folders that I need to access regularly.

 

I use the comma as a prefix for my Shortkey macros. So when I type...

 

,alan

 

Macro Express outputs:

 

C:\Users\Work\Documents\Alan\

 

And when I type...

 

,pix

 

Macro Express outputs:

 

C:\Users\Home\Documents\Pictures\

 

I use these macros to quickly navigate through folders on my computer without the need to click anything. For example, I type the ShortKey codes in the "Address" field in Windows Explorer, and in the "File name" field in the "Open" or "Save As" dialog boxes.

 

Then I have two choices: press Enter to jump to the folder; or manually type the name of the folder I actually want to go to, and then press Enter. E.g.,

 

C:\Users\Home\Documents\Pictures\2019

Link to comment
Share on other sites

One frustration – not really the fault of ME – is the unpredictable time it takes for a copy-to-clipboard command to finish.  The ME solution is to set a clipboard delay in “Preferences”, presumably allowing the command to finish.   A short delay – even a long delay – always winds up being too short in rare instances; and a long delay wastes a lot of user time.  My most useful macro, below, is called by other macros wherever an inline Clipboard Copy would otherwise be used.  In ME “Preferences” the clipboard delay is specified as zero.  

 

The macro finishes almost instantaneously when the clipboard copy is fast; and waits patiently for over a second when the clipboard copy is slow.  My concern when writing the macro was, that Windows would return a non-null but still incomplete clipboard value, so the macro would return to caller with only part of the intended data.  In practice that has never happened, and I have been using it exclusively for years with never a problem.  

 

//   
// Set clipboard to nulls -- check to make sure it happens
Clipboard Empty
Repeat Start (Repeat 10000 times)
  If Clipboard Text Equals ""
    Repeat Exit
  Else
  End If
Repeat End
// Copy to clipboard (CTRL-c)
Clipboard Copy
// Loop until clipboard is non-null, that is, copy to clipboard has completed.  Since the value
// to be copied may in fact BE null, we limit the loop to a nominal 1 second, then quit, leaving it null.
// (Due to overhead, the actual loop time will be more like 2 seconds than 1.)
Repeat Start (Repeat 100 times)
  Delay 10 Milliseconds
  If Clipboard Text Equals ""
  Else
    Repeat Exit
  End If
Repeat End
// Return to caller
Macro Return
//   

 

  • Like 1
Link to comment
Share on other sites

2 hours ago, acantor said:

I constantly use two ShortKey macros to insert the full path to folders that I need to access regularly.

I do something similar for my credit card number, so when I am online-ordering something I don't have to go get the card and look it up.  I have refrained from putting the macro on my wife's computer. 

  • Haha 1
Link to comment
Share on other sites

I have a macro similar to yours. Mine outputs certain personal information I need to type regularly, and also displays related information in a floating text box. If this were a credit card number, the "related information" might include name on the card, expiry date, etc.

 

I have password-protected mine!

 

// Delay to allow macro to delete Shortkey text...
Delay: 3000 milliseconds
Text Type (Simulate Keystrokes): 1234567890-QWERTY-00001
// Delay to allow macro to completely insert text
Delay: 250 milliseconds
Text Box Display: Expiry date, and other info 

 

 

Link to comment
Share on other sites

  • 2 weeks later...

I have a Macro Express script that automatically logs in to an Outlook.com account. I sometimes use my computer in places that have spotty internet access. I've also noticed that Outlook.com is sometimes down, not available, or slow to respond.

 

So I adapted the script to perform two steps at the top:

 

1. Check if there is an internet connection, and

2. Establish that there is a connection to the Outlook.com server.

 

The part of the script that does the actual log in is quite complex, so the two steps (above) stop the script before the complex part is reached, with an explanatory message. Before I added these two tests, my script sometimes froze the computer as it tried to log in when logging in was impossible.

 

// Check if the computer is connected to the internet
Text Box Display: Outlook.com status
If Online
  Break // The computer is on line, so script can proceed...
Else
  Text Box Close: Outlook.com status
  Text Box Display: Computer is not connected to the internet
  Macro Stop
End If
 
// Ping outlook.live.com server to discover if it's available...
Text Box Update: Outlook.com status
If Ping Successful outlook.live.com
  Break // The server is available, so script can proceed...
Else
  Text Box Close: Outlook.com status
  Text Box Display: Outlook.com server is not available
  Macro Stop
End If
 
.... 

 

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...
×
×
  • Create New...