Using the Console2 Inside of Zeus

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

Using the Console2 Inside of Zeus

Post by jussij » Fri Nov 30, 2012 3:57 am

A simple macro to run the Console2 utility from inside of Zeus.

Code: Select all

#--
#        Name: Console2 Lua Script
#
#      Author: Jussi Jumppanen
#
#    Language: Python Macro
#
# Description: This Lua script creates a new Console2 console window from
#              within the Zeus IDE. It will create the console in the same
#              drive and directory of the active file. It will also maintain
#              the current working directory.
#
#                  http://sourceforge.net/projects/console/
#
import os
import zeus
import subprocess

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

   # the installation folder for the Console.exe utility
   cmd = ["C:\\Workspace\\Zeus\\Console2\\Console.exe"]

   # add a caption to the window
   cmd.extend(["-w", "DOS Prompt"])

   # set the current working directory
   cwd = os.getcwd()
   cmd.extend(["-d", cwd])

   # the ditrectory of the active file
   directory = zeus.macro_tag("$FDD")

   if len(directory) > 0:
       # change to the directory of the active file
       os.chdir(directory)

       # add in the directory options
       cmd.extend(["-d", directory])

       # the drive letter excluding the '\' character
       drive = zeus.macro_tag("$FDR")

       # change to the correct drive
       cmd.extend(["-r", "cmd.exe /k " + drive])

   # run the console executable
   subprocess.Popen(cmd)

key_macro() # run the macro

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: No registered users and 34 guests