Hello,
I use Zeus to edit C++ code and created a tool in the Tools menu to help with the source compilation process. The tool is called "Compile" I can execute the tool from the Tools menu successfully but cannot figure out how to add a keyboard shortcut to the tool. I have looked at Options/Editor Options/Keyboard Mappings/Standard menus and can see none to none in the listbox but cannot figure out which one applies to me?!? Any help appreciated.
- Rav.
Creating a Tool's shortcut?
Re: Creating a Tool's shortcut?
The tool is called "Compile" I can execute the tool from the Tools menu successfully but cannot figure out how to add a keyboard shortcut to the tool.
There is currently no way to assign a keyboard key combination to a Tool menu item

However, what you can do is create a macro to run the compiler and have the macro capture the compiler output

Then it is very easy to bind that macro to any keyboard key combination.
As an example find below a example compile.lua Lua macro that runs the Microsoft C/C++ compiler on the currently active file.
It will run the compiler and capture the compiler output in a Zeus compile window.
Just change the details to match you compiler.
Cheers Jussi
Code: Select all
local utils = require "utils"
function key_macro()
local document, named, read_only, document_type = utils.document_details()
if (document == 0) or (named == 0) then
message("This macro only works with named documents.")
beep()
return
end
-- the directory of the current document
local dir = macro_tag("$fdd")
local arguments = ""
message("Running compile on code....")
-- add you command line options here
local cmd_options = "-c"
-- the workspace mode can be set using the toolbar
local filename = macro_tag("$fn")
-- the final build command
local cmd = "cl.exe " .. cmd_options .. " " .. filename
-- NOTE: this is only used for debugging
-- message_box(1, cmd, "Command Line")
-------------------------------------------------------------------------------
-- System Control Values
-------------------------------------------------------------------------------
-- 1 - save the document before running the program
-- 2 - capture any standard output generated by the program
-- 4 - capture any standard error generated by the program
-- 8 - ask for additional arguments
-- 16 - the program will use the MS-DOS command interpreter (ie. dir *.* etc)
-- 32 - wait for the program to complete (the ESC key will cancel the wait)
-- 64 - run the program in a visible DOS session (otherwise runs hidden)
-- 128 - capture output to a compiler window (not the default tool window)
--
-------------------------------------------------------------------------------
-- Output Control Flags:
-------------------------------------------------------------------------------
-- 0 - ALWAYS
-- 1 - NEVER
-- 2 - ERRORS
-- 3 - WARNINGS
-- 4 - ANYOUTPUT
-------------------------------------------------------------------------------
-- display the window if any output is generated
local ANYOUTPUT = 4
-- run with 'save', 'capture output', 'wait' and display results in 'compiler' window
local flags = 1+2+4+32+128
local caption = "Compiling: " .. filename
if (system(cmd, dir, flags, caption, ANYOUTPUT) == 0) then
message("The compile completed succesfully.")
else
message("The compile has errors.")
beep()
end
end
key_macro() -- run the macro
Re: Creating a Tool's shortcut?
A second option is to define the compiler command line inside the document type using the Options, Document Types menu, editing the C/C++ document type and then entering the compiler command line in the Compiler panel.
That compiler command can then be run using the Compile, Compile menu which maps to the CompilerCompile keyboard function which can be mapped to any keyboard key combination.
Cheers Jussi
That compiler command can then be run using the Compile, Compile menu which maps to the CompilerCompile keyboard function which can be mapped to any keyboard key combination.
Cheers Jussi