I've used Zeus for years but I'm still a nubie -- so excuse me if this is a stupid question. I'm trying to write a macro and I'm also looking to add that macro to the file tab, if possible.
This is what I want to do: Right-click file tab and choose a function: "Close Document and Delete File".
I often find myself creating test files while I'm working on something and by the time I'm done, I have way too many test files (Documents) open in Zeus. I want to be able to clean-up after myself by closing some tabs and having the underlying file deleted as well.
I have been unable to find a macro command to delete a file and I have no idea if a macro could be attached to a file tab (which would not be a big deal if it can't be done).
Is this a stupid idea? Is there some functionality that I'm missing. I very seldom use Workspaces or Source Control so I haven't even looked there for an answer -- I'd rather it be a simple one or two clicks or maybe a key combination (wouldn't be as nice).
Thanks much for any help!
Close tab and delete file
There really is no way to attach a macro to the file tab.This is what I want to do: Right-click file tab and choose a function:
"Close Document and Delete File".
But there is a way to attach a macro to the document window list (View, Document List menu).
In that dialog there is a Run Trigger option and that button will run whatever macro in defined in the Document Listing entry field of the Options, Editor Options menu, Triggers panel.
Code: Select all
I want to be able to clean-up after myself by closing some tabs and having the underlying file deleted as well.
Code: Select all
zScript\event_window_list.lua
Code: Select all
function key_macro()
local items = "These files have been selected for deletion:\n\n"
local indent = " "
for i = 1, argc(), 1 do
items = items .. indent .. argv(i - 1) .. "\n"
end
items = items .. "\n\n"
items = items .. "Are you sure you want to delete these files?"
result = message_box(4, items, "Delete Selected Files")
-- return values from the message box
local yes = 6
local no = 7
if (yes == result) then
-- delete the selected files
for i = 1, argc(), 1 do
file_name = argv(i - 1)
-- activate the window
window_activate_name(file_name)
if os.remove(file_name) == true then
-- close the active window
FileClose()
end
end
message("The selected files have been deleted.")
else
message("Operation cancelled by user.")
end
end
key_macro() -- run the macro
To use the macro all you have to do is:I'd rather it be a simple one or two clicks or maybe a key combination (wouldn't be as nice).
- Alt+B to bring up the Document Window dialog
- Multi-select the files that you want to remove
- Hit the Run Trigger button.