C:Program FilesAutoIt3IncludeGUIScrollbars_Size.au3(239,65) : ERROR: _GUIScrollbars_Restore() already defined.
I commented out this function in your GUIScrollbars_Size.au3 file but it didn't help.
Current Problem (commenting out the Func _GUIScrollbars_Restore($hWnd, $fVert = True, $fHorz = True) from the C:Program FilesAutoIt3IncludeGUIScrollbars_Size.au3 file:
Here is the code. I wrote a little routine to show the window only when the user moves the mouse off the right edge of the desktop.
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..My H drivelogo.ico
#AutoIt3Wrapper_outfile=H:My DocumentsPopUpTest.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIButton.au3>
#include <File.au3>
#include <array.au3>
;for scroll bars
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
#include "GUIScrollbars_Ex.au3"
#include "GUIScrollbars_Size.au3"
;for "peekaboo effect" right screen show function. Move mouse to the right side of the screen to show the window.
#include <GDIPlus.au3>
#include <Misc.au3>
HotKeySet("{ESC}", "MyExit")
dim $whichfolder, $scrollmarker, $scrollmarker2
Global $NewWidth[1], $NewGUIWidth[1]
; Set the working folder
;~ $sPath = @MyDocumentsDir
$sPath = FileSelectFolder("Choose a folder.", "") & ""
ToolTip("Move your mouse to the rigth margin of the screen to select pamphlets",300,300,"Patient Education Program",2,4)
Sleep(2000)
Tooltip("")
HideTheGUI()
Func HideTheGUI()
While 1
$mpos = MouseGetPos()
Select
Case $mpos[0] > @DesktopWidth-50
MyFolderChoice()
EndSelect
WEnd
EndFunc
Func MyFolderChoice()
; List the folders in the folder - parameter 2
$aList = _FileListToArray($sPath, "*", 2)
_ArrayAdd($aList, "Exit")
$aList[0] = $aList[0] + 1
;Set GUI height based on number of folders
$GuiHeight = $aList[0] *22
If $GuiHeight > @DesktopHeight Then
$scrollmarker = True ; to show or not the sroll bars
$GuiHeight = @DesktopHeight - 100
EndIf
;Set the GUI width based on the longest folder name
For $a = 1 to $aList[0]
$FolderNameLength = $aList[$a]
$FolderNameLength2 =StringLen($FolderNameLength)
_ArrayAdd($NewWidth, $FolderNameLength2)
Next
;~ $NewWidth2 = _ArrayMax($NewWidth,0,1)
$NewWidthSize = _ArrayMax($NewWidth)
$GuiWidth = $NewWidthSize * 8
If $GuiWidth < 200 Then ;Make sure it isn't too thin
$GuiWidth = 200
EndIf
; Create the radio array to match the number of folders
Global $aRadios[$aList[0] + 1] = [$aList[0]]
; Create the GUI
$hGUI = GUICreate("Folder List", $GuiWidth, $GuiHeight, 500, 10, BitOR($WS_SIZEBOX, $WS_POPUP))
; Add the radios
For $i = 1 To $aRadios[0]
$aRadios[$i] = GUICtrlCreateRadio($aList[$i], 20, 20 * $i, 490, 17)
Next
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")
GUISetState()
If $scrollmarker = True Then ;We need the scroll bars
_GUIScrollBars_Init($hGUI)
EndIf
While 1
; Read the event queue
$nMsg = GUIGetMsg()
; Loop through the radio ControlIDs
For $i = 1 To $aRadios[0]
If $nMsg = $aRadios[$i] Then
If GUICtrlRead($aRadios[$i], 1) = "Exit" Then
Exit
EndIf
; Found one!
;~ MsgBox(0, "Pressed", GUICtrlRead($aRadios[$i], 1))
; No point in looking any further
$whichfolder = $sPath & "" & GUICtrlRead($aRadios[$i], 1) ; Set the path to show files
_GUICtrlButton_SetCheck($nMsg, $BST_UNCHECKED)
GUIDelete();Delete the gui
MyFileChoice(); Call the file selection function
ExitLoop
EndIf
Next
WEnd
EndFunc
Func MyFileChoice()
$aList2 = _FileListToArray($whichfolder, "*", 1);file names to array
If $aList2 = 0 Then ;empty folder check
MsgBox(0,"Error","There are no files to print in " & $whichfolder)
MyFolderChoice()
EndIf
_ArrayAdd($aList2, "Cancel") ;add an extra button for cancelling file selection
$aList2[0] = $aList2[0] + 1 ;Fix the number of elements to include the cancel button in the gui
; Create the radio array to match the number of folders
Global $aRadios2[$aList2[0] + 1] = [$aList2[0]]
;Set GUI height based on number of folders
$GuiHeight2 = $aList2[0] * 22
If $GuiHeight2 > @DesktopHeight Then
$scrollmarker2 = True ; to show or not the sroll bars
$GuiHeight2 = @DesktopHeight - 100
ElseIf $GuiHeight2 < 150 Then
$GuiHeight2 = 150
EndIf
;Set the GUI width based on the longest folder name
For $b = 1 to $aList2[0]
$FileNameLength = $aList2[$b]
$FileNameLength2 =StringLen($FileNameLength)
_ArrayAdd($NewGUIWidth, $FileNameLength2)
Next
$NewWidthSize2 = _ArrayMax($NewGUIWidth)
$GuiWidth2 = $NewWidthSize2 * 8
If $GuiWidth2 < 200 Then ;GUI is too thin
$GuiWidth2 = 200
EndIf
; Create the GUI
$hGUI2 = GUICreate("Files List", $GuiWidth2, $GuiHeight2 , 160, 10, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
; Add the radios
For $i = 1 To $aRadios2[0]
$aRadios2[$i] = GUICtrlCreateRadio($aList2[$i],20, 20 * $i, 490, 17)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKWIDTH)
Next
GUISetState()
If $scrollmarker2 = True Then ;We need the scroll bars
_GUIScrollBars_Init($hGUI2)
$aRet = _GUIScrollbars_Size(0, $aRadios2[0] * 20, $GuiWidth2, $GuiHeight2) ; <<<<<<<<<<<<<<<<<<
_GUIScrollBars_SetScrollInfoPage($hGUI2, $SB_VERT, $aRet[2]) ; <<<<<<<<<<<<<<<<<<
_GUIScrollBars_SetScrollInfoMax($hGUI2, $SB_VERT, $aRet[3]) ; <<<<<<<<<<<<<<<<<<
EndIf
;~ If $scrollmarker2 = True Then ;We need the scroll bars
;~ _GUIScrollBars_Init($hGUI2)
;~ $aRet = _GUIScrollbars_Size(0, $aRadios2[0] * 20, $GuiWidth2, $GuiHeight2) ; <<<<<<<<<<<<<<<<<<
;~ _GUIScrollBars_SetScrollInfoPage($hGUI2, $SB_VERT, $aRet[2]) ; <<<<<<<<<<<<<<<<<<
;~ _GUIScrollBars_SetScrollInfoMax($hGUI2, $SB_VERT, $aRet[3]) ; <<<<<<<<<<<<<<<<<<
;~ EndIf
While 1
; Read the event queue
$nMsg2 = GUIGetMsg()
If $nMsg2 = $GUI_EVENT_CLOSE Then
GUIDelete()
HideTheGUI() ;Hide the window
ExitLoop
EndIf
; Loop through the radio ControlIDs
For $i = 1 To $aRadios2[0]
If $nMsg2 = $aRadios2[$i] Then
If GUICtrlRead($aRadios2[$i], 1) = "Cancel" Then
GUIDelete()
HideTheGUI() ;Hide the window
ExitLoop
EndIf
; Found one!
;~ MsgBox(0, "Pressed", GUICtrlRead($aRadios2[$i], 1))
_FilePrint(GUICtrlRead($aRadios2[$i], 1));Print the selected file.
GUIDelete()
;~ MyFolderChoice() ;build the other window again
HideTheGUI()
ExitLoop
EndIf
Next
WEnd
EndFunc
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam
Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$xClientMax = $aSB_WindowInfo[$index][1]
$xChar = $aSB_WindowInfo[$index][2]
$yChar = $aSB_WindowInfo[$index][3]
$ivMax = $aSB_WindowInfo[$index][7]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0
Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)
; Retrieve the dimensions of the client area.
$xClient = BitAND($lParam, 0x0000FFFF)
$yClient = BitShift($lParam, 16)
$aSB_WindowInfo[$index][4] = $xClient
$aSB_WindowInfo[$index][5] = $yClient
; Set the vertical scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
;~ DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
; Set the horizontal scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE
Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $lParam
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
Local $index = -1, $xChar, $xPos
Local $Min, $Max, $Page, $Pos, $TrackPos
For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$xChar = $aSB_WindowInfo[$index][2]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0
;~ ; Get all the horizontal scroll bar information
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
$Min = DllStructGetData($tSCROLLINFO, "nMin")
$Max = DllStructGetData($tSCROLLINFO, "nMax")
$Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
$xPos = DllStructGetData($tSCROLLINFO, "nPos")
$Pos = $xPos
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
#forceref $Min, $Max
Switch $nScrollCode
Case $SB_LINELEFT ; user clicked left arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
Case $SB_LINERIGHT ; user clicked right arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
Case $SB_THUMBTRACK ; user dragged the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch
;~ // Set the position and then retrieve it. Due to adjustments
;~ // by Windows it may not be the same as the value set.
DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
$Pos = DllStructGetData($tSCROLLINFO, "nPos")
If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_HSCROLL
Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam, $lParam
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
Local $index = -1, $yChar, $yPos
Local $Min, $Max, $Page, $Pos, $TrackPos
For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$yChar = $aSB_WindowInfo[$index][3]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0
; Get all the vertial scroll bar information
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
$Min = DllStructGetData($tSCROLLINFO, "nMin")
$Max = DllStructGetData($tSCROLLINFO, "nMax")
$Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
$yPos = DllStructGetData($tSCROLLINFO, "nPos")
$Pos = $yPos
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
Switch $nScrollCode
Case $SB_TOP ; user clicked the HOME keyboard key
DllStructSetData($tSCROLLINFO, "nPos", $Min)
Case $SB_BOTTOM ; user clicked the END keyboard key
DllStructSetData($tSCROLLINFO, "nPos", $Max)
Case $SB_LINEUP ; user clicked the top arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
Case $SB_LINEDOWN ; user clicked the bottom arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
Case $SB_THUMBTRACK ; user dragged the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch
;~ // Set the position and then retrieve it. Due to adjustments
;~ // by Windows it may not be the same as the value set.
DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
$Pos = DllStructGetData($tSCROLLINFO, "nPos")
If ($Pos <> $yPos) Then
_GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
$yPos = $Pos
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_VSCROLL
Func MyExit()
Exit
EndFunc ;==>MyExit
The function Func WM_SIZE($hWnd, $Msg, $wParam, $lParam) makes a solid scroll bar occupying the entire window, so I edited it like this: