Hello all,
First off, in a nutshell of what I am trying to accomplish is rather simple:
-
Copy the contents (a chemical formula) within an Excel (2016) cell, and then tabbed over one cell to the right.
-
Switch over to a software named MarvinSketch (a chemical structure drawing software) and paste the contents from excel.
-
Format the pasted Excel contents within MarvinSketch (consisted of a series of clicks), and then selecting "save as" to save the file into a dedicated folder for all of the samples within the spreadsheet.
-
Switch back over to Excel and copy the cell contents, which is my file name I'll be using to save my structure in MarvinSketch (don't forget I tabbed one cell to the right before switching apps in step 1 of this list). Then I moved the selected cell position to where I will start this process over again but for the next sample.
-
Finally, switch back over to MarvinSketch and paste the file name within the "save as" box, hit the return keystroke, and clear the canvas for the next sample's input.
-
The kicker is, I need to repeat (loop) these steps (my macro) 168,400 times.
FYI: just in case you were wondering what my logic was for using the green and red colors:
-
Green = Actions executed within Excel
-
Red = Actions executed within MarvinSketch
My intention was for it to be easier to read by breaking the actions up by the app in which the actions were being executed.
So, now you know the steps and rough idea of what I'm doing, the problem I am faced with is when I try to repeat this 168,400 times I can't get past 100 repeats without the copying and paste action proceeding ahead of the "Pause Until Application is at the Front" commands I set for the macro. Ultimately, forcing me to stop and start the macro over.
I searched the Google Machine far and wide to see if anybody was having similar problems with the copy and paste actions when using a rather large repeat value, such as 168,400. The best explanation I could find to explain why Copy/Paste wasn't waiting until my app was at the front and ready to be pasted to, is I wasn't giving KM an additional pause along with my "Pause until" command right next to each other, which in my opinion causes a messy redundancy.
I tried this suggested solution of adding longer duration pause to my macro, but no such luck. However, I was still kind of convinced that my iMac could possible be getting bogged down with all of the applications up and running (even though I'm working from a 2015 iMac 27" 5K Retina {; 4.0 GHz i7, and 32 GB of RAM})
The last big approach I took in attempt to solve this was I separated the one spreadsheet containing the 168,400 samples into ~34 individual spreadsheets containing only 2,000 samples each.
This didn't ultimately help either because even though I was able to get through ~600 samples until it started acting up again, I checked to see how many of the 600 samples actually processed and got saved correctly... and long story short; because I saved them all in one folder I used "⌘ + a" to select all of the files within the folder and opened up the "Get info." window and it turns out that only 559 was actually saved to the folder.... So, I'm not even sure if those 559 files that did get saved, was actually saved correctly....
So, I'm not really sure what to do next in terms of getting the macro to function the way I need it to, so I'm reaching out to the awesome KM community to see if anybody would have suggestions, questions, comments, etc. about my macro, I would tremendously appreciate it!!
I apologize about the pretty extensive post, but if a video demonstration is something that would help, I will be more than happy to record and share it as long as somebody can tell me how to upload it lol
Again, sorry about such a long explanation, but this has been driving me crazy for quite some time now, and I really need a different or a more experienced perspective!
Thanks again!
Copy-Paste & Save Peptide Structures into MarvinSketch.kmmacros (34 KB)