Page 1 of 1

Detect whether XY needs saving

Posted: 14 May 2015 18:57
by klownboy
I was working on a script which ask the question at the end whether the user would like to save settings, but I'd like not to ask the question if the user didn't make any changes (in this case to List management items which cover a number of different types of savesetting options). Obviously this would have to be based on the user having made no changes to XY prior to starting the script or a save being done prior to the running the script. Is there any current way to detect via scripting whether XY setting have changed and therefore need to be saved? Don of course senses changes and the button for save changes from green to brown, but can we do that in scripting? I may have missed something running through help file, but it might be a useful capability in scripting possibly via the SC get ("savesettings") and it would return a parameter for the setting that changed similar to the SC savesettings parameters. If that's not possible at least a "0" or "1" for any type change triggering a save. Thanks.

Re: Detect whether XY needs saving

Posted: 14 May 2015 20:07
by kunkel321
"Don senses..." LOL. :titter:
TED Notepad puts a "dirty flag" (I guess that's what you call it) by appending an asterisk to whatever is in the window title bar. The * goes away once the text file has been saved. I support that would be less applicable to a file manager, than it is to a text editor though...

Re: Detect whether XY needs saving

Posted: 14 May 2015 20:40
by TheQwerty
kunkel321 wrote:TED Notepad puts a "dirty flag" (I guess that's what you call it) by appending an asterisk to whatever is in the window title bar. The * goes away once the text file has been saved. I support that would be less applicable to a file manager, than it is to a text editor though...
Don does something similar to the toolbar button and File | Settings Special menu.

In fact I thought it might be possible for a script to detect this by looking up the captions for those commands but Get('MenuCaption', 193);, etc. don't include the asterisk.

Re: Detect whether XY needs saving

Posted: 14 May 2015 20:57
by admin
Note that this asterisk (and the TB Save Settings button green/brown) is not exact science. Not every dirt is registered. Therefore I hesitate to expose this.

Re: Detect whether XY needs saving

Posted: 14 May 2015 21:59
by klownboy
TheQwerty wrote:Don does something similar to the toolbar button and File | Settings Special menu.
Yes, which is essentially what you see when you right click on the save button - an asterick adjacent to the specific setting which has been modified and needs saving. So similar to what you're were thinking, ::button "savesett", 2; will give you the menu and display the asterisk (if any), but I don't think it's possible to detect which one it is or even if it is present.

Don I didn't want to expose any deep dark secrets :wink: , but thought it would be nice from a scripters point of view only to be able to detect whether a save is necessary.

Re: Detect whether XY needs saving

Posted: 15 May 2015 08:36
by admin
What I wanted to say: There is no reliable information.

Re: Detect whether XY needs saving

Posted: 15 May 2015 13:39
by klownboy
Thanks Don, though we talked about specific save settings areas like save servers or tags, I would have been happy with using the same flag that you use to turn green to brown on the savesett button to give a general return of "1" or "0" using that same "unreliable" information. :)

Re: Detect whether XY needs saving

Posted: 15 May 2015 17:23
by bdeshi
the save-settings button tooltip/caption also says how many changes are unsaved.

Re: Detect whether XY needs saving

Posted: 15 May 2015 18:04
by klownboy
SammaySarkar wrote:the save-settings button tooltip/caption also says how many changes are unsaved.
Wow, yes I forgot about that. Now if we could only capture that I could make some use out of it (i.e., if the save changes number is ≥ "1" » Bingo). RIP BBK - the thrill is gone! :(