Run Executable Inside Zeus Using Python

This forum allows you to share scripts with other Zeus users. Please do not post bug reports, feature requests or questions to this forum, but rather use it exclusively for posting scripts or for the discussion of scripts that have been posted.
Post Reply
jussij
Site Admin
Posts: 2449
Joined: Fri Aug 13, 2004 5:10 pm

Run Executable Inside Zeus Using Python

Post by jussij » Mon Jun 18, 2012 5:04 am

Code: Select all

#
#        Name: Process
#
#  Decription: Run a executable inside Zeus using Python and capture
#              the output.
#

import os
import zeus
import subprocess

def key_macro():
   #
   # http://docs.python.org/library/subprocess.html
   #

   # set the current directory
   os.chdir("c:/temp")

   # initialise the startup info to run hidden
   info = subprocess.STARTUPINFO()
   info.dwFlags |= subprocess.STARTF_USESHOWWINDOW
   info.wShowWindow = subprocess.SW_HIDE

   # run a command and capture the output
   p = subprocess.Popen(["cmd.exe", "/k", "dir *.*"], stdout=subprocess.PIPE, startupinfo=info)
   result = p.stdout.read()
   p.wait()

   # display the output
   zeus.message_box(0, result, "Python Process Output")

key_macro() # run the macro

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: No registered users and 0 guests