Jump to content

Script Compiles Instead of Running


Gestalt
 Share

Recommended Posts

So far, I have only noticed this with one of my scripts, but for some reason, when I right-click the script and choose Run Script, or if I press F5 within SciTE, it will compile the script. However, it does not compile it by creating an .exe file in addition to the script; it merely rewrites the script, making it an executable but leaving the .au3 extension. If I replace the .au3 extension with an .exe extension, it runs as it would had I compiled it. But my original script is gone, replaced by the compiled script.

As I had mentioned, this only happens with one of my scripts and I don't see anything in the script or the SciTE settings which would cause this? Does anyone have any ideas on what may be causing this?

Link to comment
Share on other sites

  • Developers

So far, I have only noticed this with one of my scripts, but for some reason, when I right-click the script and choose Run Script, or if I press F5 within SciTE, it will compile the script. However, it does not compile it by creating an .exe file in addition to the script; it merely rewrites the script, making it an executable but leaving the .au3 extension. If I replace the .au3 extension with an .exe extension, it runs as it would had I compiled it. But my original script is gone, replaced by the compiled script.

As I had mentioned, this only happens with one of my scripts and I don't see anything in the script or the SciTE settings which would cause this? Does anyone have any ideas on what may be causing this?

Please Cut&Paste into a post here:

  • The  SciTE Output pane information when pressing F5.
  • The Script 

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I experienced the same problem a couple of times (but only on a compuer that I use rarely). I do not remember if I solved only by rebooting SciTE or the entire computer. However I did not give importance to that episode. next time (if it will happen again) I'll keep track of what suggested by jos and will report here.

edit:

remembering better, the problem was not exactly the one described by OP, in my case it happened that, by pressing the F5 key,  I was presented the screen about to compiling, instead of running the script.

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Here is the code:

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\..\Save\Icons\FastForward.ico
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_Comment=Created by My Name
#AutoIt3Wrapper_Res_Description=Application launcher
#AutoIt3Wrapper_Res_Fileversion=1.3.1.0
#AutoIt3Wrapper_Res_ProductVersion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=My Name, My Companny
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Run_Au3Stripper=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#pragma compile(Inputboxres, true)

;Application to create a customized toolbar which will snap to the edges of the screens

#include <GuiMenu.au3> ;right-click menu style

FileInstall("C:\Save\Icons\ms word.ico", @TempDir & "\ms word.ico")
FileInstall("C:\Save\Icons\ms excel.ico", @TempDir & "\ms excel.ico")
FileInstall("C:\Save\Icons\acrobat.ico", @TempDir & "\acrobat.ico")

Opt("MustDeclareVars", 1)
Opt("GUICloseOnEsc", 0)

