Hi all,
I have an issue that's been at a dead stop for 2 days now.
Prior to my arrival at my job, someone wrote a python script to process some data files. What the script actually does is irrelevant. But the way it was written, the user would start the python exe and then copy>paste the folder and filename into the command shell, then hit enter twice to complete the process. (IMHO, bad design. But that's also irrelevant.) I am still learning python, so I figured I would create a quick macro as a short term solution.
Thinking I could speed things up for the literally hundreds of files that are needed to be processed manually each month, I wrote a macro that (when finished) would automate the process and move the output to the correct folders, then enter relevant numbers into the tracking workbook that contains the macro.
I have the process built to navigate to the relevant folder then filter and find the files that need to be processed. The rest of the logic to move the output around is fairly direct and simple. All I need now is a way to replicate the Paste>Enter>Enter process the user does.
I have tried a simple Shell() for the python command line with "i-" and the filename appended. Window opens, nothing else happens. I have tried multiple permutations of things I have found on the web, to no avail.
Does anyone out there know of a way to paste a value into a command shell then hit Enter twice?
TIA
ATroxell
I have an issue that's been at a dead stop for 2 days now.
Prior to my arrival at my job, someone wrote a python script to process some data files. What the script actually does is irrelevant. But the way it was written, the user would start the python exe and then copy>paste the folder and filename into the command shell, then hit enter twice to complete the process. (IMHO, bad design. But that's also irrelevant.) I am still learning python, so I figured I would create a quick macro as a short term solution.
Thinking I could speed things up for the literally hundreds of files that are needed to be processed manually each month, I wrote a macro that (when finished) would automate the process and move the output to the correct folders, then enter relevant numbers into the tracking workbook that contains the macro.
I have the process built to navigate to the relevant folder then filter and find the files that need to be processed. The rest of the logic to move the output around is fairly direct and simple. All I need now is a way to replicate the Paste>Enter>Enter process the user does.
I have tried a simple Shell() for the python command line with "i-" and the filename appended. Window opens, nothing else happens. I have tried multiple permutations of things I have found on the web, to no avail.
Does anyone out there know of a way to paste a value into a command shell then hit Enter twice?
TIA
ATroxell
Code:
Sub pythonProcess()
listfiles GetFolder 'Contains navigation interface to select relevant folder and populate vaArray()
For x = 1 To UBound(vaArray)
Shell "\\server\utilities\dist\executables\program.exe -i " & vaArray(x)
Application.Wait Now + TimeValue("0:00:03")
Next x
End Sub