Page 1 of 2 12>
Topic Options
#189362 - 2008-09-02 12:07 PM Check if the Quick Launch Toolbar is enabled
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Dear all,

This utility can switch on the Quick Launch toolbar:
ToggleQL.zip
toggleql.zip
The usage is rather simple:

ToggleQL n

where n can be:
0 = Off
1 = On
But when used in a logon script (where else ;\) ), sometimes the Quick Launch toolbar appears multiple times at the right side. The extra bars can be disabled, but when switched of in the wrong way, it can mess up your TaskBar.

Is there a way to check if the Quick Launch Toolbar is enabled?
Maybe I can get something like
 Code:
...
If NOT $Enabled
	Shell '"%ComSpec%" /C "'+@LSERVER+'\NETLOGON\toggleql.exe" 1'
EndIf
...

Top
#189365 - 2008-09-02 04:53 PM Re: Check if the Quick Launch Toolbar is enabled [Re: Witto]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Can I check this in the registry, under the kay HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop?
Could it be that the value for the registry name TaskbarWinXP can be evaluated to see if the task bar is enabled?
Something like this:
;Script Options
$SO=SETOPTION("Explicit", "ON")
$SO=SETOPTION("NoMacrosInStrings", "ON")
$SO=SETOPTION("NoVarsInStrings", "ON")
$SO=SETOPTION("WrapAtEOL", "ON")
BREAK ON

DIM $TaskbarWinXP

If @DOS = "5.1"
    ; $TaskbarWinXP = ReadValue('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop','TaskbarWinXP')
    $TaskbarWinXP = ReadValue('HKEY_USERS\'+@SID+'\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop','TaskbarWinXP')
   
Select
    Case Left($TaskbarWinXP,18) = '0c0000000800000002'
        ? 'disabled'
    Case Left($TaskbarWinXP,18) = '0c0000000800000003'
        ? 'Enabled'
    Case 1
        ?
'This is just impossible, you will never get here'
    EndSelect
EndIf

Get $SO

Top
#189367 - 2008-09-02 07:29 PM Re: Check if the Quick Launch Toolbar is enabled [Re: Witto]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4306
Loc: New Jersey
That's what I was getting from RegMon when I made the changes, along with two other reg writes that didn't seem related. My concern is that this is a bitmapped parameter - you'll probably need to bitwise AND to turn it off and bitwise OR to turn it on.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#189369 - 2008-09-02 09:57 PM Re: Check if the Quick Launch Toolbar is enabled [Re: Glenn Barnas]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
 Originally Posted By: Glenn Barnas
you'll probably need to bitwise AND to turn it off and bitwise OR to turn it on.

Switching on and off the Quick Launch Toolbar is done with ToggleQL.exe. This cannot be done by changing a registry key. But switching on the Quick Launch Toolbar while it is on is apparently not a good idea.

Top
#189373 - 2008-09-02 11:48 PM Re: Check if the Quick Launch Toolbar is enabled [Re: Witto]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11577
Loc: CA
Yes it's one of those API calls to the OS to update the Explorer Shell which just a normal Reg mod won't do and no built-in method to alert the system to a Shell update. On some things you can kill the shell and reload, but that is UGLY
Top
#189376 - 2008-09-03 12:30 AM Re: Check if the Quick Launch Toolbar is enabled [Re: NTDOC]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Do you think it is right to presume that the value for TaskbarWinXP always starts with 0c0000000800000002 when the Quick Launch Toolbar is disabled and 0c0000000800000003 when it is enabled?
Top
#189379 - 2008-09-03 02:41 AM Re: Check if the Quick Launch Toolbar is enabled [Re: Witto]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4306
Loc: New Jersey
No, but I'd feel comfortable presuming that bit 0 in that word defines it. I'd think that other bits could represent other settings, so.. since only bit 0 has changed, that's what I'd look for - mask it with a logical AND.

My $0.02 - your value may differ ;\)

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#189384 - 2008-09-03 09:44 AM Re: Check if the Quick Launch Toolbar is enabled [Re: Glenn Barnas]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Can you elaborate on that, Glenn? What script can I write?
Top
#189387 - 2008-09-03 01:33 PM Re: Check if the Quick Launch Toolbar is enabled [Re: Witto]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4306
Loc: New Jersey
Well, it's a hex value, right? Thus, it's a string. We're only interested in the last hex value, which is either 2 or 3. Thus, it's bit 0 that's changing to represent the QL state.
 Code:
