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