Page 1 of 1

is there a way to backup toolbar?

Posted: 25 May 2021 11:48
by giuliastar
Hi
is there away to backup toolbar?

my point is to have different toobars ,with different button ,custom and built in icon

well I would like to backup the actual custom toolbar and restore after

thanks

Re: is there a way to backup toolbar?

Posted: 25 May 2021 12:29
by highend

Code: Select all

    // Backup
    $name = input("Toolbar file name", "Without any extension!", "default");
    if ($name) {
        writefile("<xydata>\Toolbars\$name.txt", toolbar(), , 65001);
    }

Code: Select all

    // Restore
    end (exists("<xydata>\Toolbars") != 2), 'No "Toolbars" folder in <xydata>, aborted!';

    $names = listfolder("<xydata>\Toolbars", , 1+4, <crlf>);
    end (!$names), 'No file(s) in "<xydata>\Toolbars", aborted!';

    $names = regexreplace($names, "\.txt$");
    $sel   = popupmenu($names, 6:=<crlf>);
    if ($sel) {
        toolbar(readfile("<xydata>\Toolbars\$sel.txt"));
    }

Re: is there a way to backup toolbar?

Posted: 25 May 2021 18:39
by giuliastar
highend wrote: ↑25 May 2021 12:29

Code: Select all

    // Backup
    $name = input("Toolbar file name", "Without any extension!", "default");
    if ($name) {
        writefile("<xydata>\Toolbars\$name.txt", toolbar(), , 65001);
    }

Code: Select all

    // Restore
    end (exists("<xydata>\Toolbars") != 2), 'No "Toolbars" folder in <xydata>, aborted!';

    $names = listfolder("<xydata>\Toolbars", , 1+4, <crlf>);
    end (!$names), 'No file(s) in "<xydata>\Toolbars", aborted!';

    $names = regexreplace($names, "\.txt$");
    $sel   = popupmenu($names, 6:=<crlf>);
    if ($sel) {
        toolbar(readfile("<xydata>\Toolbars\$sel.txt"));
    }
hi
very nice script , can i save them in the folder Data\Scripts\ with the extension .xys?
i would like to store all the script in the folder Data\Scripts\
to have all the script in a drop list should i use the catalog or is there a way to have all of them just like a list (abd not load always via scripting -> load script file) ?

thanks Highend

Re: is there a way to backup toolbar?

Posted: 25 May 2021 18:46
by Horst
giuliastar wrote: ↑25 May 2021 18:39
highend wrote: ↑25 May 2021 12:29

Code: Select all

    // Backup
    $name = input("Toolbar file name", "Without any extension!", "default");
    if ($name) {
        writefile("<xydata>\Toolbars\$name.txt", toolbar(), , 65001);
    }

Code: Select all

    // Restore
    end (exists("<xydata>\Toolbars") != 2), 'No "Toolbars" folder in <xydata>, aborted!';

    $names = listfolder("<xydata>\Toolbars", , 1+4, <crlf>);
    end (!$names), 'No file(s) in "<xydata>\Toolbars", aborted!';

    $names = regexreplace($names, "\.txt$");
    $sel   = popupmenu($names, 6:=<crlf>);
    if ($sel) {
        toolbar(readfile("<xydata>\Toolbars\$sel.txt"));
    }
hi
very nice script , can i save them in the folder Data\Scripts\ with the extension .xys?
i would like to store all the script in the folder Data\Scripts\
to have all the script in a drop list should i use the catalog or is there a way to have all of them just like a list (abd not load always via scripting -> load script file) ?

thanks Highend
Of course you can.
You can also add the scripts to the left and right click of a CTB.

Re: is there a way to backup toolbar?

Posted: 25 May 2021 18:50
by giuliastar
Horst wrote: ↑25 May 2021 18:46
giuliastar wrote: ↑25 May 2021 18:39
highend wrote: ↑25 May 2021 12:29

Code: Select all

    // Backup
    $name = input("Toolbar file name", "Without any extension!", "default");
    if ($name) {
        writefile("<xydata>\Toolbars\$name.txt", toolbar(), , 65001);
    }

