Run program via python script

A forum for general discussion of the Python programming language.

Run program via python script

Postby CiaoNataha » Wed Aug 21, 2013 4:10 am

Hello dear,

I' working under Windows and not have another possibility (Linux, Ubuntu, Mac) because of interested me program Thermocal that installed on Windows in my office.

I wrote the python script which creates the (1) file and then I want (2) to open via python script the program Thermocal and then (3) Thermocalc must open already created file by python script and execute it. I'm blocked with step 3. Python has the command line. Thermocal has own command line. I don't have the terminal. Once I open Thermocalc via Python (throught run option) I want also via python script to write down in Thermocal command line the command 'micro-file-open'. Is it possible?
Code: Select all
def run_tc(macro,savedir):
   #Open Thermocalc and execute macrofile, and save results in savedir
   folder=r"C:\Users\Thermocalc\3.0"
   os.chdir(folder)
   os.startfile("Thermo-Calc-3.0.exe")
  #Now, I want to write down Thermocal command line the command m_f_o
  #And open macro   file
CiaoNataha
 
Posts: 2
Joined: Wed Aug 21, 2013 3:53 am

Re: Run program via python script

Postby metulburr » Wed Aug 21, 2013 5:03 am

I' working under Windows and not have another possibility (Linux, Ubuntu, Mac) because of interested me program Thermocal that installed on Windows in my office.

I wrote the python script which creates the (1) file and then I want (2) to open via python script the program Thermocal and then (3) Thermocalc must open already created file by python script and execute it. I'm blocked with step 3. Python has the command line. Thermocal has own command line. I don't have the terminal. Once I open Thermocalc via Python (throught run option) I want also via python script to write down in Thermocal command line the command 'micro-file-open'. Is it possible?

wow, no offense, this sounds like a mix of not enough information and gibberish. State clearly what you are asking for, and the problem you are running into.

#Now, I want to write down Thermocal command line the command m_f_o

huh?
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1501
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Run program via python script

Postby Mekire » Wed Aug 21, 2013 5:09 am

I too, can hardly tell what you are trying to say. I imagine however that your solution is likely using the subprocess module to execute your Thermocal script with appropriate arguments; collect the result; and save it to a file. This is a fairly blind guess though.

-Mek
User avatar
Mekire
 
Posts: 1012
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: Run program via python script

Postby CiaoNataha » Wed Aug 21, 2013 6:04 am

I want run Thermocal program via Python script and then, just give to this program (also via Python script) the command (micro-file-open) to open the file.
CiaoNataha
 
Posts: 2
Joined: Wed Aug 21, 2013 3:53 am


Return to General Discussions

Who is online

Users browsing this forum: W3C [Linkcheck] and 3 guests