key board mapping

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
abushne

key board mapping

Post by abushne »

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.
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

This Lua macro will run a DOS command:

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
You can also do something like this to run a program and capture its output:

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
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
abushne

Post by abushne »

Thanks for the pointer and will search the help as well.
Post Reply