Code: Select all

    // Restore
    end (exists("<xydata>\Toolbars") != 2), 'No "Toolbars" folder in <xydata>, aborted!';

    $names = listfolder("<xydata>\Toolbars", , 1+4, <crlf>);
    end (!$names), 'No file(s) in "<xydata>\Toolbars", aborted!';

    $names = regexreplace($names, "\.txt$");
    $sel   = popupmenu($names, 6:=<crlf>);
    if ($sel) {
        toolbar(readfile("<xydata>\Toolbars\$sel.txt"));
    }
hi
very nice script , can i save them in the folder Data\Scripts\ with the extension .xys?
i would like to store all the script in the folder Data\Scripts\
to have all the script in a drop list should i use the catalog or is there a way to have all of them just like a list (abd not load always via scripting -> load script file) ?

thanks Highend
Of course you can.
You can also add the scripts to the left and right click of a CTB.
hi
but not a drop down list ,right?
thanks Horst

Re: is there a way to backup toolbar?

Posted: 25 May 2021 18:55
by Horst
giuliastar wrote: ↑25 May 2021 18:50
Horst wrote: ↑25 May 2021 18:46
giuliastar wrote: ↑25 May 2021 18:39
highend wrote: ↑25 May 2021 12:29

Code: Select all

    // Backup
    $name = input("Toolbar file name", "Without any extension!", "default");
    if ($name) {
        writefile("<xydata>\Toolbars\$name.txt", toolbar(), , 65001);
    }

Code: Select all

    // Restore
    end (exists("<xydata>\Toolbars") != 2), 'No "Toolbars" folder in <xydata>, aborted!';

    $names = listfolder("<xydata>\Toolbars", , 1+4, <crlf>);
    end (!$names), 'No file(s) in "<xydata>\Toolbars", aborted!';

    $names = regexreplace($names, "\.txt$");
    $sel   = popupmenu($names, 6:=<crlf>);
    if ($sel) {
        toolbar(readfile("<xydata>\Toolbars\$sel.txt"));
    }
hi
very nice script , can i save them in the folder Data\Scripts\ with the extension .xys?
i would like to store all the script in the folder Data\Scripts\
to have all the script in a drop list should i use the catalog or is there a way to have all of them just like a list (abd not load always via scripting -> load script file) ?

thanks Highend
Of course you can.
You can also add the scripts to the left and right click of a CTB.
hi
but not a drop down list ,right?
thanks Horst
The Restore script creates a drop down list to select the Toolbar to restore.
This works also in a left or right click of a button.

Re: is there a way to backup toolbar?

Posted: 25 May 2021 22:07
by Linkaday
And then there is this auld script
http://www.xyplorer.com/xyfc/viewtopic. ... 240#p61697
I once saved it to the footer of my xys-template + menu 'User' >'Load script' (so to have it all over the place) and it's still running fine.
Replace 'open' by 'load' and you have two helpers.

Toolbar - going home

Posted: 27 May 2021 14:39
by aurumdigitus
Have implemented these two scripts. Another very handy item found by reading over the Forum. Rather like Forrest Gump's box of chocolates, you never know what you're going to find.

Can someone sent me the "txt. file" for the OEM toolbar. Want it for comparison purposes. Tried to get it by using the Throwaway Clone but it opens with the customized TB. Thank you ...

Re: is there a way to backup toolbar?

Posted: 27 May 2021 14:42
by highend
Just use fresh; from the address bar and you have it...

Re: is there a way to backup toolbar?

Posted: 27 May 2021 15:19
by aurumdigitus
Embarrassingly simple.

If Fresh; is a command once known to me it has long been forgotten. But then scripting was never my strong suit.

Thank you for your time and skill. :appl:

Re: is there a way to backup toolbar?

Posted: 27 May 2021 16:05
by RalphM
Just remember that "fresh;" is kind of a testing environment to see whether your settings somehow interfere with your sysem/cause your problems, it is not meant to work in permanently.
Once you identified that your problem does not exist in a fresh instance, you still need to find the culprit setting and fix it in your working setup.

Re: is there a way to backup toolbar?

Posted: 30 May 2021 15:04
by aurumdigitus
Over the weekend had occasion to fix a problem that was unrelated to the original question. But fresh; was just the ticket that led to the solution.

Glad I knew about it this time.