;Do not allow this program to be run directly from the U: or X: drive -- cannot update the file if it is in use (potential auto-update feature not implemented)
If StringInStr(@ScriptDir, "U:\") Or StringInStr(@ScriptDir, "X:\") Or StringInStr(@ScriptDir, "\\770-Thor\Public") Or StringInStr(@ScriptDir, "\\770-ACAD\Admin") Then
    MsgBox(16, "Invalid Location", "NOTICE: The Task List should not be run directly from a network drive. Please copy the executable to your computer and run it locally.")
    Exit
EndIf

_SingleInstance()
_ToolbarPreview()

Func _ToolbarPreview()
    Global $tbcnt = -1, $i = 0, $n, $maingui, $inibtn, $iniorient, $inicolor, $iniprog, $inipic, $inires, $fileopen, $borient
    Global $progext, $iconsize, $barsize, $size, $left, $top, $xPosH, $xPosV, $yPosH, $yPosV, $xPos, $yPos
    Global $iStartIndex = 1, $iCntRow, $iCntCol, $iCurIndex
    Global $ahIcons[50], $glNames[1]
    Global $glFilename = @SystemDir & "\shell32.dll"
    Local $gmsg, $qlbutton[3], $qlbuttonClose, $qlseparator, $msgYN, $progname, $dummy, $move = -1, $moveprog, $moveicon, $movename, $moveres
    Local $width, $height, $separate = 1
    Local $qlscontext, $qlspermsep, $qlsnewbtn, $qlsorient, $qlscolor, $qlsinfo
    Local $contextmenu[1], $browseprog[1], $browsefolder[1], $browseicon[1], $separator[1], $name[1], $options[1], $oriented[1]
    Local $addbutton[1], $addseparate[1], $delbutton[1], $moveto[1], $info[1], $changeicon[1], $changecolor[1], $systemicon[1]
    Local $sysbutton[1], $ctrlpanel[1], $sysmenu[$i], $admintools[$i], $services[$i], $display[$i]
    ;If the INI file does not exist, create it
    If Not FileExists(@MyDocumentsDir & "\Quicklaunch Prefs.ini") Then
        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Buttons", "5")
        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Orientation", "H")
        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Background", "0x6F6F6F")
        ;Create a shortcut in the Startup folder
        $msgYN = MsgBox(32+4, "Startup Shortcut", "This is your first time using the Quicklaunch Toolbar. " & _
        "Would you like to create a shortcut in your Startup folder?")
        ;If the answer is yes
        If $msgYN = 6 Then
            FileCreateShortcut(@ScriptDir & "\Quicklaunch Toolbar.exe", @StartUpDir & "\Quicklaunch Toolbar.lnk")
        EndIf
        ;Show the information window for first-time users
        $msgYN = MsgBox(32+4, "Quicklaunch Information", "Would you like to view a brief overview on using the Quicklaunch Toolbar?")
        ;If the answer is yes
        If $msgYN = 6 Then
            _Information_Window()
        EndIf
    EndIf
    ;Update the program if there is a new version available
    If FileExists("U:\IT\Save\Quicklaunch Toolbar.exe") And FileGetVersion(@ScriptFullPath) <> FileGetVersion("U:\IT\Save\Quicklaunch Toolbar.exe") Then
        ;Update the program by writing a batch script, running it and then exiting so the batch script can update the program
        _UpdateSelf(@ScriptFullPath)
        Exit
    EndIf
    ;Read the INI file if it exists to populate the options that have already been chosen
    ;Put the default number of buttons in the INI file if the section is not there
    $inibtn = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Buttons", "5")
    If @error Then
        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Buttons", "5")
        $inibtn = 5
    EndIf
    ;Put the default orientation in the INI file if the section is not there
    $iniorient = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Orientation", "H")
    If @error Then
        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Orientation", "H")
        $iniorient = "H"
    EndIf
    ;Put the default background color in the INI file if the section is not there
    $inicolor = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Background", "0x6F6F6F")
    If @error Then
        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Background", "0x6F6F6F")
        $inicolor = "0x6F6F6F"
    EndIf
    ;Find out how many separators are in the GUI
    For $i = 0 To $inibtn-1
        $iniprog = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, "")
        ;Count the separators
        If $iniprog = "|" Then
            $separate += 1
        EndIf
    Next
    $iconsize = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Size", "24")
    If @error Then
        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Size", "24")
        $inicolor = "24"
    EndIf
    ;Show small icons if the bar is small
    If $iconsize = 24 Then
        $size = 0
    Else
        $size = 1
    EndIf
    ;Get the number of buttons from the preferences
    ReDim $qlbutton[$inibtn] ;Add one for the close button
    ReDim $contextmenu[$inibtn]
    ReDim $browseprog[$inibtn]
    ReDim $browsefolder[$inibtn]
    ReDim $changeicon[$inibtn]
    ReDim $browseicon[$inibtn]
    ReDim $systemicon[$inibtn]
    ReDim $name[$inibtn]
    ReDim $separator[$inibtn]
    ReDim $moveto[$inibtn]
    ReDim $addbutton[$inibtn]
    ReDim $addseparate[$inibtn]
    ReDim $delbutton[$inibtn]
    ReDim $oriented[$inibtn]
    ReDim $changecolor[$inibtn]
    ReDim $moveto[$inibtn]
    ReDim $sysbutton[$inibtn]
    ReDim $ctrlpanel[$inibtn]
    ReDim $sysmenu[$inibtn]
    ReDim $admintools[$inibtn]
    ReDim $services[$inibtn]
    ReDim $display[$inibtn]
    ReDim $info[$inibtn]
    ;Create the GUI toolbar with the preferences from the INI file
    $barsize = UBound($qlbutton)*$iconsize+(-($iconsize/2)*($separate-4)) ;The number after the $iocnsize/2 is the number of separators (-4 for the separator and close buttons)
    If $iniorient = "V" Then
        ;Vertical, Left
        $width = $iconsize
        $height = $barsize
        $left = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Left", 0)
        $top = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Top", (@DesktopHeight-$barsize)/2)
        $borient = 2
    Else
        ;Horizontal, Top
        $width = $barsize
        $height = $iconsize
        $left = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Left", (@DesktopWidth-$barsize)/2)
        $top = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Top", 0)
        $borient = 1
    EndIf
    ;If the INI file has the current X and Y coordinates in it, use those coordinates rather than the defaults
    ;Create the main GUI
    $maingui = GUICreate("Quicklaunch Toolbar", $width, $height, $left, $top, 0x80000000, 0x00000008) ;$WS_POPUP, $WS_EX_TOPMOST
    GUISetBkColor($inicolor)
    ;Create a dummy control to pull focus off the other buttons
    $dummy = GUICtrlCreateLabel("", -1, -1, 0, 0)
    ;Create the buttons based on the number of buttons chosen
    For $i = 0 To $inibtn-1
        $iniprog = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, "")
        $inipic = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, "7") ;blank icon
        $inires = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "") ;no DLL file
        ;Create a separator instead of a program
        If $iniprog = "|" Then
            If $borient = 1 Then $qlbutton[$i] = _ToolBarSeparator_H()
            If $borient = 2 Then $qlbutton[$i] = _ToolBarSeparator_V()
            GUICtrlSetTip($qlbutton[$i], IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, ""))
        ElseIf Number($inipic) Then
            ;System icons
            If $borient = 1 Then $qlbutton[$i] = _ToolBarButton_H($inipic, $inires)
            If $borient = 2 Then $qlbutton[$i] = _ToolBarButton_V($inipic, $inires)
            GUICtrlSetTip($qlbutton[$i], IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, ""))
        Else
            ;Icons pulled from applicatoins
            If $borient = 1 Then $qlbutton[$i] = _ToolBarButton_H("", $inipic)
            If $borient = 2 Then $qlbutton[$i] = _ToolBarButton_V("", $inipic)
            GUICtrlSetTip($qlbutton[$i], IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, ""))
        EndIf
        ;Create the context menu items
        $contextmenu[$i] = GUICtrlCreateContextMenu($qlbutton[$i])
        _GUICtrlMenu_SetMenuStyle(GUICtrlGetHandle($contextmenu[$i]), 0x80000000)
        ;Browse for program
        $browseprog[$i] = GUICtrlCreateMenuItem("Browse for Program...", $contextmenu[$i])
        ;Browse for folder
        $browsefolder[$i] = GUICtrlCreateMenuItem("Browse for Folder...", $contextmenu[$i])
        ;System buttons
        $sysbutton[$i] = GUICtrlCreateMenu("System Button", $contextmenu[$i])
        _GUICtrlMenu_SetMenuStyle(GUICtrlGetHandle($sysbutton[$i]), 0x80000000)
        ;System button options
        $ctrlpanel[$i] = GUICtrlCreateMenuItem("Control Panel", $sysbutton[$i])
        GUICtrlCreateMenuItem("", $sysbutton[$i])
        $admintools[$i] = GUICtrlCreateMenuItem("Administrative Tools", $sysbutton[$i])
        $display[$i] = GUICtrlCreateMenuItem("Display Settings", $sysbutton[$i])
        $services[$i] = GUICtrlCreateMenuItem("Services", $sysbutton[$i])
        $sysmenu[$i] = GUICtrlCreateMenuItem("System Settings", $sysbutton[$i])
        GUICtrlCreateMenuItem("", $contextmenu[$i])
        ;Change label name
        $name[$i] = GUICtrlCreateMenuItem("Change Label Name", $contextmenu[$i])
        $changeicon[$i] = GUICtrlCreateMenu("Change Icon", $contextmenu[$i])
        _GUICtrlMenu_SetMenuStyle(GUICtrlGetHandle($changeicon[$i]), 0x80000000)
        $browseicon[$i] = GUICtrlCreateMenuItem("Browse For Icon...", $changeicon[$i])
        $systemicon[$i] = GUICtrlCreateMenuItem("System Icon", $changeicon[$i])
        ;Create separator
        $separator[$i] = GUICtrlCreateMenuItem("Replace with Separator", $contextmenu[$i])
        GUICtrlCreateMenuItem("", $contextmenu[$i])
        ;Add and Delete buttons
        $addbutton[$i] = GUICtrlCreateMenuItem("Add New Button", $contextmenu[$i])
        $addseparate[$i] = GUICtrlCreateMenuItem("Add New Separator", $contextmenu[$i])
        GUICtrlCreateMenuItem("", $contextmenu[$i])
        $delbutton[$i] = GUICtrlCreateMenuItem("Delete Button", $contextmenu[$i])
        ;If a move is in progress, show the Cancel Move button
        $moveto[$i] = GUICtrlCreateMenuItem("Move Button To...", $contextmenu[$i])
        GUICtrlCreateMenuItem("", $contextmenu[$i])
        ;Check the orientation and show the Orientation option based on current orientation
        If $iniorient = "V" Then
            $oriented[$i] = GUICtrlCreateMenuItem("Horizontal Toolbar", $contextmenu[$i])
        Else
            $oriented[$i] = GUICtrlCreateMenuItem("Vertical Toolbar", $contextmenu[$i])
        EndIf
        GUICtrlCreateMenuItem("", $contextmenu[$i])
        ;Change background color
        $changecolor[$i] = GUICtrlCreateMenuItem("Change Appearance", $contextmenu[$i])
        GUICtrlCreateMenuItem("", $contextmenu[$i])
        ;Help button
        $info[$i] = GUICtrlCreateMenuItem("Information", $contextmenu[$i])
    Next
    ;Add the final separator
    If $borient = 1 Then $qlseparator = _ToolBarSeparator_H()
    If $borient = 2 Then $qlseparator = _ToolBarSeparator_V()
    ;Add the Close button
    If $borient = 1 Then $qlbuttonClose = _ToolBarButton_H(98)
    If $borient = 2 Then $qlbuttonClose = _ToolBarButton_V(98)
    GUICtrlSetTip(-1, "Close")
    ;Add context menu to the permanent separator
    $qlscontext = GUICtrlCreateContextMenu($qlseparator)
    _GUICtrlMenu_SetMenuStyle(GUICtrlGetHandle($qlscontext), 0x80000000)
    $qlspermsep = GUICtrlCreateMenuItem("Permanent Separator", $qlscontext)
    GUICtrlCreateMenuItem("", $qlscontext)
    $qlsnewbtn = GUICtrlCreateMenuItem("Add New Button", $qlscontext)
    If $borient = 2 Then
        $qlsorient = GUICtrlCreateMenuItem("Horizontal Toolbar", $qlscontext)
    Else
        $qlsorient = GUICtrlCreateMenuItem("Vertical Toolbar", $qlscontext)
    EndIf
    $qlscolor = GUICtrlCreateMenuItem("Change Appearance", $qlscontext)
    GUICtrlCreateMenuItem("", $qlscontext)
    $qlsinfo = GUICtrlCreateMenuItem("Information", $qlscontext)
    ;Make sure the window docks in the correct area when it reloads
    _WinDock()
    ;Show the GUI
    GUISetState()
    GUICtrlSetState($dummy, 256)
    ;Put the GUI on top of other windows
    WinSetOnTop("Quicklaunch Toolbar", "", 1)
    While 1
        $gmsg = GUIGetMsg()
        Select
            Case $gmsg = -3 Or $gmsg = $qlbuttonClose
                $msgYN = MsgBox(32+4, "Close?", "Are you sure you want to close the Quicklaunch Toolbar?")
                If $msgYN = 6 Then
                    _SetPosition()
                    Exit
                EndIf
            ;The final separator context menu options
            Case $gmsg = $qlspermsep
                MsgBox(0, "Quicklaunch Toolbar", "This is a permanent separator and cannot be modified or removed." & @CRLF & @CRLF & _
                "This separator must stay in place to allow the Quicklaunch toolbar to be moved (hold down the left mouse button on the separator while moving the cursor).")
            Case $gmsg = $qlsnewbtn
                IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Buttons", $inibtn + 1)
                _SetPosition()
                GUIDelete($maingui)
                _ToolbarPreview()
            Case $gmsg = $qlsorient
                ;Change the orientation of the toolbar
                _ChangeOrientation()
                GUIDelete($maingui)
                _ToolbarPreview()
            Case $gmsg = $qlscolor
                Local $color = _Appearance()
                If $color = 1 Then
                    _SetPosition()
                    GUIDelete($maingui)
                    _ToolbarPreview()
                EndIf
            Case $gmsg = $qlsinfo
                _Information_Window()
        EndSelect
        ;Check to see if any of the buttons are pressed
        For $i = 0 To ($inibtn)-1
            Select
                Case $gmsg = $qlbutton[$i]
                    ;If a button is going to be moved, then swap the button positions
                    If $move >= 0 Then
                        ;Moving from left to right
                        If $move < $i Then
                            For $n = $move + 1 To $i
                                ;Swap the buttons between the one being moved
                                IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $n-1, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $n, ""))
                                IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $n-1, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $n, ""))
                                IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $n-1, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $n, ""))
                                IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $n-1, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $n, ""))
                            Next
                            ;After the other buttons are moved, switch the two selected buttons
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, $moveprog)
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, $moveicon)
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, $movename)
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, $moveres)
                        ;Moving from right to left
                        ElseIf $i < $move Then
                            For $n = $move - 1 To $i Step -1
                                ;Swap the buttons between the one being moved
                                IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $n+1, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $n, ""))
                                IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $n+1, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $n, ""))
                                IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $n+1, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $n, ""))
                                IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $n+1, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $n, ""))
                            Next
                            ;After the other buttons are moved, switch the two selected buttons
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, $moveprog)
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, $moveicon)
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, $movename)
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, $moveres)
                        EndIf
                        ;Set the $move variable to null to avoid any additional moves
                        _SetPosition()
                        GUIDelete($maingui)
                        _ToolbarPreview()
                        $move = -1
                    Else
                        ;If the window is moved, make sure it doesn't move off the screen
                        _WinDock()
                        ;Launch the application if a key is pressed
                        $progext = StringRight(IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, ""), 4)
                        If $progext = ".msc" Or $progext = ".xls" Or $progext = "xlsx" Or $progext = ".doc" Or $progext = "docx" Or $progext = ".pdf" Or $progext = ".chm" Then
                            ShellExecute(IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, ""))
                        Else
                            Run(IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, ""))
                        EndIf
                    EndIf
                Case $gmsg = $qlseparator
                    ;If the window is moved, make sure it doesn't move off the screen
                    _WinDock()
                Case $gmsg = $browseprog[$i]
                    ;Open a file open dialog to choose which application is opened with the button
                    $fileopen = FileOpenDialog("Browse for an application", @ProgramFilesDir, "Applications (*.exe;*.msc;*.doc;*.docx;*.xls;*.xlsx;*.pdf)", 3)
                    If Not @error Then
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, $fileopen)
                        $progext = StringRight($fileopen, 4)
                        If $progext = "msc" Then
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, 1)
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, @SystemDir & "\imageres.dll")
                        ElseIf $progext = ".doc" Then
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, @TempDir & "\ms word.ico")
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "")
                        ElseIf $progext = "docx" Then
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, @TempDir & "\ms word.ico")
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "")
                        ElseIf $progext = ".xls" Then
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, @TempDir & "\ms excel.ico")
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "")
                        ElseIf $progext = "xlsx" Then
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, @TempDir & "\ms excel.ico")
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "")
                        ElseIf $progext = ".pdf" Then
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, @TempDir & "\acrobat.ico")
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "")
                        ElseIf $progext = ".chm" Then
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, -155)
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, @SystemDir & "\shell32.dll")
                        Else
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, $fileopen)
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "")
                        EndIf
                        $progname = InputBox("Application Name", "Enter the application name", "", "", 190, 125)
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, $progname)
                        _SetPosition()
                        GUIDelete($maingui)
                        _ToolbarPreview()
                        Return
                    EndIf
                Case $gmsg = $browsefolder[$i]
                    $fileopen = FileSelectFolder("Browse for a folder", "C:\")
                    If Not @error Then
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, @WindowsDir & "\explorer.exe " & $fileopen)
                        $progname = InputBox("Folder Name", "Enter the folder name", "", "", 190, 125)
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, $progname)
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, -4)
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, @SystemDir & "\shell32.dll")
                        _SetPosition()
                        GUIDelete($maingui)
                        _ToolbarPreview()
                        Return
                    EndIf
                Case $gmsg = $browseicon[$i]
                    ;Open a file open dialog to choose which icon will replace the current icon
                    $fileopen = FileOpenDialog("Browse for an application", @ProgramFilesDir, "Icon Files (*.ico;*.exe)", 3)
                    If Not @error Then
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, $fileopen)
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "")
                        _SetPosition()
                        GUIDelete($maingui)
                        _ToolbarPreview()
                        Return
                    EndIf
                Case $gmsg = $systemicon[$i]
                    Local $n, $guipos, $x, $y
                    ;Center the GUI on the screen where the toolbar resides
                    $guipos = WinGetPos($maingui)
                    If Not @error Then
                        If $guipos[0] < 0 Then
                            $x = -(@DesktopWidth+620)/2
                            $y = -1
                        ElseIf $guipos[0] > @DesktopWidth Then
                            $x = ((@DesktopWidth-620)/2) + @DesktopWidth
                            $y = -1
                        Else
                            $x = -1
                            $y = -1
                        EndIf
                    Else
                        $x = -1
                        $y = -1
                    EndIf
                    Local $hGui = GUICreate("Icon Selector", 620, 350, $x, $y)
                    Global $hStatus = GUICtrlCreateLabel("", 250, 9, 125, 16)
                    GUICtrlSetFont(-1, 10)
                    Global $hPrev = GUICtrlCreateButton("Previous", 10, 5, 60, 24)
                    GUICtrlSetState(-1, 128)
                    Global $hNext = GUICtrlCreateButton("Next", 75, 5, 60, 24)
                    Local $btnShell32 = GUICtrlCreateButton("Shell32", 490, 5, 60, 24)
                    GUICtrlSetState(-1, 128)
                    Local $btnImageRes = GUICtrlCreateButton("ImageRes", 555, 5, 60, 24)
                    ;This code builds two arrays of ID's of icons and labels for easily update
                    For $iCntRow = 0 to 4
                        For $iCntCol = 0 to 9
                            $iCurIndex = $iCntRow * 10 + $iCntCol
                            $ahIcons[$iCurIndex] = GUICtrlCreateIcon($glFilename, 0, 60 * $iCntCol + 25, 60 * $iCntRow + 50, 48, 48, 0x0100)
                        Next
                    Next
                    ;Start the process to allow system icons to be chosen
                    _NewFileLoad($glFilename)
                    _GUIUpdate()
                    GUISetState()
                    While 1
                        Local $nMsg = GUIGetMsg()
                        Switch $nMsg
                            Case $hPrev
                                $iStartIndex = $iStartIndex - 50
                                _GUIUpdate()
                            Case $hNext
                                $iStartIndex = $iStartIndex + 50
                                _GUIUpdate()
                            Case -3
                                GUIDelete($hGUI)
                                ExitLoop
                            Case $btnShell32
                                GUICtrlSetState($btnImageRes, 64) ;Enabled
                                GUICtrlSetState($btnShell32, 128) ;Disabled
                                $glFilename = @SystemDir & "\shell32.dll"
                                $iStartIndex = 1
                                _NewFileLoad($glFilename)
                                _GUIUpdate()
                            Case $btnImageRes
                                GUICtrlSetState($btnShell32, 64) ;Enabled
                                GUICtrlSetState($btnImageRes, 128) ;Disabled
                                $glFilename = @SystemDir & "\imageres.dll"
                                $iStartIndex = 1
                                _NewFileLoad($glFilename)
                                _GUIUpdate()
                        EndSwitch
                        For $n = 0 To $iCurIndex
                            If $nMsg = $ahIcons[$n] Then
                                ;Put the icon value into an array and change to a negative value
                                IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, -($iStartIndex + $n))
                                IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, $glFilename)
                                _SetPosition()
                                GUIDelete($hGUI)
                                GUIDelete($maingui)
                                _ToolbarPreview()
                            EndIf
                        Next
                    Wend
                Case $gmsg = $name[$i]
                    $progname = InputBox("Application Name", "Enter the application name", "", "", 190, 125)
                    If $progname <> "" Then
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, $progname)
                        _SetPosition()
                        GUIDelete($maingui)
                        _ToolbarPreview()
                        Return
                    EndIf
                Case $gmsg = $changecolor[$i]
                    Local $color = _Appearance()
                    If $color = 1 Then
                        _SetPosition()
                        GUIDelete($maingui)
                        _ToolbarPreview()
                        Return
                    EndIf
                Case $gmsg = $separator[$i]
                    Local $program
                    If IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, "this button") <> "|" Then
                        $program = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, "this button")
                        $msgYN = MsgBox(32 + 4, "Replace with Separator", "Are you sure you want to replace " & IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, "this button") & " with a separator?")
                        If $msgYN = 6 Then
                            ;Create a separator
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, "|")
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, "")
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, "")
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "")
                            _SetPosition()
                            GUIDelete($maingui)
                            _ToolbarPreview()
                        EndIf
                    Else
                        MsgBox(0, "Cannot Replace Separator", "The selected item is already a separator")
                    EndIf
                Case $gmsg = $moveto[$i]
                    If $move >= 0 Then
                        ;Cancel the Move operation
                        $move = -1
                        GUISetBkColor(0X6F6F6F, $maingui)
                        GUICtrlSetState($dummy, 256)
                        For $n = 0 To ($inibtn)-1
                            GUICtrlSetData($moveto[$n], "Move Button To...")
                        Next
                    Else
                        ;Prepare to move the button to the new location
                        $moveprog = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, "")
                        $moveicon = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, "")
                        $movename = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, "")
                        $moveres = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "")
                        $move = $i
                        GUISetBkColor(0xCFCF00, $maingui)
                        GUICtrlSetState($qlbutton[$i], 256)
                        For $n = 0 To ($inibtn)-1
                            GUICtrlSetData($moveto[$n], "Cancel Button Move")
                        Next
                    EndIf
                Case $gmsg = $oriented[$i]
                    _ChangeOrientation()
                    GUIDelete($maingui)
                    _ToolbarPreview()
                Case $gmsg = $addbutton[$i] Or $gmsg = $addseparate[$i]
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Buttons", $inibtn + 1)
                    ;Move all of the buttons to the right one space
                    For $n = ($inibtn - 1) To $i Step -1
                        ;Move the buttons two to the right to make room for the new button
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $n+1, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $n, ""))
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $n+1, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $n, ""))
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $n+1, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $n, ""))
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $n+1, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $n, ""))
                    Next
                    ;After all of the other buttons have been moved, create the blank button in the selected space
                    If $gmsg = $addseparate[$i] Then
                        ;Create the separator if a new separator is chosen
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, "|")
                    Else
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, "")
                    EndIf
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, "")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, "")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "")
                    _SetPosition()
                    GUIDelete($maingui)
                    _ToolbarPreview()
                Case $gmsg = $delbutton[$i]
                    $msgYN = MsgBox(32 + 4, "Delete?", "Do you want to delete " & IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, "this button") & "?")
                    If $msgYN = 7 Then ContinueLoop
                    ;If it is the last button, just delete the button
                    If $n = ($inibtn-2) Then
                        ;Delete the current button
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, "")
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, "")
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, "")
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "")
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Buttons", $inibtn - 1)
                        _SetPosition()
                        GUIDelete($maingui)
                        _ToolbarPreview()
                    Else
                        ;Move the buttons to the left and then delete the last button
                        For $n = $i To ($inibtn-2)
                            ;Move all of the buttons to the left
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $n, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $n+1, ""))
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $n, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $n+1, ""))
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $n, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $n+1, ""))
                            IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $n, IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $n+1, ""))
                        Next
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", ($inibtn-1), "")
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", ($inibtn-1), "")
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", ($inibtn-1), "")
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", ($inibtn-1), "")
                        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Buttons", $inibtn - 1)
                        _SetPosition()
                        GUIDelete($maingui)
                        _ToolbarPreview()
                    EndIf
                Case $gmsg = $ctrlpanel[$i]
                    ;Create the system button, icon and name
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, "control")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, "-23")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, "Control Panel")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "C:\Windows\SysWOW64\imageres.dll")
                    _SetPosition()
                    GUIDelete($maingui)
                    _ToolbarPreview()
                Case $gmsg = $sysmenu[$i]
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, "control /name Microsoft.System")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, "-144")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, "System Settings")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "C:\Windows\SysWOW64\imageres.dll")
                    _SetPosition()
                    GUIDelete($maingui)
                    _ToolbarPreview()
                Case $gmsg = $admintools[$i]
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, "control /name Microsoft.AdministrativeTools")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, "-110")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, "Administrative Tools")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "C:\Windows\SysWOW64\imageres.dll")
                    _SetPosition()
                    GUIDelete($maingui)
                    _ToolbarPreview()
                Case $gmsg = $services[$i]
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, "services.msc")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, "-64")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, "Services")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "C:\Windows\SysWOW64\imageres.dll")
                    _SetPosition()
                    GUIDelete($maingui)
                    _ToolbarPreview()
                Case $gmsg = $display[$i]
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Program", $i, "control /name Microsoft.Display")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Icon", $i, "-95")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Name", $i, "Display Properties")
                    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Resource", $i, "C:\Windows\SysWOW64\shell32.dll")
                    _SetPosition()
                    GUIDelete($maingui)
                    _ToolbarPreview()
                Case $gmsg = $info[$i]
                    _Information_Window()
            EndSelect
        Next
    WEnd
