jamesd1 Posted October 28, 2016 Report Share Posted October 28, 2016 I have a macro that periodically checks for new downloaded videos in as certain directory and then processes them and moves them to a new directory. It works fine except that occasionally the macro runs at the same time that a video is currently downloading and when it tires to move the unfinished download that, of course, doesn't work and popups up a "file in use error" window. Pressing tab and return skips the moving of the vid so the macro continues processing, which is what I want. But I'm not sure how to build a function into the macro that recognizes this pop-up when it occurs so it can automatically skip the in-use video with a Tab Return key combo. Quote Link to comment Share on other sites More sharing options...
Samrae Posted October 31, 2016 Report Share Posted October 31, 2016 Check out the "If File Ready" and "Wait for File Ready" commands. These commands determine if an application has finished writing to a file. Quote Link to comment Share on other sites More sharing options...
jamesd1 Posted October 31, 2016 Author Report Share Posted October 31, 2016 I understand the concept, but how and where do I insert the If File Ready logic and Wait for File Ready into a macro that is trying to move all of the video files in a directory from one place to another? Typically, it will have perhaps moved three files and on coming to the 4th files that is not ready I would get the error. Quote Link to comment Share on other sites More sharing options...
Samrae Posted October 31, 2016 Report Share Posted October 31, 2016 If File Ready Copy File or Files: AFile.avi End If If you show us how your macro moves files we can be more specific. Quote Link to comment Share on other sites More sharing options...
jamesd1 Posted October 31, 2016 Author Report Share Posted October 31, 2016 I have two Macros that are of the form:"Move File or Files" with the *.* parameter so it moves all the files in a directory. There might be 4 files in the dir and 3 might be ready to move while the 4th is not yet ready. Quote Link to comment Share on other sites More sharing options...
Samrae Posted November 1, 2016 Report Share Posted November 1, 2016 Something like this may work. Repeat with Folder If File Ready "%T1%" Move File or Files: "%T1%" End If Repeat End Quote Link to comment Share on other sites More sharing options...
jamesd1 Posted November 1, 2016 Author Report Share Posted November 1, 2016 I'm only vaguely familiar with use of variables in Macro Express; cook-book stumbled through the process two times years ago. What variable goes in the T1 and how do I define it? Quote Link to comment Share on other sites More sharing options...
jamesd1 Posted November 1, 2016 Author Report Share Posted November 1, 2016 Is there another method to use that would detect the pop-up error window so I could just Macro Express keystrokes to skip/dismiss the pop-up any time it occurred? I can't look inside Macro Express to see how to identify the window because Macro Express is running when the error occurs and so I can't call it up to see how to identify the pop-up. Quote Link to comment Share on other sites More sharing options...
Samrae Posted November 1, 2016 Report Share Posted November 1, 2016 I'm only vaguely familiar with use of variables in Macro Express; cook-book stumbled through the process two times years ago. Use of variables is key to powerful macros. What variable goes in the T1 and how do I define it? The variables T1 through T99 are string variables. The Repeat with Folder command will put the name of a file in T1 each time it loops. It will loop once for each file in the specified folder. If you have questions, try it. Quote Link to comment Share on other sites More sharing options...
Samrae Posted November 1, 2016 Report Share Posted November 1, 2016 Is there another method to use that would detect the pop-up error window so I could just Macro Express keystrokes to skip/dismiss the pop-up any time it occurred? Not with Macro Express 3. Perhaps with Macro Express Pro. Quote Link to comment Share on other sites More sharing options...
acantor Posted November 27, 2016 Report Share Posted November 27, 2016 Macro Express Pro supports error trapping, but I'm not sure that will be the best way to script this. I think you are good to go with Macro Express 3. But the time has come for you to get a handle on variables. And possibly the "repeat with folder" command. It's worth the effort to get comfortable with variables. A nice learning project is to assign a variable to a value, modify the value, and then display it. Maybe something like this, in pseudo-code: T1 = "Hello my name is ME" Modify T1: Replace every " " (space) in T1 with "" (nothing) Message Box T1 Result: HellomynameisME 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.