Jump to content
Macro Express Forums

Capturing full path after a save?


Recommended Posts

I thought this would be simple but I'm struggling a bit. My macro saves a file, let's call it %UserFile%, letting the user browse to the required location. But how do I capture that path please, so that I can immediately open the same file in another application?

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

You have to take it a different way. You need to prompt the user for a folder to save in and save that as a string then prompt the user for a file name in a Variable Set String Prompt. Then merge them. Quite simply one can not use the file picker for a file that doesn't exist.

 

Don't forget to add a loop that check to make sure the file doesn't already exists or at least warns the user.

Link to comment
Share on other sites

You have to take it a different way. You need to prompt the user for a folder to save in and save that as a string then prompt the user for a file name in a Variable Set String Prompt. Then merge them. Quite simply one can not use the file picker for a file that doesn't exist.

 

Don't forget to add a loop that check to make sure the file doesn't already exists or at least warns the user.

 

Thanks Cory, understood. OK, that's disappointing. The standard Windows saving procedure is so familiar and robust that it's a pity to have to duplicate it. I was hoping there would be a command or clever routine that would let me identify the folder in which the save was being made (or in which the last save had just been made). I thought at first that the Current Folder would change, but apparently not. Oh well ... I may raise this as a feature request in that case.

 

It's very timely that you mentioned the File Exists issue. I've been puzzling over the best way to deal with that last night. Of course, it depends on how I do the save procedure. But suppose I persist with using the standard Windows routine, using ME Pro to specify the filename and letting the user browse to the location. (Leaving aside the problem that ME Pro then doesn't know the full path). If the macro then clicks Save (or keys Enter) and the file already exists, Windows displays a message and asks the user whether to go ahead with the save (over-writing the previous) or cancel. But the macro continues regardless, usually hiding the message, which at best the user only then sees by accident later. What's the recommended way of handling that please? If I add a Pause or Text Display right after the save that would probably make the Windows message visible, but would be a wasteful interruption on the majority of occasions.

 

Edit: I've come up with one way of handling the File Exists issue which seems reasonably unobtrusive. After the preparatory commands (filename, extension type, default path for start of any further browsing) I've inserted a Text Display that says something like "Save the file (including a response to any message about file already existing). Then close this to continue."

 

I'd still appreciate any other suggestions on this side issue please, as well as any further thoughts on the main topic.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

In some cases I do more complex user friendly routines but usually I just ask for the file name in an infinite loop that keeps repeating until the file name and path they have chosen does not exist. EG If file does not exist, break. Of course this comes with the warning message. It would not be difficult to allow them to overwrite but now you need to test that the file is 'ready'.

 

I have several paperless macros where it's quite possible a user will want to save a file with the same name and all they would ever do is simply make it distinct. For this I have a macro subroutine that does an incrementing routine. Essentially if the file name exists it adds 00001, 00002 and so on. But it's a little tricky because one needs to identify if the names are padded already and such but it works really cool and is invisible to the user.

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...