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;
[Scripting] "read Tabs header" - "or reuse tab"
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
[Scripting] "read Tabs header" - "or reuse tab"
Last edited by Stefan on 26 Jun 2009 13:40, edited 1 time in total.
-
admin
- Site Admin
- Posts: 66334
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: [Scripting] "read Tabs header" - "or reuse tab"
I'd prefer this one:
GoTo $LW, [reuseexistingtab]
please bump me later...
GoTo $LW, [reuseexistingtab]
please bump me later...
FAQ | XY News RSS | XY X
-
admin
- Site Admin
- Posts: 66334
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: [Scripting] "read Tabs header" - "or reuse tab"
BTW, I added it silently in v8.00.0012.admin wrote:I'd prefer this one:
GoTo $LW, [reuseexistingtab]
please bump me later...
Code: Select all
goto "C:\", 1; //reuse any tab already pointing to "C:\"FAQ | XY News RSS | XY X
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
Re: [Scripting] "read Tabs header" - "or reuse tab"
Thanksadmin wrote:BTW, I added it
$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"
Thanks Don,admin wrote: BTW, I added it silently in v8.00.0012.![]()
Code: Select all
goto "C:\", 1; //reuse any tab already pointing to "C:\"
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; 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 tabMaybe 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: 66334
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: [Scripting] "read Tabs header" - "or reuse tab"
Hmm, thanks, but a touch too much for my taste at the moment.Stefan wrote:Thanks Don,admin wrote: BTW, I added it silently in v8.00.0012.![]()
Code: Select all
goto "C:\", 1; //reuse any tab already pointing to "C:\"
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; "This works fine, thank you.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;
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" likeOr is there an better way?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
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?
I'll check that C: vs C:\ issue...
FAQ | XY News RSS | XY X
XYplorer Beta Club