; make the next line O/S independent - use Select or whatever..
; the result for any O/S is in $Taskbar (assumes that the bit is the same - 
; seems to match in Vista, so quite likely)
$TaskBar = ReadValue('HKEY_USERS\... blah.. blah..)

$TBFlag = Val('&' + Right($TaskBar, 1)) & 1
If $TBFlag
 'Enabled!' ?
Else
  'Not Enabled.' ?
EndIf

So - get the value as you do now, then prepend the "&" so Kix knows its a hex value, then take only the last nybble. Convert it to a value and binary AND it with 1. Thus, when it's 3, you'll get 1, and when it's 2, you'll get 0. Simple, eh?

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#189388 - 2008-09-03 02:29 PM Re: Check if the Quick Launch Toolbar is enabled [Re: Glenn Barnas]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1870
Loc: Hilversum, The Netherlands
It can be done using AutoIT as well, unfortunately KiX doesn't support GetHandle \:\(

http://www.autoitscript.com/forum/index.php?showtopic=63914&st=0&p=476809&#entry476809

Top
#189389 - 2008-09-03 02:30 PM Re: Check if the Quick Launch Toolbar is enabled [Re: Glenn Barnas]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4306
Loc: New Jersey
Just thinking - bitwise operations are not widely used in scripting, yet many registry functions use them to store several pieces of on/off data. MessageBox also uses this concept, so here's some common bitwise operations to get the brain-juices flowing:
 Code:
Break On

$TB = 'C3'			; starting hex value

$TB =  Val('&' + Right($TB, 2))	; convert hex to decimal value
'TB: ' $TB ?
; "toggle" changes the state - on if off, off if on - via XOR (Exclusive OR)
$TB = $TB ^ 1			; toggle bit 1
'TB: ' $TB ?
$TB = $TB ^ 1			; toggle bit 1 again
'TB: ' $TB ?

; turn on a specific bit based on bit-positional value using OR
$TB = $TB | 8			; turn on bit 8
'TB: ' $TB ?

; Turn a specific bit off based on bit-positinoal value using AND
; Allow all bits other than the one to be turned off
$On = 128+64+32+16+4+2+1	; define allowed bits in byte
$TB = $TB & $On			; turn bit 8 off by allowing all other bits except 8
'TB: ' $TB ?

; Determine if bit 5 is on - bit 5 is 16 decimal
'Bit 5: '
If $TB & 16
 'On' ?
Else
 'Off' ?
EndIf


; Determine if bit 2 is on - bit 2 is 2 decimal
'Bit 2: '
If $TB & 2
 'On' ?
Else
 'Off' ?
EndIf

Give this a whirl just as it is, then try changing the original TB value.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#189390 - 2008-09-03 03:01 PM Re: Check if the Quick Launch Toolbar is enabled [Re: Glenn Barnas]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1870
Loc: Hilversum, The Netherlands
Apparantly for new users this works too http://www.myitforum.com/forums/tm.asp?m=90841#
Top
#189392 - 2008-09-03 03:25 PM Re: Check if the Quick Launch Toolbar is enabled [Re: Arend_]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Gee thanks Glenn just what I needed ... A headache to start the day off with.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#189393 - 2008-09-03 04:11 PM Re: Check if the Quick Launch Toolbar is enabled [Re: Gargoyle]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4306
Loc: New Jersey
Well, which bit controls headache? Just toggle it using the example I gave earlier. \:D

If that doesn't work, take two Kixpirins and call me in the morning.

G-
_________________________
Actually I am a Rocket Scientist! \:D

Top
#189395 - 2008-09-03 05:04 PM Re: Check if the Quick Launch Toolbar is enabled [Re: Glenn Barnas]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I don't think I understand your logic, Glenn.
Enabling the Quick Launch toolbar cannot be done by writing to the registry. For that, ToggleQL.exe can be used.
But because that works bad from time to time, I try to find an indication that the Quick Launch Toolbar is not enabled.
If I understand your third post, you say to only check the 18th character in the value for TaskbarWinXP (the 18th character is not the last character).
What I wanted to know is if it is right to presume that this char is always 2 when the Taskbar is disabled in Windows XP.
;Script Options
$SO=SETOPTION("Explicit", "ON")
$SO=SETOPTION("NoMacrosInStrings", "ON")
$SO=SETOPTION("NoVarsInStrings", "ON")
$SO=SETOPTION("WrapAtEOL", "ON")
BREAK ON

DIM $TaskbarWinXP
DIM $Enabled

If @DOS = "5.1"
    ; $TaskbarWinXP = ReadValue('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop','TaskbarWinXP')
    $TaskbarWinXP = ReadValue('HKEY_USERS\'+@SID+'\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop','TaskbarWinXP')
   
$Enabled = SubSTR($TaskbarWinXP,18,1)
   
Select
    Case $Enabled = '2'
        ? 'disabled'
        Shell '"%ComSpec%" /C "'+@LSERVER+'\NETLOGON\toggleql.exe" 1'
    Case $Enabled = '3'
        ? 'Enabled'
    Case 1
        ?
'This is just impossible, you will never get here'
    EndSelect
EndIf

Top
#189398 - 2008-09-03 07:15 PM Re: Check if the Quick Launch Toolbar is enabled [Re: Witto]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4306
Loc: New Jersey
I understand completely - did you look at my example?
 Code:
$TaskBar = ReadValue('HKEY_USERS\'+@SID+'\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop','TaskbarWinXP')

; look only at bit 0
$TBFlag = Val('&' + Right($TaskBar, 1)) & 1
; determine if it is on or off
If $TBFlag
 'Enabled!' ?
Else
  'Not Enabled.' ?
EndIf

What I'm saying is that you can't assume a setting of 2/3, because bitwise, only bit 0 is changing. If whatever controls bit 1 is turned off, the values will become 0/1, not 2/3. By ANDing, you look only at the appropriate BIT.

My Second message was presented just to review some common bitwise operations, since they aren't commonly seen here - they have nothing to do with your specific need (which was addressed first). Sorry for the confusion.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#189407 - 2008-09-03 10:39 PM Re: Check if the Quick Launch Toolbar is enabled [Re: Glenn Barnas]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Glenn,
If I run your script, it says
 Code:
Not Enabled.

While my Quick Launch Toolbar is enabled.
I presume the script should be something like:
$TaskBar = ReadValue('HKEY_USERS\'+@SID+'\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop','TaskbarWinXP')

; look only at bit 0
$TBFlag = Val('&' + SubSTR($Taskbar,18,1)) & 1
; determine if it is on or off
If $TBFlag
    'Enabled!' ?
Else
    'Not Enabled.' ?
EndIf

Top
#189418 - 2008-09-04 01:26 AM Re: Check if the Quick Launch Toolbar is enabled [Re: Arend_]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11577
Loc: CA
 Originally Posted By: apronk
It can be done using AutoIT as well, unfortunately KiX doesn't support GetHandle \:\(

http://www.autoitscript.com/forum/index.php?showtopic=63914&st=0&p=476809&#entry476809


Yes, but they say the same thing about having to kill explorer shell which is not good.

 Quote:
I found out that if you try this while Explorer is running the settings are overwritten on Windows shutdown. Kill the explorer process to prevent this.

Top
#189419 - 2008-09-04 01:28 AM Re: Check if the Quick Launch Toolbar is enabled [Re: Arend_]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11577
Loc: CA
Yes, AutoIT looks to be an amazingly capable piece of software that understands and works with a LOT of other applications and languages.

For an advanced coder it looks like it can do just about anything you tell it to do.

Top
#189422 - 2008-09-04 02:25 AM Re: Check if the Quick Launch Toolbar is enabled [Re: Witto]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4306
Loc: New Jersey
I haven't got an XP system here to test, but I ran the following code on Vista and got the same thing - Not Enabled - so decided to display the return string.
 Code:
Break On

$ = SetOption('WrapAtEOL', 'On')

$TaskBar = ReadValue('HKEY_USERS\'+@SID+'\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop','TaskbarWinXP')
$TaskBar ?
; look only at bit 0
$TBFlag = Val('&' + Right($TaskBar, 1)) & 1
; determine if it is on or off
If $TBFlag
 'Enabled!' ?
Else
  'Not Enabled.' ?
EndIf

This returned:
 Code:
0c000000080000000200000000000000b0e22bd86457d011a96e00c04fd705a222001c000a110000
1a000000010000000000000000000000000000004c0000000114020000000000c000000000000046
810100001100000067ce069bcdcdc80162d8bed419d7c80162d8bed419d7c8010010000000000000
01000000000000000000000000000000b30214001f50e04fd020ea3a6910a2d808002b30309d1900
2f433a5c000000000000000000000000000000000000007000310000000000ce38911a1100557365
7273005c0007000400efbe62353c6cce38911a2600000068dd000000000200000000000000000032
0055007300650072007300000040007300680065006c006c00330032002e0064006c006c002c002d
0032003100380031003300000014006600310000000000ce38a11a1000474241524e417e312e3030
3000004a0007000400efbece38911ace38a11a260000004757000000002401000000000000000000
0067006200610072006e00610073002e0047004200430053002e0030003000300000001c004e0031
0000000000ce38a11a12204170704461746100380007000400efbece38911ace38a11a26000000c6
0402000000a500000000000000000000004100700070004400610074006100000016004e00310000
000000ce38991a1020526f616d696e6700380007000400efbece38911ace38991a260000000b0502
00000066000000000000000000000052006f0061006d0069006e0067000000160054003100000000
00ce38a31a14204d4943524f537e3100003c0007000400efbece38911ace38a31a260000000f0502
0000005700000000000000000000004d006900630072006f0073006f006600740000001800640031
000000000062353c6c1000494e5445524e7e3100004c0007000400efbece38911ace38911a260000
00d506020000007d000000000000000000000049006e007400650072006e00650074002000450078
0070006c006f00720065007200000018005a0031000000000026384a651100515549434b4c7e3100
00420007000400efbece38911ace38911a26000000e6060200000033000000000000000000000051
007500690063006b0020004c00610075006e006300680000001800000010000000050000a0ffffff
ffb10200001c0000000b0000a021f0a452757ba9489f6b4b87a210bc8fb102000060000000030000
a0580000000000000067307077303100000000000000000000801064e3da391b458fef3a5ebaa615
e4da2ab036c039dd11afd80018f3f1a58e801064e3da391b458fef3a5ebaa615e4da2ab036c039dd
11afd80018f3f1a58e0000000008000000020000000c0400000100000006000000cc000000030000
00be003200d3030000ce38a51a2000494e5445524e7e312e4c4e4b0000a20007000400efbece3839
1bce38391b2600000006570200000025000000000000000000520049006e007400650072006e0065
00740020004500780070006c006f007200650072002e006c006e006b000000400043003a005c0057
0069006e0064006f00770073005c00530079007300740065006d00330032005c0069006500340075
0069006e00690074002e006500780065002c002d0037003300340000001c00000000000000de0000
0002000000d0003200b5030000ce38a51a2000494e5445524e7e322e4c4e4b0000b40007000400ef
bece383d1bce383d1b260000009c5a020000000e000000000000000000640049006e007400650072
006e006500740020004500780070006c006f0072006500720020002800360034002d006200690074
0029002e006c006e006b000000400043003a005c00570069006e0064006f00770073005c00530079
007300740065006d00330032005c00690065003400750069006e00690074002e006500780065002c
002d0037003300350000001c000000000000008c000000040000007e003200c8030000ce38162a20
004d4943524f537e312e4c4e4b0000620007000400efbece38162ace38162a260000009a62020000
000100000000000000000000004d006900630072006f0073006f006600740020004f006600660069
006300650020004f00750074006c006f006f006b002e006c006e006b0000001c000000000000009e
00000000000000900032000201000026384a65200053484f5753447e312e4c4e4b00007400070004
00efbece38911ace38911a26000000ee09020000002a0000000000000000004a00530068006f0077
00730020004400650073006b0074006f0070002e006c006e006b00000040007300680065006c006c
00330032002e0064006c006c002c002d003100300031003100330000001c00000000000000a20000
000100000094003200f000000026384a65200057494e444f577e312e4c4e4b0000780007000400ef
bece38911ace38911a26000000f209020000001d0000000000000000004e00570069006e0064006f
0077002000530077006900740063006800650072002e006c006e006b00000040007300680065006c
006c00330032002e0064006c006c002c002d003100300031003100340000001c000000000000008a
000000050000007c00320066030000d9385bba20005452494c4c497e312e4c4e4b00006000070004
00efbed9385bbad9385bba26000000ab64020000001b00000000000000000000007400720069006c
006c00690061006e002e0065007800650020002d002000530068006f00720074006300750074002e
006c006e006b0000001c000000000000009300000040070000000000001e00000000000000000000
001e000000000000000100000001000000aa4f2868486ad0118c7800c04fd918b448040000400d00
00000000001e00000000000000000000001e0000000000000001000000

This is clearly larger than your example, and clearly the last value is zero, not 2/3. I did not actually return the value - I used your result and hard-coded the value in my tests, as my primary workstation was also Vista. I can use an alternate lab system to try it on XP tomorrow.

To see what I mean, change the code to read $TaskBar = '0c000003' and try it. Change the 3 to a 2 and try again. You need to make sure that the data returned from the registry is correct, and you are selecting the correct character from the hex string. The logic works, but is dependent on getting the correct value from the string.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 145 anonymous users online.
Newest Members
Jodey, Hiker, GTRoberts, KatieQuinn, Brennnnn
17684 Registered Users

Generated in 0.044 seconds in which 0.014 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org