You are here: PSPad forum > English discussion forum > hook into filesave?

hook into filesave?

#1 hook into filesave?

Posted by: gwinkless | Date: 2016-01-19 11:07 | IP: IP Logged

Hi

Is there any way to hook a plugin function to run every time a file is saved?

Currently when using the EzCTags plugin (incredibly useful, by the way) one must manually rerun ctags over the entire project, which (on large projects) takes a long time and requires user intervention. It would be really nice to be able to run an incremental update for each file as it's saved.

I suppose I could override the ctrl-s key (does that even work?) but if the user clicked "save" from the toolbar or file menu it would end up out of synch.

Thanks!

Geoff

Options: Reply | Quote | Up ^


#2 Re: hook into filesave?

Posted by: pspad | Date: 2016-01-19 11:26 | IP: IP Logged

There is possibility to use FileType plugin. This plugin will be used each time you open file and save file.
It's a DLL with 3 exported functions

See the PSPad help / Customize PSPad / Script / FileType plug-ins

Options: Reply | Quote | Up ^


#3 Re: hook into filesave?

Posted by: gwinkless | Date: 2016-02-01 13:30 | IP: IP Logged

pspad:
There is possibility to use FileType plugin. This plugin will be used each time you open file and save file.
It's a DLL with 3 exported functions

See the PSPad help / Customize PSPad / Script / FileType plug-ins

Yikes! That seems like sledgehammer/nut territory, but I suppose if that's the only way to make it work it will have to do.

Do you have an example project to create a dll that simply saves the file in the same way as pspad would do? Save me having to write the whole thing again smiling smiley

Edit: I suppose I could return an error for PSP_LoadFromFile and PSP_SaveToFile - as per doc "function returns false ... PSPad internal file handling is used" - except then I would have rerun the ctags command _before_ the save occurred (unless I did something clever with scheduling, which isn't particularly pretty).

Thanks

Geoff

Edited 2 time(s). Last edit at 2016-02-01 13:33 by gwinkless.

Options: Reply | Quote | Up ^


#4 Re: hook into filesave?

Posted by: gwinkless | Date: 2016-02-01 14:48 | IP: IP Logged

gwinkless:
I suppose I could override the ctrl-s key (does that even work?) but if the user clicked "save" from the toolbar or file menu it would end up out of synch.

I went for this method.

I would still prefer it if we could hook some script into a "post-save" action, but I'll live with this rather than have to create 10 DLL files along with the level of extra errors that could ensue.

Edited 1 time(s). Last edit at 2016-02-01 14:48 by gwinkless.

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR