wazer Posted February 6, 2011 Posted February 6, 2011 (edited) How does this not work together, im not 100% sure how it works, i read the help file and forums but i dont understand, how to add those multi params switches to my script. They work if i run them as single lile "script.exe /?" but not "script.exe /TSI /AUTOTRAY" ;Switchless commands If $CMDLINE[0]And $CMDLINE[1] = '/?' Then MsgBox(0x40000, 'Help', 'Switchless Commands: /NOPIN /TGL /TSI /AUTOTRAY') Exit EndIf ; - /NOPIN If $CMDLINE[0] And $CMDLINE[1] = '/NOPIN' Then RegWrite("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "TaskbarNoPinnedList", "REG_DWORD", "1") EndIf ; - /TGL If $CMDLINE[0] And $CMDLINE[1] = '/TGL' Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarGlomLevel", "REG_DWORD", "2") EndIf ; - /TSI If $CMDLINE[0] And $CMDLINE[1] = '/TSI' Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSmallIcons", "REG_DWORD", "1") EndIf ; - /AUTOTRAY If $CMDLINE[0] And $CMDLINE[1] = '/AUTOTRAY' Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray", "REG_DWORD", "1") EndIf Edited February 6, 2011 by wazer
Bowmore Posted February 6, 2011 Posted February 6, 2011 (edited) You can check and process multiple command line parameters like this. ;Switchless commands If $CMDLINE[0] Then For $i = 1 To $CMDLINE[0] Switch $CMDLINE[$i] Case '/?' MsgBox(0x40000, 'Help', 'Switchless Commands: /NOPIN /TGL /TSI /AUTOTRAY') Exit Case '/NOPIN' RegWrite("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "TaskbarNoPinnedList", "REG_DWORD", "1") Case '/TGL' RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarGlomLevel", "REG_DWORD", "2") Case '/TSI' RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSmallIcons", "REG_DWORD", "1") Case '/AUTOTRAY' RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray", "REG_DWORD", "1") EndSwitch Next EndIf Edit Fixed error in code Edited February 6, 2011 by Bowmore "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook
wazer Posted February 6, 2011 Author Posted February 6, 2011 You can check and process multiple command line parameters like this. ;Switchless commands If $CMDLINE[0] Then For $i = 1 To $CMDLINE[0] Switch $CMDLINE[$i] Case '/?' MsgBox(0x40000, 'Help', 'Switchless Commands: /NOPIN /TGL /TSI /AUTOTRAY') Exit Case '/NOPIN' RegWrite("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "TaskbarNoPinnedList", "REG_DWORD", "1") Case '/TGL' RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarGlomLevel", "REG_DWORD", "2") Case '/TSI' Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSmallIcons", "REG_DWORD", "1") Case '/AUTOTRAY' Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray", "REG_DWORD", "1") EndSwitch Next EndIf Thank you but i dont think it works like it should. I tryed yours and compiled. Running script.exe /NOPIN /AUTOTRAY gives the following error. Line 13 Error: Illegal text at the end of statement (one statement perline).
trancexx Posted February 6, 2011 Posted February 6, 2011 That's c/p glitch. You shouldn't even be saying that. ♡♡♡ . eMyvnE
Bowmore Posted February 6, 2011 Posted February 6, 2011 Sorry I didn't test my code. I have now fixed the code in my original post and tested it. "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook
wazer Posted February 6, 2011 Author Posted February 6, 2011 (edited) Working Thanks Edited February 6, 2011 by wazer
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now