EndFunc ;_ToolbarPreview

Func _Information_Window()
    Local $iGUI, $gimsg, $oIE, $GUIActiveX, $guipos, $x, $y, $startup
    Local $html = "<html><head></head><body bgcolor=#FFFFFC><font face='arial' size=2><center><strong><u>Quicklaunch Toolbar</u></strong></center><p><strong><font color = #E00000>Left Click</font></strong><p>Left-clicking an icon " & _
    "will launch the associated program. Use &quot;Browse for Program&#46;&#46;&#46; &quot; to create a program shortcut&#46;<p><strong><font color = #E00000>Right-click</font></strong><p>Right-clicking will open the Quicklaunch " & _
    "menu. The options for the Quicklaunch toolbar menu are listed below:<p><hr><br><strong><font color = #0000E0>Browse for Program&#46;&#46;&#46;</font></strong><p>Any executable program (*.exe) or (*.msc) may be chosen to populate " & _
    "the Quicklaunch Toolbar. In addition, you may choose any Word document, Excel workbook or PDF, which will be launched by its associated program.<p><strong><font color = #0000E0>Browse for Folder&#46;&#46;&#46;</font></strong><p> " & _
    "A folder may be selected which will display the contents of the selected folder when launched. A generic yellow folder icon will be created but may be changed.<p><strong><font color = #0000E0>System Buttons</font></strong><p>These are " & _
    "applications that are not available in the Program Files directory; they are listed here for the simplification of adding them to the toolbar. These include Control Panel, Administrative Tools, Display Settings, Services, " & _
    "System Settings.<p><hr><br><strong><font color = #0000E0>Change Label Name</font></strong><p>This allows the name of the application to be changed. This name appears when the mouse hovers over the application button." & _
    "<p><strong><font color = #0000E0>Change Icon</font></strong><p>The icon may be changed by using any *.exe or *.ico file. In addition, system icons may be used from the shell32.dll and imageres.dll libraries." & _
    "<p><p><strong><font color = #0000E0>Replace with Separator</font></strong><p>A button may be turned into a separator in order to group buttons together. In addition, separators allow the toolbar to be dragged and moved to a " & _
    "new location.<p><hr><br><strong><font color = #0000E0>Add New Button</font></strong><p>A new button will be created on the spot where the mouse button was pressed. This button will not be active and must have a program associated with it " & _
    "before it will function.<p><strong><font color = #0000E0>Add New Separator</font></strong><p>A new separator will be created on the spot where the mouse button was pressed.<p><hr><br><strong><font color = #0000E0>Delete Button</font></strong><p>" & _
    "The selected button or separator will be removed.<p><strong><font color = #0000E0>Move Button To&#46;&#46;&#46;</font></strong><p>The selected button will move to whichever position is clicked next. " & _
    "The other buttons between the two being moved will move one space over.<p><hr><br><strong><font color = #0000E0>Vertical/Horizontal Toolbar</font></strong><p>Switch the orientation of the toolbar from horizontal to vertical or vice versa." & _
    "<p><hr><br><strong><font color = #0000E0>Change Appearance</font></strong><p>This option allows you to change the icon size to either system tray icon size or taskbar icon size. You may also change the toolbar background color using " & _
    "either an RGB slider to choose your own custom color or one of the 16 preset colors to make the color selection process easier. Press the Reset button to cancel changes and go back to your previous color selection." & _
    "<p><hr><br><strong><font color = #0000E0>Other Information</font></strong><p>The toolbar snaps to the window edge, meaning that if the toolbar is close to the edge of the desktop, it will snap in place on the edge. " & _
    "A horizontal toolbar will snap to the top and bottom; a vertical toolbar will snap to the left and right.</font></body></html>"
    FileWrite(@TempDir & "\Quicklaunch Info.htm", $html)
    ;Center the GUI on the screen where the toolbar resides
    $guipos = WinGetPos($maingui)
    If Not @error Then
        If $guipos[0] < 0 Then
            $x = -(@DesktopWidth+800)/2
            $y = -1
        ElseIf $guipos[0] > @DesktopWidth Then
            $x = ((@DesktopWidth-800)/2) + @DesktopWidth
            $y = -1
        Else
            $x = -1
            $y = -1
        EndIf
    Else
        $x = -1
        $y = -1
    EndIf
    $oIE = ObjCreate("Shell.Explorer.2")
    $iGUI = GUICreate("Quicklaunch Toolbar " & FileGetVersion(@ScriptFullPath) & " - Created by My Name", 800, 630, $x, $y, BitOR(0x00C00000, 0x80000000, 0x00080000))
    GUISetFont(10)
    $GUIActiveX = GUICtrlCreateObj($oIE, 0, 30, 800, 600)
    $oIE.navigate(@TempDir & "\Quicklaunch Info.htm")
    $startup = GUICtrlCreateCheckbox("Start Quicklaunch Toolbar when Windows starts", 2, 5, 300, 20)
    ;Select the button if the path already exists
    If FileExists(@StartUpDir & "\Quicklaunch Toolbar.lnk") Then
        GUICtrlSetState($startup, 1)
    Else
        GUICtrlSetState($startup, 4)
    EndIf
    GUISetState()
    While 1
        $gimsg = GUIGetMsg()
        Select
            Case $gimsg = -3
                GUIDelete($iGUI)
                FileDelete(@TempDir & "\Quicklaunch Info.htm")
                $iGUI = ""
                $gimsg = ""
                $oIE = ""
                $GUIActiveX = ""
                $html = ""
                $guipos = ""
                Return
            Case $gimsg = $startup
                If GUICtrlRead($startup) = 1 Then
                    ;Create the shortcut
                    FileCreateShortcut(@ScriptDir & "\Quicklaunch Toolbar.exe", @StartUpDir & "\Quicklaunch Toolbar.lnk")
                Else
                    ;Delete the shortcut
                    FileDelete(@StartUpDir & "\Quicklaunch Toolbar.lnk")
                EndIf
        EndSelect
    Wend
