File_Save_Postfix Trigger

If reporting a bug with the Zeus IDE please post the details here. Please do not post questions here.
Post Reply
pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

File_Save_Postfix Trigger

Post by pwdiener » Mon Jul 09, 2012 8:30 pm

Hi, Jussi

Just noticed today that it appears that the file save trigger (I'm using postfix, didn't check the prefix) does NOT file on a Save As - is that by design?

My scenario is to create an editted copy of a file via Save As. Since I usually do the Save As, then edit and Save, this is not a huge problem for me, but if I make my initial (and only) changes before the Save As, it might lead to some head scratching...

Bill Diener

jussij
Site Admin
Posts: 2449
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Tue Jul 10, 2012 12:08 am

Hi Bill,
Just noticed today that it appears that the file save trigger (I'm using postfix, didn't check the prefix) does NOT file on a Save As - is that by design?

Yes this is by design.

The file save postfix trigger will only fire is an existing file that is saved. You appear to be doing a File As.

On a side not, if you have a new 'untitled.txt' file and you do a File Save on that file then Zeus will turn that save into a save as operation.
Since I usually do the Save As, then edit and Save
So in this scenario the original file is never saved or touch and in fact it is removed from the edit session, and a new file with all the edit changes is created by the Save As and added to the edit session.

Now in terms of triggers this is why it works the way it does.

The original file is not touched, changed or saved so no postfix trigger will fire.

The new file that does not exists at the time of the prefix Save trigger so no trigger is possible. There is not a lot point if firing a Save trigger for a file that does not exist.

Also if the postfix Save trigger was in this case then there is no way to tell that you are actually dealing new newly created file.

Hence reason for the new Save As trigger which is effectively a File Create or File New trigger.
this is not a huge problem for me, but if I make my initial (and only) changes before the Save As, it might lead to some head scratching...

I don't understand what you mean by this.

Why doesn't the File Save As trigger give you the correct file name and doen't that file contain all the edit changes :?:

I am missing somethig here.

Cheers Jussi

pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

Post by pwdiener » Tue Jul 10, 2012 1:47 am

No you aren't missing anything, I'm just not being clear and didn't post details about what the event handler was doing. Also, I hadn't realized that there was a Save As trigger, and only wrote a Save postfix handler - that must be new since 3.97c

The event handler is FTPing the file that was just saved to an AS400 to make sure that the source repository there stays in sync with my local copies. I can hardly stand to use the editing tools on the AS400, and unfortunately the file naming conventions make using Zeus's built-in FTP edit support not practical for me. In my case, there is no useful distinction between Save and Create, although in general I can see where there might be.

What I was trying to say is that normally the behavior as implemented would not be a problem for me, given my normal flow as I outlined. However, if I deviate from that by editing, then doing a Save As and expect my changes to show up on the AS400, I will be disappointed and might have a few moments of problem determination before I remember what I did. Given that I can easily solve this with a Save As trigger, there's no problem.

jussij
Site Admin
Posts: 2449
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Tue Jul 10, 2012 3:21 am

Also, I hadn't realized that there was a Save As trigger, and only wrote a Save postfix handler - that must be new since 3.97c

That is correct. The trigger was added in the 3.97l release.

The Save As trigger was added to enable this type of behaviour: http://www.zeusedit.com/zforum/viewtopic.php?t=6654
In my case, there is no useful distinction between Save and Create
This is exactly why the new Save As trigger was added ;)

As I said before, the new Save As trigger is effectively a file create trigger.
However, if I deviate from that by editing, then doing a Save As and expect my changes to show up on the AS400, I will be disappointed

Putting you FTP code in this new File Save As trigger should elliminate this issue.

Cheers Jussi

pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

Post by pwdiener » Tue Jul 10, 2012 3:26 am

That works for me!

Thanks, Jussi

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: No registered users and 3 guests