terrypin Posted November 27, 2020 Report Share Posted November 27, 2020 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. Quote Link to comment Share on other sites More sharing options...
acantor Posted November 27, 2020 Report Share Posted November 27, 2020 Hi Terry, I tried to replicate this problem of importing macros via a USB stick, but was unable to. I also chose AttributeChangeDateFromShed.mex as the name of the file. Quote Link to comment Share on other sites More sharing options...
terrypin Posted November 27, 2020 Author Report Share Posted November 27, 2020 Thanks for testing anyway Alan; very puzzling! Quote Link to comment Share on other sites More sharing options...
Samrae Posted November 30, 2020 Report Share Posted November 30, 2020 This is not a valid file path: On 11/27/2020 at 4:27 AM, terrypin said: M:\\AttributeChangeDateFromShed.mex Try this instead: M:\AttributeChangeDateFromShed.mex Quote Link to comment Share on other sites More sharing options...
terrypin Posted November 30, 2020 Author Report Share Posted November 30, 2020 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! Quote Link to comment Share on other sites More sharing options...
acantor Posted December 1, 2020 Report Share Posted December 1, 2020 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! Quote Link to comment Share on other sites More sharing options...
Samrae Posted December 1, 2020 Report Share Posted December 1, 2020 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 ":\" 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.