Jump to content

Recommended Posts

Posted (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 by wazer
Posted (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 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

Posted

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).

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...