Jump to content
Macro Express Forums

Minor gotcha when importing a macro from USB drive?


Recommended Posts

I needed to get a macro I wrote yesterday on my ancient shed workshop PC to this Win 10 PC in my house office. I exported it to a USB stick where it was called

M:\\AttributeChangeDateFromShed.mex

 

Surprisingly it failed, giving the message "The filename is not valid."

 

After some experiment I discovered that it works OK if I placed the file instead in

M:\From Shed\AttributeChangeDateFromShed.mex

 

So looks like it only fails if placed at the root level.

 

Link to post
Share on other sites

Thanks @Samrae, you've solved the puzzle. I use a 15 or 20 year old hotkey macro to place the full path and filename of any selected File Explorer file onto the clipboard. That turns out to be the cause of the inconsistency. It had a few lines built in to handle files in the root which otherwise misbehaved:

 

If Variable %tFolder% Equals "C:\"
  Variable Modify String: Replace "\" in %tFolder% with ""
End If

 

But C was the only root for which I'd eliminated the double '\\' . Looks like I've never before used the macro on any other, or if I did it never caused trouble!

 

Link to post
Share on other sites

Hi Terry,

 

Glad you sorted it out. Your example is instructive, and illustrative. Once every blue moon, I discover a macro, created eons ago and proven reliable through hundreds or thousands of repetitions, begins to fail or misbehave.

 

A review of the code sometimes reveals things that nobody could have anticipated, e.g., a software maker changed a default hotkey or the title bar text.

 

And sometimes a code review exposes embarrassing things about my earlier conceptions of how to best use Macro Express!

Link to post
Share on other sites
21 hours ago, terrypin said:

Thanks @Samrae, you've solved the puzzle

 


If Variable %tFolder% Equals "C:\"
  Variable Modify String: Replace "\" in %tFolder% with ""
End If

 

 

 

You're welcome. Perhaps you could add something like this:

Variable Modify String: Replace ":\\" in %tFolder% with ":\"

 

  • Thanks 1
Link to post
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...