key board mapping
key board mapping
Is there a way in zeus to map shortcut keys to various actions? In particular, I have setup a couple of tools I like to use on the current source file and would find it really handy to be able to associate a keyboard shortcut to launching the tool.
This Lua macro will run a DOS command:
You can also do something like this to run a program and capture its output:
So as you can see it is very easy to write a macro to run any sort of tool and capture it's output. Once you have a macro, all that remains is to bind the macro to the keyboard.
NOTE: For more information on any of the functions used in these macros, place the cursor on the word and use the Zeus Help, Quick Help Search menu.
Jussi
Code: Select all
-- Filename: command.lua
function key_macro()
-- the default command
local nill = "dir *.*"
-- ask for a user for a command line
local cmd = user_input("System Command:", nill)
-- setup command control falgs (see the Zeus Macro help for details)
local flags = 1+2+4+16+32
-- set the default directory
local dir = "c:\\"
-- run command
system(cmd, dir, flags)
end
key_macro() -- run the macro
Code: Select all
-- Filename: program.lua
function key_macro()
-- the file to be compiled
local file_name = macro_tag("$fb") .. macro_tag("$ext")
-- the directoruy of the file
local dir = macro_tag("$fdd")
-- NOTE: You will need to change the command below.
-- run the program and capture the output to a file
local cmd = "c:\\some\\program.exe include " .. file_name .. " > output.txt"
-- run the command hidden
local flags = 16+32
-- this is for debugging only
message_box(1, cmd);
local result = system(cmd, dir, flags)
-- this file should have been created by the program.exe
local file_output = dir .. "output.txt"
-- send the output to a Zeus compiler window
file_open_compiler(file_output, "Forth Compiler")
end
key_macro() -- run the macro
NOTE: For more information on any of the functions used in these macros, place the cursor on the word and use the Zeus Help, Quick Help Search menu.
Jussi