EndFunc ;_Information_Window

Func _Appearance()
    Local $rgbRed, $rgbGreen, $rgbBlue, $btnSmall, $btnLarge, $btnShow, $lblRedValue, $lblGreenValue, $lblBlueValue, $lblColorValue, $tbSize
    Local $BGColor, $readRed, $readGreen, $readBlue, $prevRed, $prevGreen, $prevBlue, $token = 0
    Local $gCMsg, $btnReset, $btnSave, $iniRed, $iniGreen, $iniBlue, $iniSize, $guipos, $x, $y, $color[16], $hex[16]
    ;Center the GUI on the screen where the toolbar resides
    $guipos = WinGetPos($maingui)
    If Not @error Then
        If $guipos[0] < 0 Then
            $x = -(@DesktopWidth+350)/2
            $y = -1
        ElseIf $guipos[0] > @DesktopWidth Then
            $x = ((@DesktopWidth-350)/2) + @DesktopWidth
            $y = -1
        Else
            $x = -1
            $y = -1
        EndIf
    Else
        $x = -1
        $y = -1
    EndIf
    GUICreate("Change Appearance", 350, 300, $x, $y)
    GUISetFont(10)
    ;Put the current color levels into variables
    $iniRed = Dec(StringMid($inicolor, 3, 2))
    $iniGreen = Dec(StringMid($inicolor, 5, 2))
    $iniBlue = Dec(StringMid($inicolor, 7, 2))
    $iniSize = IniRead(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Size", 24)
    ;Show the menu for the toolbar size
    GUICtrlCreateLabel("Toolbar Size:", 5, 10, 120, 20)
    GUICtrlSetFont(-1, 11, 1000)
    ;Create icons to show the sizes
    $btnSmall = GUICtrlCreateCheckbox("Small", 5, 35, 60, 25, 0x1000)
    $btnLarge = GUICtrlCreateCheckbox("Large", 75, 35, 60, 25, 0x1000)
    GUICtrlCreateLabel("Example:", 160, 40, 60, 20)
    If $iniSize = 24 Then
        $btnShow = GUICtrlCreateButton("", 225, 35, 24, 24, BitOR(0x8000, 0x0040)) ;$BS_FLAT, $BS_ICON
        GUICtrlSetImage($btnShow, "C:\Windows\explorer.exe", 0, 0)
    Else
        $btnShow = GUICtrlCreateButton("", 225, 35, 38, 38, BitOR(0x8000, 0x0040)) ;$BS_FLAT, $BS_ICON
        GUICtrlSetImage($btnShow, "C:\Windows\explorer.exe", 0, 1)
    EndIf
    ;Label for color
    GUICtrlCreateLabel("Toolbar Color:", 5, 80, 120, 20)
    GUICtrlSetFont(-1, 11, 1000)
    ;RGB Labels
    GUICtrlCreateLabel("R", 5, 110, 20, 20)
    GUICtrlSetFont(-1, 12, 1000)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlCreateLabel("G", 5, 140, 20, 20)
    GUICtrlSetFont(-1, 12, 1000)
    GUICtrlSetColor(-1, 0x008000)
    GUICtrlCreateLabel("B", 5, 170, 20, 20)
    GUICtrlSetFont(-1, 12, 1000)
    GUICtrlSetColor(-1, 0x0000FF)
    ;RGB Value labels
    $lblRedValue = GUICtrlCreateLabel(0, 315, 110, 20, 20)
    GUICtrlSetData($lblRedValue, $iniRed)
    $lblGreenValue = GUICtrlCreateLabel(0, 315, 140, 20, 20)
    GUICtrlSetData($lblGreenValue, $iniGreen)
    $lblBlueValue = GUICtrlCreateLabel(0, 315, 170, 20, 20)
    GUICtrlSetData($lblBlueValue, $iniBlue)
    ;RGB Sliders
    $rgbRed = GUICtrlCreateSlider(25, 110, 281, 25)
    $rgbGreen = GUICtrlCreateSlider(25, 140, 281, 25)
    $rgbBlue = GUICtrlCreateSlider(25, 170, 281, 25)
    ;Set the upper and lower limits of the sliders
    GUICtrlSetLimit($rgbRed, 255, 0)
    GUICtrlSetLimit($rgbGreen, 255, 0)
    GUICtrlSetLimit($rgbBlue, 255, 0)
    ;Set the default data for the sliders (read from the INI file)
    GUICtrlSetData($rgbRed, $iniRed)
    GUICtrlSetData($rgbGreen, $iniGreen)
    GUICtrlSetData($rgbBlue, $iniBlue)
    ;Set the default color value (read from the INI file)
    $lblColorValue = GUICtrlCreateLabel("", 5, 210, 340, 25)
    GUICtrlSetBkcolor($lblColorValue, $inicolor)
    ;Create the buttons
    $color[0] = GUICtrlCreateButton("", 5, 240, 25, 25)
    GUICtrlSetBkColor($color[0], 0xFF0000)
    GUICtrlSetTip($color[0], "Red")
    $hex[0] = "0xFF0000"
    $color[1] = GUICtrlCreateButton("", 40, 240, 25, 25)
    GUICtrlSetBkColor($color[1], 0x008000)
    GUICtrlSetTip($color[1], "Green")
    $hex[1] = "0x008000"
    $color[2] = GUICtrlCreateButton("", 75, 240, 25, 25)
    GUICtrlSetBkColor($color[2], 0x0000FF)
    GUICtrlSetTip($color[2], "Blue")
    $hex[2] = "0x0000FF"
    $color[3] = GUICtrlCreateButton("", 110, 240, 25, 25)
    GUICtrlSetBkColor($color[3], 0x00FFFF)
    GUICtrlSetTip($color[3], "Cyan")
    $hex[3] = "0x00FFFF"
    $color[4] = GUICtrlCreateButton("", 145, 240, 25, 25)
    GUICtrlSetBkColor($color[4], 0xFF00FF)
    GUICtrlSetTip($color[4], "Magenta")
    $hex[4] = "0xFF00FF"
    $color[5] = GUICtrlCreateButton("", 180, 240, 25, 25)
    GUICtrlSetBkColor($color[5], 0xFFFF00)
    GUICtrlSetTip($color[5], "Yellow")
    $hex[5] = "0xFFFF00"
    $color[6] = GUICtrlCreateButton("", 215, 240, 25, 25)
    GUICtrlSetBkColor($color[6], 0xFF8000)
    GUICtrlSetTip($color[6], "Orange")
    $hex[6] = "0xFF8000"
    $color[7] = GUICtrlCreateButton("", 250, 240, 25, 25)
    GUICtrlSetBkColor($color[7], 0x008080)
    GUICtrlSetTip($color[7], "Teal")
    $hex[7] = "0x008080"
    $color[8] = GUICtrlCreateButton("", 285, 240, 25, 25)
    GUICtrlSetBkColor($color[8], 0x800080)
    GUICtrlSetTip($color[8], "Purple")
    $hex[8] = "0x800080"
    $color[9] = GUICtrlCreateButton("", 320, 240, 25, 25)
    GUICtrlSetBkColor($color[9], 0x00FF00)
    GUICtrlSetTip($color[9], "Chartreuse")
    $hex[9] = "0x00FF00"
    $color[10] = GUICtrlCreateButton("", 75, 270, 25, 25)
    GUICtrlSetBkColor($color[10], 0xFFFFFF)
    GUICtrlSetTip($color[10], "White")
    $hex[10] = "0xFFFFFF"
    $color[11] = GUICtrlCreateButton("", 110, 270, 25, 25)
    GUICtrlSetBkColor($color[11], 0xCFCFCF)
    GUICtrlSetTip($color[11], "Light gray")
    $hex[11] = "0xCFCFCF"
    $color[12] = GUICtrlCreateButton("", 145, 270, 25, 25)
    GUICtrlSetBkColor($color[12], 0x9F9F9F)
    GUICtrlSetTip($color[12], "Medium gray")
    $hex[12] = "0x9F9F9F"
    $color[13] = GUICtrlCreateButton("", 180, 270, 25, 25)
    GUICtrlSetBkColor($color[13], 0x6F6F6F)
    GUICtrlSetTip($color[13], "Dark gray")
    $hex[13] = "0x6F6F6F"
    $color[14] = GUICtrlCreateButton("", 215, 270, 25, 25)
    GUICtrlSetBkColor($color[14], 0x3F3F3F)
    GUICtrlSetTip($color[14], "Carbon")
    $hex[14] = "0x3F3F3F"
    $color[15] = GUICtrlCreateButton("", 250, 270, 25, 25)
    GUICtrlSetBkColor($color[15], 0x000000)
    GUICtrlSetTip($color[15], "Black")
    $hex[15] = "0x000000"
    $btnReset = GUICtrlCreateButton("Reset", 5, 270, 60, 25)
    $btnSave = GUICtrlCreateButton("Save", 285, 270, 60, 25)
    GUISetState()
    ;Set the background color so it will not accidentally change to black if the form is saved without making a change
    $BGColor = "0x" &  Hex(GUICtrlRead($rgbRed), 2) &  Hex(GUICtrlRead($rgbGreen), 2) &  Hex(GUICtrlRead($rgbBlue), 2)
    ;Put the size attribute in the buttons
    If $iniSize = 24 Then
        GUICtrlSetState($btnSmall, 1)
    Else
        GUICtrlSetState($btnLarge, 1)
    EndIf
    ;Begin the loop
    While 1
        $gCMsg = GUIGetMsg()
        Switch $gCMsg
            Case -3
                GUIDelete()
                Return 0
            Case $btnSave
                If GUICtrlRead($btnSmall) = 4 Then
                    $tbSize = 38
                Else
                    $tbSize = 24
                EndIf
                IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Background", $BGColor)
                IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Size", $tbSize)
                GUIDelete()
                Return 1
            Case $btnReset
                GUICtrlSetData($rgbRed, $iniRed)
                GUICtrlSetData($rgbGreen, $iniGreen)
                GUICtrlSetData($rgbBlue, $iniBlue)
            Case $color[0] To $color[15]
                For $i = 0 to UBound($color) - 1
                    If $color[$i] = $gCMsg Then
                        GUICtrlSetData($rgbRed, Dec(StringMid($hex[$i], 3, 2)))
                        GUICtrlSetData($rgbGreen, Dec(StringMid($hex[$i], 5, 2)))
                        GUICtrlSetData($rgbBlue, Dec(StringMid($hex[$i], 7, 2)))
                    EndIf
                Next
            Case $btnSmall
                If GUICtrlRead($btnSmall) = 1 Then
                    GUICtrlDelete($btnShow)
                    GUICtrlSetState($btnLarge, 4)
                    GUICtrlCreateButton("", 225, 35, 24, 24, BitOR(0x8000, 0x0040, 0x1000))
                    GUICtrlSetImage(-1, "C:\Windows\explorer.exe", 0, 0)
                ;Check the other button if this one is unchecked
                ElseIf GUICtrlRead($btnSmall) = 4 Then
                    GUICtrlSetState($btnLarge, 1)
                    GUICtrlDelete($btnShow)
                    GUICtrlSetState($btnSmall, 4)
                    GUICtrlCreateButton("", 225, 35, 38, 38, BitOR(0x8000, 0x0040, 0x1000))
                    GUICtrlSetImage(-1, "C:\Windows\explorer.exe", 0, 1)
                EndIf
            Case $btnLarge
                If GUICtrlRead($btnLarge) = 1 Then
                    GUICtrlDelete($btnShow)
                    GUICtrlSetState($btnSmall, 4)
                    GUICtrlCreateButton("", 225, 35, 38, 38, BitOR(0x8000, 0x0040, 0x1000))
                    GUICtrlSetImage(-1, "C:\Windows\explorer.exe", 0, 1)
                ;Check the other button if this one is unchecked
                ElseIf GUICtrlRead($btnLarge) = 4 Then
                    GUICtrlSetState($btnSmall, 1)
                    GUICtrlDelete($btnShow)
                    GUICtrlSetState($btnLarge, 4)
                    GUICtrlCreateButton("", 225, 35, 24, 24, BitOR(0x8000, 0x0040, 0x1000))
                    GUICtrlSetImage(-1, "C:\Windows\explorer.exe", 0, 0)
                EndIf
        EndSwitch
        $readRed = GUICtrlRead($rgbRed)
        $readGreen = GUICtrlRead($rgbGreen)
        $readBlue = GUICtrlRead($rgbBlue)
        If $readRed <> $prevRed Then $token = 1
        If $readGreen <> $prevGreen Then $token = 1
        If $readBlue <> $prevBlue Then $token = 1
        If $token = 1 Then
            $token = 0
            $BGColor = "0x" &  Hex(GUICtrlRead($rgbRed), 2) &  Hex(GUICtrlRead($rgbGreen), 2) &  Hex(GUICtrlRead($rgbBlue), 2)
            GUICtrlSetBkColor($lblColorValue, $BGColor)
            GUICtrlSetData($lblRedValue, GUICtrlRead($rgbRed))
            GUICtrlSetData($lblGreenValue, GUICtrlRead($rgbGreen))
            GUICtrlSetData($lblBlueValue, GUICtrlRead($rgbBlue))
        EndIf
        $prevRed = $readRed
        $prevGreen = $readGreen
        $prevBlue = $readBlue
    WEnd
EndFunc ;_Appearance

;Horizonal buttons
Func _ToolBarButton_H($iNumber, $iDLL = "imageres.dll")
    Local $Xhadd, $TBBleft
    $tbcnt = $tbcnt + 1
    $TBBleft = $tbcnt * $iconsize
    $Xhadd = GUICtrlCreateButton("", $TBBleft, 0, $iconsize, $iconsize, 0x0040)
    GUICtrlSetImage($Xhadd, $iDLL, $iNumber, $size)
    Return $Xhadd
EndFunc ;_ToolBarButton_H

;Vertical buttons
Func _ToolBarButton_V($iNumber, $iDLL = "imageres.dll")
    Local $Xhadd, $TBBleft
    $tbcnt = $tbcnt + 1
    $TBBleft = $tbcnt * $iconsize
    $Xhadd = GUICtrlCreateButton("", 0, $TBBleft, $iconsize, $iconsize, 0x0040)
    GUICtrlSetImage($Xhadd, $iDLL, $iNumber, $size)
    Return $Xhadd
EndFunc ;_ToolBarButton_V

;Horizonal separators
Func _ToolBarSeparator_H()
    Local $Xhadd, $TBBleft
    $tbcnt = $tbcnt + .5
    $TBBleft = $tbcnt * $iconsize
    $Xhadd = GUICtrlCreateLabel("", $TBBleft+($iconsize/2), 0, $iconsize/2, $iconsize, -1, 0x00100000)
    GUICtrlSetBkColor($Xhadd, $inicolor)
    Return $Xhadd
EndFunc ;_ToolBarSeparator_H

;Vertical separators
Func _ToolBarSeparator_V()
    Local $Xhadd, $TBBleft
    $tbcnt = $tbcnt + .5
    $TBBleft = $tbcnt * $iconsize
    $Xhadd = GUICtrlCreateLabel("", 0, $TBBleft+($iconsize/2), $iconsize, $iconsize/2, -1, 0x00100000)
    GUICtrlSetBkColor($Xhadd, $inicolor)
    Return $Xhadd
EndFunc ;_ToolBarSeparator_V

Func _WinDock()
    ;Get the position of the task bar
    Local $taskbarpos = WinGetPos("[CLASS:Shell_TrayWnd]") ;X, Y, W, H
    If @error Then SetError(2) ;Cannot get position of task bar
    Local $guipos = WinGetPos($maingui)
    If @error Then SetError(3) ;Cannot get position of GUI window
    Local $XMove, $YMove, $Monitor[6][2], $Move[6]
    If $iniorient = "V" Then
        ;Farthest Left Monitor - Left Side
        $Monitor[0][0] = -(@DesktopWidth)*2
        $Monitor[0][1] = -(@DesktopWidth)+$iconsize
        $Move[0] = -(@DesktopWidth)
        ;Farthest Left Monitor - Right Side
        $Monitor[1][0] = -($iconsize*2)
        $Monitor[1][1] = -$iconsize*.5
        $Move[1] = -($iconsize)
        ;Default Monitor - Left Side
        $Monitor[2][0] = -$iconsize*.5
        $Monitor[2][1] = $iconsize
        $Move[2] = 0
        ;Default Monitor - Right Side
        $Monitor[3][0] = @DesktopWidth-($iconsize*2)
        $Monitor[3][1] = @DesktopWidth
        $Move[3] = @DesktopWidth-$iconsize
        ;Farthest Right Monitor - Left Side
        $Monitor[4][0] = @DesktopWidth
        $Monitor[4][1] = @DesktopWidth + $iconsize
        $Move[4] =  @DesktopWidth
        ;Farthest Monitor - Right Side
        $Monitor[5][0] = (@DesktopWidth*2)-($iconsize*2)
        $Monitor[5][1] = (@DesktopWidth*3)
        $Move[5] = (@DesktopWidth*2)
        ;Vertical orientation
        ;If the task bar is on the left or right
        ;If there is a taskbar, change the default positioning
        If  _TaskBarPos() = "L" Then
            ;Farthest Left Monitor
            If $taskbarpos[0] < 0 Then
                $Monitor[0][0] = $taskbarpos[0]-$iconsize
                $Monitor[0][1] = $taskbarpos[0]+$taskbarpos[2]+$iconsize
                $Move[0] = $taskbarpos[0]+$taskbarpos[2]
            EndIf
            ;Default Monitor
            If $taskbarpos[0] = 0 Then
                $Monitor[2][0] = $taskbarpos[0]-$iconsize
                $Monitor[2][1] = $taskbarpos[0]+$taskbarpos[2]+$iconsize
                $Move[2] = $taskbarpos[0]+$taskbarpos[2]
            EndIf
            ;Farthest Right Monitor
            If $taskbarpos[0] > 0 Then
                $Monitor[4][0] = $taskbarpos[0]-$iconsize
                $Monitor[4][1] = $taskbarpos[0]+$taskbarpos[2]+$iconsize
                $Move[4] = $taskbarpos[0]+$taskbarpos[2]
            EndIf
        ElseIf _TaskBarPos() = "R" Then
            ;Farthest Left Monitor
            If $taskbarpos[0] < 0 Then
                $Monitor[1][0] = $taskbarpos[0]-($iconsize*2)
                $Monitor[1][1] = $taskbarpos[0]+$taskbarpos[2]
                $Move[1] = $taskbarpos[0]-$iconsize
            EndIf
            ;Default Monitor
            If $taskbarpos[0] > 0 And $taskbarpos[0] < @DesktopWidth Then
                $Monitor[3][0] = $taskbarpos[0]-($iconsize*2)
                $Monitor[3][1] = $taskbarpos[0]+$taskbarpos[2]
                $Move[3] = $taskbarpos[0]-$iconsize
            EndIf
            ;Farthest Right Monitor
            If $taskbarpos[0] > @DesktopWidth Then
                $Monitor[5][0] = $taskbarpos[0]-($iconsize*2)
                $Monitor[5][1] = $taskbarpos[0]+$taskbarpos[2]
                $Move[5] = $taskbarpos[0]-$iconsize
            EndIf
        EndIf
        ;Move the toolbar outside of the taskbar position
        For $i = 0 To 5
            If $guipos[0] >= $Monitor[$i][0] And $guipos[0] <= $Monitor[$i][1] Then WinMove($maingui, "", $Move[$i], $guipos[1])
        Next
        $taskbarpos = ""
        $guipos = ""
        $Monitor = ""
        $Move = ""
    ElseIf $iniorient = "H" Then
        ;Farthest Top Monitor - Top Side
        $Monitor[0][0] = -(@DesktopHeight)*2
        $Monitor[0][1] = -(@DesktopHeight)+$iconsize
        $Move[0] = -(@DesktopHeight)
        ;Farthest Top Monitor - Bottom Side
        $Monitor[1][0] = -($iconsize*2)
        $Monitor[1][1] = -($iconsize*.5)
        $Move[1] = -($iconsize)
        ;Default Monitor - Top Side
        $Monitor[2][0] = $iconsize
        $Monitor[2][1] = -($iconsize*.5)
        $Move[2] = 0
        ;Default Monitor - Bottom Side
        $Monitor[3][0] = @DesktopHeight-($iconsize*2)
        $Monitor[3][1] = @DesktopHeight+($iconsize*.5)
        $Move[3] = @DesktopHeight-$iconsize
        ;Farthest Bottom Monitor - Top Side
        $Monitor[4][0] = @DesktopHeight
        $Monitor[4][1] = @DesktopHeight + $iconsize
        $Move[4] =  @DesktopHeight
        ;Farthest Bottom - Bottom Side
        $Monitor[5][0] = (@DesktopHeight*2)-($iconsize*2)
        $Monitor[5][1] = (@DesktopHeight*3)
        $Move[5] = (@DesktopHeight*2)
        ;Norizontal orientation
        ;If the task bar is on the bottom or top
        If _TaskBarPos() = "T" Then
            ;Farthest Top Monitor
            If $taskbarpos[1] < 0 Then
                $Monitor[0][0] = ($taskbarpos[1]-$iconsize)
                $Monitor[0][1] = ($taskbarpos[1]+$taskbarpos[3]+($iconsize*2))
                $Move[0] = $taskbarpos[1]+$taskbarpos[3]
            EndIf
            ;Default Monitor
            If $taskbarpos[1] >= 0 And $taskbarpos[1] < @DesktopHeight Then
                $Monitor[2][0] = ($taskbarpos[1]-$iconsize)
                $Monitor[2][1] = ($taskbarpos[1]+$taskbarpos[3]+($iconsize*2))
                $Move[2] = $taskbarpos[1]+$taskbarpos[3]
            EndIf
            ;Farthest Bottom Monitor
            If $taskbarpos[1] > @DesktopHeight Then
                $Monitor[4][0] = ($taskbarpos[1]-$iconsize)
                $Monitor[4][1] = ($taskbarpos[1]+$taskbarpos[3]+($iconsize*2))
                $Move[4] = $taskbarpos[1]+$taskbarpos[3]
            EndIf
            ElseIf _TaskBarPos() = "B" Then
;           MsgBox(0, "B", $taskbarpos[1] & ", " & $taskbarpos[3])
            ;Farthest Top Monitor
            If $taskbarpos[1] < 0 Then
                $Monitor[1][0] = $taskbarpos[1]-($iconsize*2)
                $Monitor[1][1] = $taskbarpos[1]+$taskbarpos[3]+$iconsize
                $Move[1] = $taskbarpos[1]-$iconsize
            EndIf
            ;Default Monitor
            If $taskbarpos[1] > 0 And $taskbarpos[1] < @DesktopHeight Then
                $Monitor[3][0] = $taskbarpos[1]-($iconsize*2)
                $Monitor[3][1] = $taskbarpos[1]+$taskbarpos[3]+$iconsize
                $Move[3] = $taskbarpos[1]-$iconsize
            EndIf
            ;Farthest Bottom Monitor
            If $taskbarpos[1] > @DesktopHeight Then
                $Monitor[5][0] = $taskbarpos[1]-($iconsize*2)
                $Monitor[5][1] = $taskbarpos[1]+$taskbarpos[3]+$iconsize
                $Move[5] = $taskbarpos[1]-$iconsize
            EndIf
        EndIf
        ;Move the toolbar outside of the taskbar position
        For $i = 0 To 5
            If $guipos[1] >= $Monitor[$i][0] And $guipos[1] <= $Monitor[$i][1] Then WinMove($maingui, "", $guipos[0], $Move[$i])
        Next
        $taskbarpos = ""
        $guipos = ""
        $Monitor = ""
        $Move = ""
    EndIf
EndFunc ;_WinDock

;Get the taskbar position (T)op, (B)ottom, (L)eft, (R)ight, (N)one
Func _TaskBarPos()
    Local $pos, $taskbarpos = WinGetPos("[Class:Shell_TrayWnd]", "")
    ;Find out the position of the Start bar
    If ($taskbarpos[1] = 0-$taskbarpos[3] Or $taskbarpos[1] = @DesktopHeight-$taskbarpos[3] Or $taskbarpos[1] = (@DesktopHeight*2)-$taskbarpos[3]) And $taskbarpos[2] > 200 Then
        $pos = "B" ;taskbar on the bottom
    ElseIf ($taskbarpos[0] = (0-$taskbarpos[2]) Or $taskbarpos[0] = (@DesktopWidth-$taskbarpos[2]) Or $taskbarpos[0] = (@DesktopWidth*2)-$taskbarpos[2]) And $taskbarpos[1] = 0 And $taskbarpos[2] < 500 Then
        $pos = "R" ;taskbar on the right
    ElseIf ($taskbarpos[0] = -(@DesktopWidth) Or $taskbarpos[0] = 0 Or $taskbarpos[0] = (@DesktopWidth*2-$taskbarpos[2])) And $taskbarpos[2] < 500 And $taskbarpos[3] = @DesktopHeight Then
        $pos = "L" ;taskbar on the left
    ElseIf ($taskbarpos[1] = 0 Or $taskbarpos[1] = @DesktopHeight Or $taskbarpos[1] = @DesktopHeight*2) And $taskbarpos[2] > 200 Then
        $pos = "T" ;taskbar on the top
    Else
        $pos = "N" ;no taskbar
    EndIf
    $taskbarpos = ""
    Return $pos
EndFunc ;_TaskBarPos

Func _SetPosition($x = -1, $y = -1)
    ;Get the last position of the toolbar before it closes
    Local $guipos = WinGetPos($maingui)
    If Not @error Then
        If $x = -1 Then $x = $guipos[0]
        If $y = -1 Then $y = $guipos[1]
    Else
        $x = $left
        $y = $top
    EndIf
    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Left", $x)
    IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Top", $y)
EndFunc ;_SetPosition

Func _ChangeOrientation()
    Local $guipos
    If $borient = 2 Then ;Vertical to Horizontal
        $guipos = WinGetPos($maingui)
        If Not @error Then
            $xPosV = $guipos[0]
            $yPosV = $guipos[1]
        Else
            $xPosV = $barsize
            $yPosV = @DesktopHeight-$iconsize
        EndIf
        ;Determine which monitor the toobar is located and position it based on display size
        If $xPosV < 0 Then
            ;The left secondary monitor on multi-monitor display
            $xPos = -(@DesktopWidth+$barsize)/2
        ElseIf $xPosV > @DesktopWidth Then
            ;Right secondary monitor on multi-monitor display
            $xPos = ((@DesktopWidth-$barsize)/2) + @DesktopWidth
        Else
            ;Primary monitor
            $xPos = (@DesktopWidth-$barsize)/2
        EndIf
        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Orientation", "H")
        ;No previous position saved
        If $yPosH == "" Then
            ;Center the X position and the Y position to the bottom
            _SetPosition($xPos, @DesktopHeight-$iconsize) ;Bottom of the screen (centered)
        Else
            ;Put the toolbar back where it was originally
            _SetPosition($xPosH, $yPosH)
        EndIf
        GUIDelete($maingui)
        _ToolbarPreview()
    ElseIf $borient = 1 Then ;Horizontal to Vertical
        $guipos = WinGetPos($maingui)
        If Not @error Then
            $xPosH = $guipos[0]
            $yPosH = $guipos[1]
        Else
            $xPosH = (@DesktopWidth-$barsize)/2
            $yPosH = @DesktopHeight-$iconsize
        EndIf
        ;Determine which monitor the toobar is located and position it based on display size
        If $xPosH < 0 Then
            ;The left secondary monitor on multi-monitor display
            $xPos = 0 - $iconsize
        ElseIf $xPosH > @DesktopWidth Then
            ;Right secondary monitor on multi-monitor display
            $xPos = @DesktopWidth
        Else
            ;Primary monitor
            $xPos = 0
        EndIf
        ;Change the orientation from horizontal to vertical
        IniWrite(@MyDocumentsDir & "\Quicklaunch Prefs.ini", "Preferences", "Orientation", "V")
        ;No previous position saved
        If $yPosV == "" Then
            ;Set the X position to the toolbar height and the Y position to the center
            _SetPosition($xPos, (@DesktopHeight-$barsize)/2)
        Else
            ;Set the X position to the previous position recorded and center the Y position
            _SetPosition($xPosV, $yPosV)
        EndIf
    EndIf
EndFunc ;_ChangeOrientation

;Close if there is already and instance running
Func _SingleInstance()
    Local $plist, $i
    $plist = ProcessList()
    For $i = 1 to $plist[0][0]
        If $plist[$i][0] = @ScriptName And $plist[$i][1] <> @AutoItPID Then
            Exit
        EndIf
    Next
EndFunc ;_SingleInstance

;Updates the program if a new version is available
Func _UpdateSelf($fullpath)
    Local $cmd
    FileDelete(@TempDir & "\UpdateSelf.bat")
    $cmd = ':loop' & @CRLF & 'del "' & $fullpath & '"' & @CRLF & _
        'if exist "' & $fullpath & '" goto loop' & @CRLF & _
        ':loop2' & @CRLF & _
        'copy /Y "U:\IT\Save\Quicklaunch Toolbar.exe" "' & $fullpath & '"' & @CRLF & _
        'if not exist "' & $fullpath & '" goto loop2' & @CRLF & _
        '"' & @ScriptFullPath & '"' & @CRLF & _
        'del "' & @TempDir & '\UpdateSelf.bat"'
    FileWrite(@TempDir & "\UpdateSelf.bat", $cmd)
    Run(@TempDir & "\UpdateSelf.bat", @TempDir, @SW_HIDE)
EndFunc ;_UpdateSelf

;Updates GUI icons, labels and state of navigate buttons
Func _GUIUpdate()
    For $iCntRow = 0 to 4
        For $iCntCol = 0 to 9
            $iCurIndex = $iCntRow * 10 + $iCntCol
            If ($iCurIndex + $iStartIndex) > $glNames[0] Then
                GUICtrlSetState($ahIcons[$iCurIndex], 32)
            Else
                GUICtrlSetState($ahIcons[$iCurIndex], 16)
                GUICtrlSetImage($ahIcons[$iCurIndex], $glFileName, -($iStartIndex + $iCurIndex))
            EndIf
        Next
    Next
    ;Keep icons in bounds
    If $iStartIndex = 1 Then
        GUICtrlSetState($hPrev, 128)
    Else
        GUICtrlSetState($hPrev, 64)
    Endif
    If $iStartIndex + 50 > $glNames[0] Then
        GUICtrlSetState($hNext, 128)
    Else
        GUICtrlSetState($hNext, 64)
    Endif
    Local $iToNumber = $iStartIndex + 49
    If $iToNumber > $glNames[0] Then $iToNumber = $iToNumber - ($iToNumber - $glNames[0])
    GUICtrlSetData($hStatus, " " & $iStartIndex & " - " & $iToNumber & " of " & $glNames[0])
EndFunc ;_GUIUpdate

Func _NewFileLoad($sFilename)
    $iStartIndex = 1
    ReDim $glNames[1]
    If StringRight($sFilename, 4) = ".icl" Then
        $glNames[0] = _GetIconCount($sFilename)
        Return 1
    EndIf
    $glNames[0] = 0
    Local $hMod = DllCall("Kernel32.dll", "int", "LoadLibraryEx", "str", $sFilename, "int", 0, "int", 0x22)
    If $hMod[0] = 0 Then
        MsgBox (48, "Error", "Not a library or can't load library.")
        Return 0
    EndIf
    $hMod = $hMod[0]
    Local $hStub_EnumResNames = DllCallBackRegister("_EnumResNames", "int", "int;ptr;ptr;ptr")
    DllCall("kernel32.dll", "int:stdcall", "EnumResourceNames", "int", $hMod, "ptr", 14, "ptr", DllCallbackGetPtr($hStub_EnumResNames), "long*", 0)
    DllCallBackFree ($hStub_EnumResNames)
    DllCall("Kernel32.dll", "int", "FreeLibrary", "int", $hMod)
EndFunc ;_NewFileLoad

Func _EnumResNames($hModule, $lpType, $lpName, $lParam)
    $glNames[0] += 1
    ReDim $glNames[$glNames[0]+1]
    If BitAND($lpName, 0xFFFF0000) Then
        Local $s = DllStructCreate("char[256]", $lpName)
        $glNames[$glNames[0]] = DllStructGetData($s, 1)
    Else
        $glNames[$glNames[0]] = String(Number($lpName))
    EndIf
    Return 1
EndFunc ;_EnumResNames

Func _GetIconCount($sFilename)
    Local $iCount = DllCall("ImageRes", "int", "ExtractIconEx", "str", $sFilename, "int", -1, "ptr", 0, "ptr", 0, "int", 1)
    If not @error Then Return $iCount[0]
    Return 0
EndFunc ;_GetIconCount

Here is the SciTE output:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Scripts\Testing\Quicklaunch Toolbar.au3" /UserParams    
+>07:48:53 Starting AutoIt3Wrapper v.15.920.938.0 SciTE v.3.6.0.0   Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0409)
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\ChriBlos\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\ChriBlos\AppData\Local\AutoIt v3\SciTE
>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\Scripts\Testing\Quicklaunch Toolbar.au3
+>07:48:53 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Scripts\Testing\Quicklaunch Toolbar.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
+>07:48:55 AutoIt3.exe ended.rc:0
+>07:48:55 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 2.628


