Hallo & guten Abend,
ich habe ein Autoit-Skript, welches mir folgende Fehlermeldung bringt:
>"C:\Programme\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Programme\AutoIt3\Examples\xxx1.au3" /autoit3dir "C:\Programme\AutoIt3" /UserParams
+>22:37:01 Starting AutoIt3Wrapper v.2.0.1.24 Environment(Language:0407 Keyboard:00000407 OS:WIN_XP/Service Pack 3 CPU:X64 OS:X86)
>Running AU3Check (1.54.19.0) from:C:\Programme\AutoIt3
C:\Programme\AutoIt3\Examples\xxx1.au3(204,42) : WARNING: $SW_HIDE: possibly used before declaration.
_WinAPI_ShowWindow($hProgress, $SW_HIDE)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Programme\AutoIt3\Examples\xxx1.au3(206,42) : WARNING: $SW_SHOW: possibly used before declaration.
_WinAPI_ShowWindow($hProgress, $SW_SHOW)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Programme\AutoIt3\Examples\xxx1.au3(204,42) : ERROR: $SW_HIDE: undeclared global variable.
_WinAPI_ShowWindow($hProgress, $SW_HIDE)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Programme\AutoIt3\Examples\xxx1.au3 - 1 error(s), 2 warning(s)
!>22:37:01 AU3Check ended.rc:2
>Running:(3.3.6.1):C:\Programme\AutoIt3\autoit3.exe "C:\Programme\AutoIt3\Examples\xxx1.au3"
+>22:37:24 AutoIT3.exe ended.rc:0
>Exit code: 0 Time: 24.881
Das deutet für mich darauf hin, daß ein INCLUDE fehlt, aber meiner Meinung nach ist dieser drin. Werde ich etwa (berufs)blind? ![]()
Ich füge mal das Script ein, vllt. ist ja einer oder mehrere so nett und schauem Mal nach, Danke im voraus.
[autoit]
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GuiStatusBar.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <ComboConstants.au3>
#include <File.au3>
#include <Misc.au3>
#include <Constants.au3>
#include <ProgressConstants.au3>
#include <HeaderConstants.au3>
#include <WinAPI.au3>
#include <IE.au3>
#include <String.au3>
GUICreate("listview items",920,260, 100,200,-1)
;GUISetBkColor (0x00E0FFFF)
local $hProgress[200]
Local $aProgress[100][100]
$swds = _RecursiveFileListToArray("c:\xpcd\software", "", 2, 1, @CRLF)
[/autoit][autoit][/autoit][autoit]$listview = GUICtrlCreateListView ("col1 |col2|col3 | col4|col5|col6|col7|col8|Status", 10, 10, 850, 250)
GUICtrlSetColor(-1, 0x0000A0)
;GUICtrlSetBkColor(-1, 0xBBCCEE)
;$button = GUICtrlCreateButton ("bCol Item2", 75, 170, 70, 20)
; $item1=GUICtrlCreateListViewItem("item1|col12|col13", $listview)
;GUICtrlSetColor(-1, 0x007000)
;GUICtrlSetBkColor(-1, 0xEE9999)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 20)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 4, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 5, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 6, 30)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 7, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 8, 100)
_GUICtrlListView_BeginUpdate($listview)
for $i = 1 to UBound($swds)-1
$hProgress[$i] = _ListView_InsertProgressBar($ListView, $i, 9)
[/autoit][autoit][/autoit][autoit]$helparray = DirGetSize ( $swds[$i] , 1 )
[/autoit][autoit][/autoit][autoit];_ArrayDisplay($helparray, "Directories:")
$item2=GUICtrlCreateListViewItem(StringReplace($swds[$i], "\", "|"), $listview)
If $helparray[2] = 0 Then
GUICtrlSetColor($item2, 0x007000)
GUICtrlSetData($item2, "||||||-->|bereit zum installieren")
Else
GUICtrlSetColor($item2, 0xEE9999)
EndIf
Next
_GUICtrlListView_EndUpdate($listview)
GUISetState()
[/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]Do
$msg = GUIGetMsg ()
Select
; Case $msg = $button
;~ MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
; GUICtrlSetBkColor($item2, 0x00008B)
Case $msg = $listview
MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)
EndSelect
Until $msg = $GUI_EVENT_CLOSE
;===============================================================================
; Function Name: _RecursiveFileListToArray($sPath, $sPattern, $iFlag = 0, $iFormat = 1, $sDelim = @CRLF)
; Description:: gibt Verzeichnisse und/oder Dateien (rekursiv) zurück, die
; einem RegExp-Pattern entsprechen
; Parameter(s): $sPath = Startverzeichnis
; $sPattern = ein beliebiges RexExp-Pattern für die Auswahl
; $iFlag = Auswahl
; 0 = Dateien & Verzeichnisse
; 1 = nur Dateien
; 2 = nur Verzeichnisse
; $iFormat = Rückgabeformat
; 0 = String
; 1 = Array mit [0] = Anzahl
; 2 = Nullbasiertes Array
; $sDelim = Trennzeichen für die String-Rückgabe
; Requirement(s): AutoIt 3.3.0.0
; Return Value(s): Array/String mit den gefundenen Dateien/Verzeichnissen
; Author(s): Oscar (http://www.autoit.de)
; Anregungen von: bernd670 (http://www.autoit.de)
;===============================================================================
Func _RecursiveFileListToArray($sPath, $sPattern, $iFlag = 0, $iFormat = 1, $sDelim = @CRLF)
Local $hSearch, $sFile, $sReturn = ''
If StringRight($sPath, 1) <> '\' Then $sPath &= '\'
$hSearch = FileFindFirstFile($sPath & '*.*')
If @error Or $hSearch = -1 Then Return SetError(0, 0, $sReturn)
While True
$sFile = FileFindNextFile($hSearch)
If @error Then ExitLoop
If StringInStr(FileGetAttrib($sPath & $sFile), 'D') Then
If StringRegExp($sPath & $sFile, $sPattern) And ($iFlag = 0 Or $iFlag = 2) Then $sReturn &= $sPath & $sFile & '\' & $sDelim
$sReturn &= _RecursiveFileListToArray($sPath & $sFile & '\', $sPattern, $iFlag, 0)
ContinueLoop
EndIf
If StringRegExp($sFile, $sPattern) And ($iFlag = 0 Or $iFlag = 1) Then $sReturn &= $sPath & $sFile & $sDelim
WEnd
FileClose($hSearch)
If $iFormat Then Return StringSplit(StringTrimRight($sReturn, StringLen($sDelim)), $sDelim, $iFormat)
Return $sReturn
EndFunc
; #FUNCTION# ======================================================================================
; Function Name: _ListView_InsertProgressBar()
; Description: Inserts a progressbar control in the ListView control.
; Syntax.........: _ListView_InsertProgressBar($sHwnd, $sItemIndex[, $sSubItemIndex])
; Parameter(s): $sHwnd - Handle to the ListView control.
; $sItemIndex - Zero based index of the item at which the progressbar should be inserted.
; $sSubItemIndex - [Optional] One based index of the subitem where progressbar should be placed, default is 1.
;
; Return Value(s): Returns the identifier (controlID) of the new progressbar control.
; Requirement(s): AutoIt 3.2.10.0 and above
; Note(s): Optimal amount of progressbar controls is 5-10. Don`t abuse with many amount of progressbar controls.
;
; Author(s): R.Gilman (a.k.a rasim), arcker
;==================================================================================================
Func _ListView_InsertProgressBar($sHwnd, $sItemIndex, $sSubItemIndex = 0)
If Not IsHWnd($sHwnd) Then $sHwnd = GUICtrlGetHandle($sHwnd)
Local $iStyle = _WinAPI_GetWindowLong($sHwnd, $GWL_STYLE)
[/autoit][autoit][/autoit][autoit]If BitAND($iStyle, $WS_CLIPCHILDREN) <> $WS_CLIPCHILDREN Then
_WinAPI_SetWindowLong($sHwnd, $GWL_STYLE, BitOR($iStyle, $WS_CLIPCHILDREN))
EndIf
Local $aRect
[/autoit][autoit][/autoit][autoit]If $sSubItemIndex = 0 Then
$aRect = _GUICtrlListView_GetItemRect($sHwnd, $sItemIndex, 2)
Else
$aRect = _GUICtrlListView_GetSubItemRect($sHwnd, $sItemIndex, $sSubItemIndex)
EndIf
$aProgress[0][0] += 1
ReDim $aProgress[$aProgress[0][0] + 1][4]
$aProgress[$aProgress[0][0]][0] = _Progress_Create($sHwnd, $aRect[0], $aRect[1], $aRect[2] - $aRect[0], $aRect[3] - $aRect[1])
$aProgress[$aProgress[0][0]][1] = $sItemIndex
$aProgress[$aProgress[0][0]][2] = $sSubItemIndex
$aProgress[$aProgress[0][0]][3] = $sHwnd
Return $aProgress[$aProgress[0][0]][0]
EndFunc ;==>
Func _Progress_Create($hWnd, $iX, $iY, $iWidth = -1, $iHeight = -1, $iStyle = 0, $iExStyle = 0)
$iStyle = BitOR($iStyle, $WS_CHILD, $WS_VISIBLE)
Return _WinAPI_CreateWindowEx($iExStyle, "msctls_progress32", "", $iStyle, $iX, $iY, $iWidth, $iHeight, $hWnd)
EndFunc ;==>_Progress_Create
Func _ListView_Notify($hWnd, $Msg, $wParam, $lParam)
If $Msg = $WM_SIZE Then
_WinAPI_InvalidateRect($hWnd)
Return $GUI_RUNDEFMSG
EndIf
Local $tNMHEADER, $hWndFrom, $iCode, $i
[/autoit][autoit][/autoit][autoit]$tNMHEADER = DllStructCreate($tagNMHEADER, $lParam)
$hWndFrom = DllStructGetData($tNMHEADER, "hwndFrom")
$iCode = DllStructGetData($tNMHEADER, "Code")
Switch $iCode
Case $HDN_ITEMCHANGED, $HDN_ITEMCHANGEDW, $LVN_ENDSCROLL
If $iCode <> $LVN_ENDSCROLL Then $hWndFrom = _WinAPI_GetParent($hWndFrom)
For $i = 1 To $aProgress[0][0]
If $aProgress[$i][3] = $hWndFrom Then _
_MoveProgress($hWndFrom, $aProgress[$i][0], $aProgress[$i][1], $aProgress[$i][2])
Next
_WinAPI_InvalidateRect($hWndFrom)
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>_ListView_Notify
Func _MoveProgress($hListView, $hProgress, $sItemIndex, $sSubItemIndex)
Local $aRect
If $sSubItemIndex = 0 Then
$aRect = _GUICtrlListView_GetItemRect($hListView, $sItemIndex, 2)
Else
$aRect = _GUICtrlListView_GetSubItemRect($hListView, $sItemIndex, $sSubItemIndex)
EndIf
If $aRect[1] < 10 Then
_WinAPI_ShowWindow($hProgress, $SW_HIDE)
ElseIf $aRect[1] >= 10 Then
_WinAPI_ShowWindow($hProgress, $SW_SHOW)
EndIf
_WinAPI_MoveWindow($hProgress, $aRect[0], $aRect[1], $aRect[2] - $aRect[0], $aRect[3] - $aRect[1], True)
EndFunc ;==>_MoveProgress
; #FUNCTION# ====================================================================================================
; Description ...: Sets the color of the indicator bar
; Parameters ....: $hWnd - Handle to the control
; $iColor - The new progress indicator bar color. Specify the CLR_DEFAULT value to cause the progress bar
; +to use its default progress indicator bar color.
; Return values .: Success - The previous progress indicator bar color, or CLR_DEFAULT if the progress indicator bar color
; +is the default color.
; Author ........: Paul Campbell (PaulIA), Updated By Arcker
; Remarks .......: This message is supported only in the Windows Classic theme
; Related .......:
; ====================================================================================================
Func _Progress_SetBarColor($hWnd, $iColor)
Return _SendMessage($hWnd, $PBM_SETBARCOLOR, 0, $iColor)
EndFunc ;==>_Progress_SetBarColor
; #FUNCTION# ====================================================================================================
; Description ...: Sets the current position
; Parameters ....: $hWnd - Handle to the control
; $iPos - The new position
; Return values .: Success - The previous position
; Author ........: Paul Campbell (PaulIA), Updated By Arcker
; Remarks .......:
; Related .......: _Progress_GetPos
; ====================================================================================================
Func _Progress_SetPos($hWnd, $iPos)
Return _SendMessage($hWnd, $PBM_SETPOS, $iPos, 0)
EndFunc ;==>_Progress_SetPos
; #FUNCTION# ====================================================================================================
; Description ...: Sets the background color in the progress bar
; Parameters ....: $hWnd - Handle to the control
; $iColor - The new background color. Specify the CLR_DEFAULT value to cause the progress bar to use its
; +default background color.
; Return values .: Success - The previous background color, or CLR_DEFAULT if the background color is the default color.
; Author ........: Paul Campbell (PaulIA), Updated By Arcker
; Remarks .......: This message is supported only in the Windows Classic theme
; Related .......:
; ====================================================================================================
Func _Progress_SetBkColor($hWnd, $iColor)
Return _SendMessage($hWnd, $PBM_SETBKCOLOR, 0, $iColor)
EndFunc ;==>_Progress_SetBkColor
; #FUNCTION# ====================================================================================================
[/autoit][autoit][/autoit][autoit]; Description ...: Specifies the step increment
; Parameters ....: $hWnd - Handle to the control
; $iStep - Step increment.
; Return values .: Success - The previous step increment
; Author ........: Paul Campbell (PaulIA)
; Remarks .......: The step increment is the amount by which the progress bar increases its current position whenever you use the
; _Progress_StepIt function. By default, the step increment is set to 10.
; Related .......: _Progress_StepIt
; ====================================================================================================
Func _Progress_SetStep($hWnd, $iStep = 10)
Return _SendMessage($hWnd, $PBM_SETSTEP, $iStep, 0)
EndFunc ;==>_Progress_SetStep
; #FUNCTION# ====================================================================================================
; Description ...: Advances the current position by the step increment
; Parameters ....: $hWnd - Handle to the control
; Return values .: Success - The previous position
; Author ........: Paul Campbell (PaulIA), Updated By Arcker
; Remarks .......:
; Related .......: _Progress_SetStep
; ====================================================================================================
Func _Progress_StepIt($hWnd)
Return _SendMessage($hWnd, $PBM_STEPIT, 0, 0)
EndFunc ;==>_Progress_StepIt
; #FUNCTION# ====================================================================================================
; Description ...: Delete the progressbar control
; Parameters ....: $hWnd - Handle to the control
; Return values .: Success - True
; Failure - False
; Author ........: G. Sandler (MrCreatoR), Updated by rasim
; Remarks .......:
; Related .......: _Progress_SetStep
; ====================================================================================================
Func _Progress_Delete($hWnd)
Local $aTmpArr[1][3]
For $i = 1 To $aProgress[0][0]
If $aProgress[$i][0] <> $hWnd Then
$aTmpArr[0][0] += 1
ReDim $aTmpArr[$aTmpArr[0][0] + 1][4]
$aTmpArr[$aTmpArr[0][0]][0] = $aProgress[$i][0]
$aTmpArr[$aTmpArr[0][0]][1] = $aProgress[$i][1]
$aTmpArr[$aTmpArr[0][0]][2] = $aProgress[$i][2]
$aTmpArr[$aTmpArr[0][0]][3] = $aProgress[$i][3]
EndIf
Next
$aProgress = $aTmpArr
[/autoit][autoit][/autoit][autoit]Local $aResult = DllCall("User32.dll", "int", "DestroyWindow", "hwnd", $hWnd)
If @error Then Return SetError(1, 0, 0)
Return $aResult[0] <> 0
EndFunc ;==>_Progress_Delete
