Page 1 of 1

Automatically add new file to current wrkspace

Posted: Wed May 30, 2012 6:43 pm
by *Baby*
Hi,

My question is very easy.

I have a workspace with a project.

I would like to know if it is possible to configure Zeus so that I don't need to drag and drop new files in the project ?

In others word, when I create a new file in my project directory, I want that its is automatically added to workspace.

Thanks

Posted: Thu May 31, 2012 2:58 am
by jussij
I would like to know if it is possible to configure Zeus so that I don't need to drag and drop new files in the project?
One other way to add a file to the workspace is to right click on the project and use Add current file to project option from the popup menu.
I want that its is automatically added to workspace.

Unfortunately at this time there is no way to automatically do this :(

But I will put this feature request on the Zeus list of things to todo.

Cheers Jussi

Posted: Sat Jun 02, 2012 1:04 pm
by *Baby*
Ok Thanks.

Yes it will be very fine if we can have a checkbox or something like that in one of the configurations menu to tell Zeus to automatically add new files to the project.

The best thing will be to have a main directory project. For example I tell to Zeus that my project directory is "C:\MyProject". So, Zeus add automatically all sub-directory and files that are in this project directory.

When new files are created IN THIS project directory, there are automatically added to the project.

Posted: Tue Jun 26, 2012 3:27 am
by jussij
The latest Zeus release adds file save as triggers to the Options, Editor Options, Triggers panel.

You can use a postfix file save as trigger to add any newly created and saved files to any given project or folder.

A typical event_filesaveas_postfix.lua macro trigger is shown below:

Code: Select all

function key_macro()
    local details = ""

    -- these are the arguments passed in by Zeus
    -- for i = 1, argc(), 1 do
    --     details = details .. "      " .. argv(i - 1) .. "\n"
    -- end
    --
    -- display the details
    -- message_box(0, "This is the new file create macro." .. "\n\nArguments passed in:\n\n" .. details, "Zeus Trigger Event")

    -- look for an open workspace
    if (is_workspace_open() == 1) then

      -- get the active project
      local project = project_active()

      -- must have an active project
      if string.len(project) > 0 then
        -- get the file name
        local file_name = argv(0)

        --message_box(0, "File: " .. file_name .. " Project: " .. project, "Zeus Trigger Event")

        -- add the file to the active project
        project_file_add(project, file_name)

        message("'" .. file_name .. "' text added to '" .. project .."'")
      end
    end
end

key_macro() -- run the macro
Cheers Jussi