Thank you for your assistance.

Edited by Gestalt
Link to comment
Share on other sites

  • Developers

This console output is showing that the script is being executed with AutoIt3.exe, not compiled.

Only had a quick glance at your source: Shouldn't you be doing a test for @Compiled before running  FUNC  _UpdateSelf(@ScriptFullPath)  and only perform that when that is true to avoid running it un-compiled?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

@Jos

You are amazing!

You are absolutely correct, I should have had the script test whether it was compiled before running the _UpdateSelf() function. That was the problem the entire time: the script was replacing itself when it was not compiled. Thank you so much for your help!

Edited by Gestalt
Link to comment
Share on other sites

  • 1 month later...

just for the record....
what I was talking about in my previous post #4 happened again. This time I paid attention about the matter:
The strange behavior of SciTE is like the following:
1) I was on this post: https://www.autoitscript.com/forum/topic/173930-calendar/ (just for this example)
2) click on the link "kalenderfenster_source.zip"
3) a popup appear asking if I want open with 7-Zip File Manager (default) or save file
4) I choose to Open with 7-Zip
5) 7-Zip opens the file and show it's content (the kalenderfenster.au3 file)
6) I double click on the shown file (within the 7-Zip window) and the au3 file is opened in SciTE
7) I press F5 and instead of run the script I'm asked by SciTE to select a file that I want compile.

that's all

If I save the opened file in another file (instead of using directly the one opened from the temp directory of 7-Zip) then it run correctly.

I post here just for curiosity

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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