|
|
|||||||
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 ... |
||||||||
|
|
|||||||
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:
|
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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? |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
Can you elaborate on that, Glenn? What script can I write? |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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=476809entry476809 |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
Apparantly for new users this works too http://www.myitforum.com/forums/tm.asp?m=90841# |
||||||||
|
|
|||||||
Gee thanks Glenn just what I needed ... A headache to start the day off with. |
||||||||
|
|
|||||||
Well, which bit controls headache? Just toggle it using the example I gave earlier. If that doesn't work, take two Kixpirins and call me in the morning. G- |
||||||||
|
|
|||||||
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.
|
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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:
|
||||||||
|
|
|||||||
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=476809entry476809 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. |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
Glenn, Look at the 18th charachter in the string. It is a 2. I would have thought your Quick Launch toolbar is disabled. But looking at the length of the string, I would say it is enabled. These are the values under the registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop when I disable the Quick Launch Toolbar (and log off and log on again) Code: Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop] "TaskbarWinXP"=hex:0c,00,00,00,08,00,00,00,02,00,00,00,00,00,00,00,aa,4f,28,68,\ 48,6a,d0,11,8c,78,00,c0,4f,d9,18,b4,e5,03,00,00,60,0d,00,00,00,00,00,00,1e,\ 00,00,00,00,00,00,00,00,00,00,00,1e,00,00,00,00,00,00,00,01,00,00,00,01,00,\ 00,00,8b,8a,0d,54,3f,1c,32,4e,81,32,53,0f,6a,50,20,90,1d,00,00,00,60,05,00,\ 00,00,00,00,00,1c,00,00,00,00,00,00,00,00,00,00,00,1c,00,00,00,00,00,00,00,\ 01,00,00,00 "Toolbars"=hex:11,00,00,00,00,00,00,00 "Upgrade"=dword:00000001 |
||||||||
|
|
|||||||
Originally Posted By: NTDOC 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. Thats not true, I tested this script and it works perfectly you see if enable and disable quicklaunch 4 times without killing the explorer process. I think im losing my KiX religion |
||||||||
|
|
|||||||
Originally Posted By: Witto Glenn, Look at the 18th charachter in the string. It is a 2. Yes, but the 18th character is not extracted by Right($BigString, 1)!!! What I was pointing out was that I got much more data in the string than you first indicated, so Right(string, 1) may not work, but SubStr($String, 18, 1) might. Also, when I ran RegMon on the Vista Business system, the registry updated immediately when I enabled or disabled QL, yet the value from Vista Ultimate did not change between tests. Glenn |
||||||||
|
|
|||||||
I have looked at the value for TaskbarWinXP under the RegKey HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop on different computers for different users where the QL Toolbar is disabled.
|
||||||||
|
|
|||||||
I presume this script can check if the Quick Launch Toolbar is disabled on Windows XP: |
||||||||
|
|
|||||||
I have been collecting more values for TaskBarWinXP and have to review the previous script. For all these values, the QuickLaunch Taskbar was disabled: Code: 0c000000080000000200000000000000aa4f2868486ad0118c7800c04fd918b4b7020000600d0000000000001e00000000000000000000001e0000000000000001000000010000008b8a0d543f1c324e8132530f6a5020901d00000060050000000000001c00000000000000000000001c0000000000000001000000 0c000000080000000200000000000000aa4f2868486ad0118c7800c04fd918b4db020000600d0000000000001e00000000000000000000001e0000000000000001000000010000008b8a0d543f1c324e8132530f6a5020901d00000060050000000000001c00000000000000000000001c0000000000000001000000 0c000000080000000200000000000000aa4f2868486ad0118c7800c04fd918b4c9030000600d0000000000001e00000000000000000000001e0000000000000001000000010000008b8a0d543f1c324e8132530f6a5020901d00000060050000000000001c00000000000000000000001c0000000000000001000000 0c000000080000000200000000000000aa4f2868486ad0118c7800c04fd918b4c9020000600d0000000000001e00000000000000000000001e0000000000000001000000010000008b8a0d543f1c324e8132530f6a5020901d00000060050000000000001c00000000000000000000001c0000000000000001000000 0c000000080000000200000000000000aa4f2868486ad0118c7800c04fd918b4ff030000600d0000000000001e00000000000000000000001e0000000000000001000000010000008b8a0d543f1c324e8132530f6a5020901d00000060050000000000001c00000000000000000000001c0000000000000001000000 0c000000080000000200000000000000aa4f2868486ad0118c7800c04fd918b4ed030000600d0000000000001e00000000000000000000001e0000000000000001000000010000008b8a0d543f1c324e8132530f6a5020901d00000060050000000000001c00000000000000000000001c0000000000000001000000 0c000000080000000200000000000000aa4f2868486ad0118c7800c04fd918b455030000600d0000000000001e00000000000000000000001e0000000000000001000000010000008b8a0d543f1c324e8132530f6a5020901d00000060050000000000001c00000000000000000000001c0000000000000001000000 0c000000080000000200000000000000aa4f2868486ad0118c7800c04fd918b455030000600d0000000000001e00000000000000000000001e0000000000000001000000010000008b8a0d543f1c324e8132530f6a5020901d00000060050000000000001c00000000000000000000001c0000000000000001000000 0c000000080000000100000000000000aa4f2868486ad0118c7800c04fd918b477030000e00c0000000000001e00000000000000000000001e0000000000000001000000 0c000000080000000200000000000000aa4f2868486ad0118c7800c04fd918b45d030000600d0000000000001e00000000000000000000001e0000000000000001000000010000008b8a0d543f1c324e8132530f6a5020902d00000060050000000000001c00000000000000000000001c0000000000000001000000 0c000000080000000200000000000000aa4f2868486ad0118c7800c04fd918b466030000600d0000000000001e00000000000000000000001e0000000000000001000000010000008b8a0d543f1c324e8132530f6a5020901400000060050000000000001c00000000000000000000001c0000000000000001000000 0c000000080000000200000000000000aa4f2868486ad0118c7800c04fd918b4cb030000600d0000000000001e00000000000000000000001e0000000000000001000000010000008b8a0d543f1c324e8132530f6a5020902d00000060050000000000001c00000000000000000000001c0000000000000001000000 0c000000080000000200000000000000aa4f2868486ad0118c7800c04fd918b493030000600d0000000000001e00000000000000000000001e0000000000000001000000010000008b8a0d543f1c324e8132530f6a5020902d00000060050000000000001c00000000000000000000001c0000000000000001000000 0c000000080000000200000000000000aa4f2868486ad0118c7800c04fd918b481030000600d0000000000001e00000000000000000000001e0000000000000001000000010000008b8a0d543f1c324e8132530f6a5020902d00000060050000000000001c00000000000000000000001c0000000000000001000000 I think checking for the existance and the length of the value should be enough to avoid that double and triple QuickLaunch Taskbars get created.
|
||||||||
|
|
|||||||
I finally found a way in KiX to be able to enable and disable the QuickLaunch bar. However it doesn't return the state, I spend hours figuring this out and finally had to resort to an external DLL that let's you make DLL Calls, I hope Ruud will incorporate this into KiX. Anyway here's what you need: DynaWrapper And here the code, after hours of sorting it out: Code: Function ToggleQL($switch) Dim $WM_USER, $WMTRAY_TOGGLEQL, $objItem, $lhWnd $WM_USER = &400 $WMTRAY_TOGGLEQL = ($WM_USER + 237) $objItem = CreateObject("DynamicWrapper") $=$objItem.Register("USER32.DLL", "FindWindowA", "i=ss", "f=s", "r=l") $=$objItem.Register("USER32.DLL", "SendMessage", "I=hlll", "f=s", "R=l") $lhWnd = $objItem.FindWindowA("Shell_TrayWnd", "") $=$objItem.SendMessage($lhWnd, $WMTRAY_TOGGLEQL, -1, $switch) EndFunction The switch = 0 for off and 1 for on. |
||||||||
|
|
|||||||
I like it. Now can you explain it, so I can learn from it. How did you figure out what values to use. |
||||||||
|
|
|||||||
The readme.txt included in the zip explains the I, F and R switches. Basically I google'd alot to see what how it is done in C/C++ and in AutoIT. Keep comparing and you'll find out which switches you need. I posted the link to the AutoIT script earlier in this thread that does the same thing as mine. I basically translated that. |
||||||||
|
|
|||||||
Hey Arend, would you mind posting this to the UDFs? |
||||||||
|
|
|||||||
Whow Arend, I will take a look at that. Sounds nice. Apparently this DynaWrapper has much more potential. |
||||||||
|
|
|||||||
this VB script toggels the "quick launch" setting. Code: Option Explicit Dim ShellObject Set ShellObject=WScript.CreateObject("WScript.Shell") ShellObject.Run("rundll32.exe shell32.dll,Options_RunDLL 1") WScript.Sleep 200 ShellObject.AppActivate "Taskbar and Start Menu Properties" ShellObject.SendKeys "%Q" WScript.Sleep 200 ShellObject.AppActivate "Taskbar and Start Menu Properties" ShellObject.Sendkeys"%A" WScript.Sleep 200 ShellObject.AppActivate "Taskbar and Start Menu Properties" ShellObject.Sendkeys"{ENTER}" could it be rewriten in kix? |