[Scripting] "read Tabs header" - "or reuse tab"

Features wanted...
Post Reply
Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

[Scripting] "read Tabs header" - "or reuse tab"

Post by Stefan »

How can i reuse an tab?

Like:
IF TabExist Goto
ELSE NewTab & Goto

---------

I use right now:
$LW = "X:"
#340; //new tab
GoTo $LW;

And get always an another Tab with X:\ every time i execute this script.



I want to do:
$LW = "X:"
IF TabExists($LW) Then
GoTo $LW;
ELSE
#340; //new tab
GoTo $LW;
END IF




---

Or maybe even better for more uses read the paths or names in tab header:


While $i < TabCount {
IF substr TabHeader($i), "X:\" Then
//IF substr TabHeader($i), "\review\" Then
break;
End If
incr $i;
}
seltab $i;



What do you think?
Any workaround or hidden command?

Maybe
GoTo $LW, reuse=true;


------- This is the whole script to map an share and open it in new tab:
(This works, but if i execute this script an second time, i want no new tab but reuse existing tab)


$Server = "\\server.de\";
$Share = "share";
$LW = "X:";

While (exists($LW)<2) {
Run ( "cmd /c Net use $LW $Server$Share" );
wait 5000;
#340; //new tab
}

GoTo $LW; // , reuse;
Last edited by Stefan on 26 Jun 2009 13:40, edited 1 time in total.

admin
Site Admin
Posts: 66337
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: [Scripting] "read Tabs header" - "or reuse tab"

Post by admin »

I'd prefer this one:
GoTo $LW, [reuseexistingtab]

please bump me later...

admin
Site Admin
Posts: 66337
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: [Scripting] "read Tabs header" - "or reuse tab"

Post by admin »

admin wrote:I'd prefer this one:
GoTo $LW, [reuseexistingtab]

please bump me later...
BTW, I added it silently in v8.00.0012. :) (I was too lazy to write all the documentation... :P )

Code: Select all

goto "C:\", 1; //reuse any tab already pointing to "C:\"

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: [Scripting] "read Tabs header" - "or reuse tab"

Post by Stefan »

admin wrote:BTW, I added it
Thanks :D (i can't test right now but i will report later)
$Server = "\\server.de\";
$Share = "share";
$LW = "X:";

While (exists($LW)<2) {
Run ( "cmd /c Net use $LW $Server$Share" );
wait 5000;
#340; //new tab
}

GoTo $LW, 1;

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: [Scripting] "read Tabs header" - "or reuse tab"

Post by Stefan »

admin wrote: BTW, I added it silently in v8.00.0012. :)

Code: Select all

goto "C:\", 1; //reuse any tab already pointing to "C:\"
Thanks Don,
please note that this works only for path like "C:\" syntax.... but not for drive like "C:"

And "net use" works as "net use x:" only, .... "net use x:\" fails.

So i have to modify my script and add an backslash to the last use of the $LW var ==> "GoTo $LW\, 1; "

Code: Select all

$Server = "\\server.de\";
$Share = "share";
$LW = "X:";

While (exists($LW)<2) {
Run ( "cmd /c Net use $LW $Server$Share" );
wait 5000;
#340; //new tab
}

GoTo $LW\, 1; 
This works fine, thank you.


Additional wish:
Problem:
If there is no tab to reuse i would overwrite an existing tab.
I found no scripting way to determine if an tab exists or not.

So may i ask for an another parameter "force new tab IF reuse not possible" like

Code: Select all

GoTo C:\;  // overwrite existing tab
#340; GoTo C:\; // new tab
GoTo C:\, 1;      // reuse existing tab
GoTo C:\, 2;      // reuse existing tab if already exists, otherwise create new tab
Or is there an better way?
Maybe like an additional exists() option like
0 = does not exist
1 = exists (file)
2 = exists (folder; drive; share; server)
3 = exists (tab)

I think this is of more generic use?

admin
Site Admin
Posts: 66337
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: [Scripting] "read Tabs header" - "or reuse tab"

Post by admin »

Stefan wrote:
admin wrote: BTW, I added it silently in v8.00.0012. :)

Code: Select all

goto "C:\", 1; //reuse any tab already pointing to "C:\"
Thanks Don,
please note that this works only for path like "C:\" syntax.... but not for drive like "C:"

And "net use" works as "net use x:" only, .... "net use x:\" fails.

So i have to modify my script and add an backslash to the last use of the $LW var ==> "GoTo $LW\, 1; "

Code: Select all

$Server = "\\server.de\";
$Share = "share";
$LW = "X:";

While (exists($LW)<2) {
Run ( "cmd /c Net use $LW $Server$Share" );
wait 5000;
#340; //new tab
}

GoTo $LW\, 1; 
This works fine, thank you.


Additional wish:
Problem:
If there is no tab to reuse i would overwrite an existing tab.
I found no scripting way to determine if an tab exists or not.

So may i ask for an another parameter "force new tab IF reuse not possible" like

Code: Select all

GoTo C:\;  // overwrite existing tab
#340; GoTo C:\; // new tab
GoTo C:\, 1;      // reuse existing tab
GoTo C:\, 2;      // reuse existing tab if already exists, otherwise create new tab
Or is there an better way?
Maybe like an additional exists() option like
0 = does not exist
1 = exists (file)
2 = exists (folder; drive; share; server)
3 = exists (tab)

I think this is of more generic use?
Hmm, thanks, but a touch too much for my taste at the moment.

I'll check that C: vs C:\ issue...

Post Reply