Passing params to Python exe

Atroxell

Active Member
Joined
Apr 18, 2007
Messages
422
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

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
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,213,496
Messages
6,113,995
Members
448,539
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top