Page 1 of 1
Empty Project Macro Tags
Posted: Fri Jan 04, 2013 5:30 pm
by bniemerg
I'm trying to pass my active project information to a batch file using the project macro tags and they all appear to be empty.
The tags I'm referring to are:
$ProjectBase or $PB
$ProjectDir or $PD
$ProjectDrive or $PDR
$ProjectDriveDir or $PDD
$ProjectFile or $Pf
I am using Zeus version 3.97j
Thank you.
Posted: Sat Jan 05, 2013 3:03 am
by jussij
There is a macro that can help debug these types of issuse. Just use the Macros, Load menu and load and run the the ztag.lua (or maybe ztag.zm) macro.
I'm not near Zeus at the moment so I am not 100% sure of the macro name.
Cheers Jussi
Posted: Sun Jan 06, 2013 10:23 pm
by jussij
I created the following Lua macro to show how to query the project details via a macro script:
Code: Select all
function key_macro()
local message_text = ""
-- Project file base name (excludes file extension)
message_text = message_text .. "\nProject Base" .. " = " .. macro_tag("$PB" )
-- Project file drive and directory (includes '\')
message_text = message_text .. "\nProject Drive Dir" .. " = " .. macro_tag("$PDD")
-- Project file extension (includes '.')
message_text = message_text .. "\nProject Ext" .. " = " .. macro_tag("$PE" )
-- Project file name
message_text = message_text .. "\nProject File" .. " = " .. macro_tag("$PF" )
-- name of all projects
all_projects = projects()
-- name of the active project
project_name = project_active()
-- files in the active project
files = project_files(project_name, 0, "\\n")
message_text = message_text .. "\n\n"
message_text = message_text .. "\nAll Project Names" .. " = " .. all_projects
message_text = message_text .. "\nActive Project Name" .. " = " .. project_name
message_text = message_text .. "\nActive Project Files:\n" .. files
message_box(1, message_text, "Zeus Macro Tags")
end
key_macro() -- run the macro
For me this macro is working as expected and returning sensible values.
Cheers Jussi
Posted: Wed Jan 09, 2013 2:56 pm
by bniemerg
Posted: Wed Jan 09, 2013 10:04 pm
by jussij
Those links don't show for me
Juts rip up the images and you zeus project file (.zpi) and zeus workspace (.zwi) and send them to me as an e-mail.
Don't put any of your source files into the zip. Just the zwi and zpi files.
Cheers Jussi
Posted: Thu Jan 10, 2013 12:16 am
by jussij
What version of Zeus are you running
When open the project and workspace files that you provided and run the macro I get the expected results as shown below:
Code: Select all
---------------------------
Zeus Macro Tags
---------------------------
.....
Current Dir = E:\testing\
.....
Project Base = Dashboard
Project Drive = E:
Project Drive Dir = E:\testing\662btn\
Project Dir = \testing\662btn\
Project Ext = .zpi
Project File = E:\testing\662btn\Dashboard.zpi
---------------------------
OK
---------------------------
Posted: Thu Jan 10, 2013 2:29 am
by bniemerg
3.97j
Posted: Thu Jan 10, 2013 3:06 am
by jussij
Silly me. You mentioned that earlier in the thread
What happens if you run the
test.lua code:
Code: Select all
function key_macro()
-- create a new file
FileNew();
local message_text = ""
if is_workspace_open() then
-- Project file base name (excludes file extension)
message_text = message_text .. "Project Base" .. " = " .. macro_tag("$PB" )
-- Project file drive and directory (includes '\')
message_text = message_text .. "\nProject Drive Dir" .. " = " .. macro_tag("$PDD")
-- Project file extension (includes '.')
message_text = message_text .. "\nProject Ext" .. " = " .. macro_tag("$PE" )
-- Project file name
message_text = message_text .. "\nProject File" .. " = " .. macro_tag("$PF" )
-- name of all projects
all_projects = projects()
-- name of the active project
project_name = project_active()
-- files in the active project
files = project_files(project_name, 0, "\\n")
message_text = message_text .. "\n"
message_text = message_text .. "\nAll Project Names" .. " = " .. all_projects
message_text = message_text .. "\nActive Project Name" .. " = " .. project_name
message_text = message_text .. "\n\nActive Project Files:\n" .. files
else
message_text = "No workspace currently open!"
end
write(message_text)
end
key_macro() -- run the macro
Cheers Jussi
Posted: Thu Jan 10, 2013 3:30 am
by jussij
Ok, I think I know what might be happening.
Over the years this project details macro tag has taken on different meanings.
For example in earlier versions of Zeus there was no concept of a workspace only a single project, so at that time this tag meant the details for that one and only project.
With the advent of the workspace containing multiple projects that had to change.
In the Zeus that I'm running (which is the latest version) this macro tag refers to the details found in the Workspace Options, in the General panel, in the Project Make File field.
So what I suggest doing is putting something into that field and seeing what happens when you run the macro.
Cheers Jussi
Posted: Thu Jan 10, 2013 5:45 am
by jussij
Further on this issue. I'm now quite confident that all you have to do is add your project details into the Project Make File field found in the the General panel located using the Workspace Options menu.
Cheers Jussi
Posted: Thu Jan 10, 2013 4:45 pm
by bniemerg
Adding the project name to the Project Make File field worked.
Thank you!