One of the many ways
#include <Array.au3>
Local $sProductID = "B01BGFBUC4" ; //Amazon product ID
Local $sURL = "http://www.amazon.com/One-Persons-Craziness-R-T-Ojas-ebook/product-reviews/" & $sProductID & "/ref=cm_cr_dp_see_all_btm?ie=UTF8&showViewpoints=1&sortBy=bySubmissionDateDescending&filterByStar=two_star";
Local $sSource = BinaryToString(InetRead($sURL, 1))
Local $sReview = StringRegExp($sSource, '(?:<span class="a-size-base a-color-secondary review-date">)(.*?)(?:</span>)', 3)
If Not @error And IsArray($sReview) Then
_ArrayDisplay($sReview, "DEBUG")
MsgBox(0, "Last review", $sReview[UBound($sReview) - 1])
EndIf
I was able to modified the UDF into vertical tabs but it completely broke the hide/show. Can anyone lend a hand with the hide/show section of the UDF? Hiding 1 a time sometime work but when I hides more than 1 tab - It's borked.
Semi Working Vertical - (Hide/Show doesn't work)
#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GuiScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <OwnTab_Mod.au3>
#include <ComboConstants.au3>
#include <Constants.au3>
#include <GuiComboBox.au3>
Local $hGui = GUICreate("(Draft Vertical)", 500, 500)
GUISetBkColor(0xFFFFFF)
$OwnTab_Style = 0 ;random style (only 2 styles available!!)
$Total = 7
Local $aTabText[$Total] = ["1. Test", "2. Test", "3. Test", "4. Test", "5. Test", "6. Test", "7. Test"] ;Declare the regions for the OwnTab-control
;~ Local $aTabIcons[$Total][2] = [[""],[""],[""],[""],[""],[""],[""]]
Global $aCtrlTab = _OwnTab_Create($hGui, $aTabText, 10, 70, 300, 380, 25, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF)
Local $aTabTip[$Total] = ["1. Test", "2. Test", "3. Test", "4. Test", "5. Test", "6. Test", "7. Test"]
_OwnTab_SetTip($aCtrlTab, $aTabTip) ;set the tooltips for the OwnTab-control
#Region Tab1
_OwnTab_Add($aCtrlTab) ;Start controls tab1
Global $Button4 = GUICtrlCreateButton("Acknowledge the alarm", 200, 120, 300, 20)
Global $Button5 = GUICtrlCreateButton("Enable tab 3", 200, 150, 300, 20)
Global $Button6 = GUICtrlCreateButton("Disable tab 3", 200, 180, 300, 20)
Global $Button7 = GUICtrlCreateButton("Hide tab 2", 200, 240, 300, 20)
Global $Button8 = GUICtrlCreateButton("Show tab 2", 200, 210, 300, 20)
#EndRegion Tab1
#Region Tab2
_OwnTab_Add($aCtrlTab) ;Start controls tab2
Global $Edit2 = GUICtrlCreateEdit("Edit in Tab2", 200, 100, 300, 50, 0)
Global $Button1 = GUICtrlCreateButton("Show", 200, 100, 70, 20)
Global $Label2 = GUICtrlCreateLabel("Label in Tab2", 200, 220, 300, 20, 0x201)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ;$GUI_BKCOLOR_TRANSPARENT
#EndRegion Tab2
#Region Tab3
_OwnTab_Add($aCtrlTab) ;Start controls tab3
Global $Edit3 = GUICtrlCreatePic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg', 20, 55, 460, 280)
#EndRegion Tab3
#Region Tab4
_OwnTab_Add($aCtrlTab) ;Start controls tab4
Global $Button4 = GUICtrlCreateButton("Acknowledge the alarm", 200, 120, 300, 20)
Global $Button5 = GUICtrlCreateButton("Enable tab 3", 200, 150, 300, 20)
Global $Button6 = GUICtrlCreateButton("Disable tab 3", 200, 180, 300, 20)
Global $Button7 = GUICtrlCreateButton("Hide tab 2", 200, 240, 300, 20)
Global $Button8 = GUICtrlCreateButton("Show tab 2", 200, 210, 300, 20)
#EndRegion Tab4
#Region Tab5
_OwnTab_Add($aCtrlTab) ;Start controls tab5
Global $Button4 = GUICtrlCreateButton("Acknowledge the alarm", 200, 120, 300, 20)
Global $Button5 = GUICtrlCreateButton("Enable tab 3", 200, 150, 300, 20)
Global $Button6 = GUICtrlCreateButton("Disable tab 3", 200, 180, 300, 20)
Global $Button7 = GUICtrlCreateButton("Hide tab 2", 200, 240, 300, 20)
Global $Button8 = GUICtrlCreateButton("Show tab 2", 200, 210, 300, 20)
#EndRegion Tab5
#Region Tab6
_OwnTab_Add($aCtrlTab) ;Start controls tab6
#EndRegion Tab6
#Region Tab7
_OwnTab_Add($aCtrlTab) ;Start controls tab7
#EndRegion Tab7
_OwnTab_End($aCtrlTab) ;new: end control-definition AND inizialize the OwnTab
;~ _OwnTab_Disable($aCtrlTab, 5) ;new: disable tabitems
;~ For $i = 2 To 3
;~ _OwnTab_Hide($aCtrlTab, $i)
;~ Next
_OwnTab_Switch($aCtrlTab, 3)
_OwnTab_SetFontCol($aCtrlTab, 0x000000) ;new: set font-color
GUISetState()
_OwnTab_Hover($aCtrlTab, 0x66CCFF) ;start hover-function if you want
_OwnTab_AlarmInit()
;~ _GUIScrollBars_Init($hGUI, -1, -1)
Local $msg
While 1
$msg = GUIGetMsg()
For $a = 0 To UBound($aCtrlTab, 1) - 1
If $msg = $aCtrlTab[$a][0] Then
_OwnTab_Switch($aCtrlTab, $a)
EndIf
Next
Switch $msg
Case $Button1
_OwnTab_Enable($aCtrlTab, 3)
Case $Button4
_OwnTab_ResetAlarm($aCtrlTab, 4)
Case $Button5
_OwnTab_Enable($aCtrlTab, 3)
Case $Button6
_OwnTab_Disable($aCtrlTab, 3)
Case $Button7
_OwnTab_Hide($aCtrlTab, 2)
Case $Button8
_OwnTab_Show($aCtrlTab, 2)
Case -3
Exit
EndSwitch
Sleep(10)
WEnd Modified OwnTab UDF
#include-once
#include <GDIPlus.au3>
#include <Array.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>
#Include <Timers.au3>
#cs
Copyrights to funkey from Autoit.de
#ce
Local $HoverArray[1], $ControlID, $Global_I = 0, $__ControlID, $HoverActive = 0, $Temp_Found = 0, $szTemp_Array[2]
Local $OwnTabHoverCol[2], $OwnTabHoverHelp[1], $OwnTabHoverSwitch, $aOwnTabHoverCount, $OwnTabHoverCtrl
Local $aOwnTabAlarm[1][3], $iOwnTabAlarm, $hOwnTabGui, $hTimerAlarm, $hTimerHover
Local $OwnTab_Style = 0 ; only 0 or 1 !
_GDIPlus_Startup()
OnAutoItExitRegister ( "_OwnTab_OnExit" )
Func _OwnTab_Create($hWnd, $aTabText, $xPos, $yPos, $iWidth, $iHeight, $iItemHeight = -1, $nColNoSel = -1, $nColSel = -1, $nColBg = -1, $aIcons = "")
Local $aSize, $aSize2[UBound($aTabText)][2], $xLast = 0, $aCtrl[UBound($aTabText) + 1][11], $iOffset = 0, $iItemWidth = 150
If Not IsArray($aIcons) Then
Local $Icons[UBound($aTabText)][2]
Else
Local $Icons = $aIcons
EndIf
If Not IsArray($aTabText) Then Return SetError(1, 0, "")
For $i = 0 To UBound($aTabText) - 1
If $aTabText[$i] = "" Then Return SetError(2, $i + 1, "")
$aSize = _GetTextSize($aTabText[$i])
$aSize[0] += Ceiling($aSize[0] / 10) ;make it 10% longer for bold text
$aSize2[$i][0] = $aSize[0]
$aSize2[$i][1] = $aSize[1]
If $iItemHeight = - 1 Then $iItemHeight = $aSize[1]
If $Icons[$i][0] <> "" Then
$iOffset = $iItemHeight
$aTabText[$i] &= " "
Else
$iOffset = 0
EndIf
$aCtrl[$i + 1][7] = $Icons[$i][0] ;filename for icon
$aCtrl[$i + 1][8] = $Icons[$i][1] ;index for icon
$aCtrl[$i + 1][9] = $iItemWidth; $aSize[0] + 5 + $iOffset ;labelwidth
$aCtrl[$i + 1][0] = GUICtrlCreateLabel($aTabText[$i], $xPos, $yPos + $xLast, $aCtrl[$i + 1][9], $iItemHeight, 0x411201 + ($Icons[$i][0] <> ""), $OwnTab_Style)
_HoverAddCtrl($aCtrl[$i + 1][0])
If $Icons[$i][0] <> "" Then
$aCtrl[$i + 1][6] = GUICtrlCreateIcon("", 0, $xPos, $yPos + $xLast, $iItemHeight - 6, $iItemHeight - 6)
Else
$aCtrl[$i + 1][6] = GUICtrlCreateDummy()
EndIf
;~ If $Icons[$i][0] <> "" Then _SetBkIcon($aCtrl[$i + 1][6], $nColNoSel, $aCtrl[$i + 1][7], $aCtrl[$i + 1][8], $iItemHeight - 6, $iItemHeight - 6)
GUICtrlCreateLabel($aCtrl[$i + 1][7], -200, -200) ;For information
GUICtrlCreateLabel($aCtrl[$i + 1][8], -200, -200) ;For information
GUICtrlCreateLabel($iItemHeight - 6, -200, -200) ;For information
$aCtrl[$i + 1][2] = $nColNoSel
$aCtrl[$i + 1][3] = $nColSel
$xLast += $iItemHeight
Next
GUICtrlCreateLabel("", $xPos + $iItemWidth - 1, $yPos, $iWidth, $iHeight, 0x411000, $OwnTab_Style);("", $xPos, $yPos + $iItemHeight, $iWidth, $iHeight, 0x411000, $OwnTab_Style)
GUICtrlSetState(-1, $GUI_DISABLE) ;$GUI_DISABLE
GUICtrlSetBkColor(-1, $nColBg)
$xLast = 0
For $i = 0 To UBound($aTabText) - 1
If $Icons[$i][0] <> "" Then
$iOffset = $iItemHeight
Else
$iOffset = 0
EndIf
$aCtrl[$i + 1][1] = GUICtrlCreateLabel("", $xPos + $iItemWidth - 2, $yPos + $xLast + 2, 4+2*$OwnTab_Style, $iItemHeight - 4) ;GUICtrlCreateLabel("", $xPos + $xLast + 6, $yPos + $iItemHeight - $OwnTab_Style, $aSize2[$i][0] + 3 + $iOffset, 2+2*$OwnTab_Style)
GUICtrlSetBkColor(-1, $nColSel)
$xLast += $aSize2[$i][1] + 10 + $iOffset
Next
$aCtrl[0][1] = $iItemHeight
$aCtrl[0][2] = $nColNoSel
$aCtrl[0][3] = $nColSel
$aCtrl[0][9] = $yPos + 2
$hOwnTabGui = $hWnd
Return $aCtrl
EndFunc ;==>_OwnTab_Create
Func _OwnTab_Switch(ByRef $aOwnTab, $iIndex, $fForce = 0)
_OwnTab_UnRegisterHover($aOwnTab, $iIndex)
If _OwnTab_IsAlarmed($aOwnTab[$iIndex][0]) Then $aOwnTabAlarm[@extended][2] = $aOwnTabAlarm[@extended][1]
$HoverActive = 0
If $aOwnTab[0][0] = $iIndex And $fForce = 0 Then Return
For $s = 1 To UBound($aOwnTab, 1) - 1
If $iIndex <> $s Then
GUICtrlSetState($aOwnTab[$s][1], 32) ;$GUI_HIDE
GUICtrlSetFont($aOwnTab[$s][0], -1, 400)
If Not _OwnTab_IsAlarmed($aOwnTab[$s][0]) Then
GUICtrlSetBkColor($aOwnTab[$s][0], $aOwnTab[$s][2])
If $aOwnTab[$s][7] <> "" Then _SetBkIcon($aOwnTab[$s][6], $aOwnTab[$s][2], $aOwnTab[$s][7], $aOwnTab[$s][8], GUICtrlRead($aOwnTab[$s][0] + 4), GUICtrlRead($aOwnTab[$s][0] + 4))
EndIf
If _ArraySearch($OwnTabHoverHelp, $aOwnTab[$s][0]) = -1 Then
_OwnTab_RegisterHover($aOwnTab, $s)
EndIf
Else
GUICtrlSetFont($aOwnTab[$iIndex][0], -1, 1000)
If Not _OwnTab_IsAlarmed($aOwnTab[$s][0]) Then
GUICtrlSetBkColor($aOwnTab[$iIndex][0], $aOwnTab[$iIndex][3])
If $aOwnTab[$s][7] <> "" Then _SetBkIcon($aOwnTab[$iIndex][6], $aOwnTab[$iIndex][3], $aOwnTab[$s][7], $aOwnTab[$s][8], GUICtrlRead($aOwnTab[$s][0] + 4), GUICtrlRead($aOwnTab[$s][0] + 4))
EndIf
GUICtrlSetState($aOwnTab[$iIndex][1], 16) ;$GUI_SHOW
EndIf
Next
If $aOwnTab[0][0] = "" Or $fForce Then
For $t = $aOwnTab[0][4] To $aOwnTab[UBound($aOwnTab, 1) - 1][4]
GUICtrlSetState($t, 32) ;$GUI_HIDE
If $t > $aOwnTab[$iIndex - 1][4] And $t < $aOwnTab[$iIndex][4] Then GUICtrlSetState($t, 16) ;$GUI_SHOW
Next
Else
For $t = $aOwnTab[$aOwnTab[0][0] - 1][4] To $aOwnTab[$aOwnTab[0][0]][4]
GUICtrlSetState($t, 32) ;$GUI_HIDE
Next
For $t = $aOwnTab[$iIndex - 1][4] To $aOwnTab[$iIndex][4]
GUICtrlSetState($t, 16) ;$GUI_SHOW
Next
EndIf
$aOwnTab[0][0] = $iIndex
EndFunc ;==>_OwnTab_Switch
Func _OwnTab_SetTip(ByRef $aOwnTab, $ToolTips = "", $iIndex = "")
If IsArray($ToolTips) Then
For $i = 1 To UBound($aOwnTab, 1) - 1
$aOwnTab[$i][5] = $ToolTips[$i - 1]
GUICtrlSetTip($aOwnTab[$i][0], $ToolTips[$i - 1])
Next
Else
If $iIndex = "" Then Return SetError(1)
$aOwnTab[$iIndex][5] = $ToolTips
GUICtrlSetTip($aOwnTab[$iIndex][0], $ToolTips)
EndIf
EndFunc ;==>_OwnTab_SetTip
Func _OwnTab_AlarmInit($iTime = 555)
If Not $hTimerAlarm Then
$hTimerAlarm = _Timer_SetTimer($hOwnTabGui, $iTime, "_OwnTab_AlarmBlink")
Else
$hTimerAlarm = _Timer_SetTimer($hOwnTabGui, $iTime, "", $hTimerAlarm)
EndIf
EndFunc ;==>_OwnTab_AlarmInit
Func _OwnTab_AlarmBlink($hWnd, $Msg, $iIDTimer, $dwTime)
Local $AlarmColAct
$iOwnTabAlarm = Not $iOwnTabAlarm
For $i = 1 To UBound($aOwnTabAlarm, 1) - 1
If $iOwnTabAlarm Then
$AlarmColAct = $aOwnTabAlarm[$i][2]
Else
$AlarmColAct = $aOwnTabAlarm[$i][1]
EndIf
GUICtrlSetBkColor($aOwnTabAlarm[$i][0], $AlarmColAct)
_SetBkIcon($aOwnTabAlarm[$i][0] + 1, $AlarmColAct, GUICtrlRead($aOwnTabAlarm[$i][0] + 2), GUICtrlRead($aOwnTabAlarm[$i][0] + 3), GUICtrlRead($aOwnTabAlarm[$i][0] + 4), GUICtrlRead($aOwnTabAlarm[$i][0] + 4))
Next
EndFunc ;==>_OwnTab_AlarmBlink
Func _OwnTab_SetAlarm(ByRef $aOwnTab, $iIndex, $nAlarmSel = 0xFF0000)
Local $hCtrl = $aOwnTab[$iIndex][0]
Local $iSearch = _ArraySearch($aOwnTabAlarm, $hCtrl)
If $iSearch <> -1 Then Return
ReDim $aOwnTabAlarm[UBound($aOwnTabAlarm, 1) + 1][3]
$aOwnTabAlarm[UBound($aOwnTabAlarm, 1) - 1][0] = $hCtrl
$aOwnTabAlarm[UBound($aOwnTabAlarm, 1) - 1][1] = $nAlarmSel
$aOwnTabAlarm[UBound($aOwnTabAlarm, 1) - 1][2] = $aOwnTab[$iIndex][2]
;~ GUICtrlSetBkColor($aOwnTab[$iIndex][1], $nAlarmSel)
EndFunc ;==>_OwnTab_SetAlarm
Func _OwnTab_ResetAlarm(ByRef $aOwnTab, $iIndex)
Local $hCtrl = $aOwnTab[$iIndex][0]
Local $iSearch = _ArraySearch($aOwnTabAlarm, $hCtrl)
If $iSearch = -1 Then Return
_ArrayDelete($aOwnTabAlarm, $iSearch)
$aOwnTab[$iIndex][2] = $aOwnTab[0][2]
$aOwnTab[$iIndex][3] = $aOwnTab[0][3]
;~ GUICtrlSetBkColor($aOwnTab[$iIndex][1], $aOwnTab[0][3])
If $aOwnTab[0][0] <> $iIndex Then
GUICtrlSetBkColor($aOwnTab[$iIndex][0], $aOwnTab[0][2])
Else
_SetBkIcon($aOwnTab[$iIndex][0] + 1, $aOwnTab[$iIndex][3], $aOwnTab[$iIndex][7], $aOwnTab[$iIndex][8], GUICtrlRead($aOwnTab[$iIndex][0] + 4), GUICtrlRead($aOwnTab[$iIndex][0] + 4))
GUICtrlSetBkColor($aOwnTab[$iIndex][0], $aOwnTab[0][3])
EndIf
EndFunc ;==>_OwnTab_ResetAlarm
Func _OwnTab_Add(ByRef $aOwnTab)
Local $i = 0
While 1
If $aOwnTab[$i][4] = "" Then ExitLoop
$i += 1
WEnd
$aOwnTab[$i][4] = GUICtrlCreateDummy()
EndFunc ;==>_OwnTab_Add
Func _OwnTab_End(ByRef $aOwnTab, $iIndex = 1)
$aOwnTab[UBound($aOwnTab, 1) - 1][4] = GUICtrlCreateDummy()
_OwnTab_Switch($aOwnTab, $iIndex)
EndFunc ;==>_OwnTab_End
Func _OwnTab_Hover($aOwnTab, $nColHover, $fSwitch = 0, $iTime = 50)
$OwnTabHoverCol[0] = $nColHover
$OwnTabHoverCol[1] = $aOwnTab[0][2]
$OwnTabHoverSwitch = $fSwitch
If Not $hTimerHover Then
$hTimerHover = _Timer_SetTimer($hOwnTabGui, $iTime, "_ProcessHover")
Else
$hTimerHover = _Timer_SetTimer($hOwnTabGui, $iTime, "", $hTimerHover)
EndIf
EndFunc ;==>_OwnTab_Hover
Func _OwnTab_RegisterHover($aOwnTab, $iIndex)
If _ArraySearch($HoverArray, $aOwnTab[$iIndex][0]) = -1 Then _HoverAddCtrl($aOwnTab[$iIndex][0])
EndFunc ;==>_OwnTab_RegisterHover
Func _OwnTab_UnRegisterHover($aOwnTab, $iIndex)
Local $iSearch = _ArraySearch($HoverArray, $aOwnTab[$iIndex][0])
If $iSearch <> -1 Then _ArrayDelete($HoverArray, $iSearch)
EndFunc ;==>_OwnTab_UnRegisterHover
#Region Disable and Enable Tab-Register
Func _OwnTab_Disable($aOwnTab, $iIndex)
GUICtrlSetState($aOwnTab[$iIndex][0], 128)
_OwnTab_UnRegisterHover($aOwnTab, $iIndex)
Local $iSearch = _ArraySearch($OwnTabHoverHelp, $aOwnTab[$iIndex][0])
If $iSearch = -1 Then _ArrayAdd($OwnTabHoverHelp, $aOwnTab[$iIndex][0])
EndFunc ;==>_OwnTab_Disable
Func _OwnTab_Enable($aOwnTab, $iIndex)
GUICtrlSetState($aOwnTab[$iIndex][0], 64)
_OwnTab_RegisterHover($aOwnTab, $iIndex)
Local $iSearch = _ArraySearch($OwnTabHoverHelp, $aOwnTab[$iIndex][0])
If $iSearch <> -1 Then _ArrayDelete($OwnTabHoverHelp, $iSearch)
EndFunc ;==>_OwnTab_Enable
#EndRegion Disable and Enable Tab-Register
Func _OwnTab_Hide(ByRef $aOwnTab, $iIndex)
If $iIndex = 0 Or $iIndex > UBound($aOwnTab, 1) - 1 Then Return SetError(1)
If BitAND(GUICtrlGetState($aOwnTab[$iIndex][0]), $GUI_HIDE) Then Return
GUICtrlSetState($aOwnTab[$iIndex][0], $GUI_HIDE)
GUICtrlSetState($aOwnTab[$iIndex][1], $GUI_HIDE)
GUICtrlSetState($aOwnTab[$iIndex][6], $GUI_HIDE)
Local $Offset = 50 - 4
For $o = 0 To $iIndex - 1
$Offset += $aOwnTab[0][1]
Next
;~ _ArrayDisplay($aOwnTab)
For $o = $iIndex + 1 To UBound($aOwnTab, 1) - 1
GUICtrlSetPos($aOwnTab[$o][0], 10, $Offset - 1)
GUICtrlSetPos($aOwnTab[$o][1], $aOwnTab[1][9] + 7, $Offset)
GUICtrlSetPos($aOwnTab[$o][6], 10, $Offset)
$Offset += $aOwnTab[0][1]
Next
If $iIndex = $aOwnTab[0][0] Then
If $iIndex = 1 Then
_OwnTab_Switch($aOwnTab, 2)
Else
_OwnTab_Switch($aOwnTab, $iIndex - 1)
EndIf
EndIf
EndFunc ;==>_OwnTab_Hide
Func _OwnTab_Show(ByRef $aOwnTab, $iIndex, $iActivate = 0)
If $iIndex = 0 Or $iIndex > UBound($aOwnTab, 1) + 1 Then Return SetError(1)
If BitAND(GUICtrlGetState($aOwnTab[$iIndex][0]), 16) Then Return
GUICtrlSetState($aOwnTab[$iIndex][0], $GUI_SHOW) ;$GUI_SHOW
GUICtrlSetState($aOwnTab[$iIndex][1], $GUI_SHOW) ;$GUI_SHOW
GUICtrlSetState($aOwnTab[$iIndex][6], $GUI_SHOW) ;$GUI_SHOW
Local $Offset = 0
For $o = 0 To UBound($aOwnTab, 1) - 2
$Offset += 25
Next
For $o = UBound($aOwnTab, 1) - 1 To $iIndex + 1 Step - 1
GUICtrlSetPos($aOwnTab[$o][0], 10, $aOwnTab[0][9])
GUICtrlSetPos($aOwnTab[$o][1], 10 + 1, $aOwnTab[0][9] + $aOwnTab[0][1] - 2 - $OwnTab_Style)
GUICtrlSetPos($aOwnTab[$o][6], 10 + 3, $aOwnTab[0][9] + 3)
$Offset -= $aOwnTab[$o - 1][9]
Next
If $iActivate Then
_OwnTab_Switch($aOwnTab, $iIndex)
EndIf
EndFunc ;==>_OwnTab_Show
Func _OwnTab_SetFontCol($aOwnTab, $nColor, $iIndex = "")
If $iIndex = "" Then
For $i = 1 To UBound($aOwnTab, 1) - 1
GUICtrlSetColor($aOwnTab[$i][0], $nColor)
Next
Else
If $iIndex < 1 Or $iIndex >= UBound($aOwnTab, 1) Then Return SetError(1)
GUICtrlSetColor($aOwnTab[$iIndex][0], $nColor)
EndIf
EndFunc ;==>_OwnTab_SetFontCol
Func _OwnTab_SetOnEvent($aOwnTab, $sFunc = "", $iIndex = "")
If $sFunc = "" Then $sFunc = "_OwnTab_OnEvent"
If $iIndex = "" Then
For $f = 1 To UBound($aOwnTab, 1) -1
GUICtrlSetOnEvent($aOwnTab[$f][0], $sFunc)
Next
Else
If $iIndex < 1 Or $iIndex >= UBound($aOwnTab, 1) Then Return SetError(1)
GUICtrlSetOnEvent($aOwnTab[$iIndex][0], $sFunc)
EndIf
EndFunc
;~ Func _OwnTab_OnEvent() ;for example
;~ For $a = 1 To UBound($aCtrlTab, 1) -1
;~ If @GUI_CtrlId = $aCtrlTab[$a][0] Then ExitLoop
;~ Next
;~ If $a < UBound($aCtrlTab, 1) Then _OwnTab_Switch($aCtrlTab, $a)
;~ EndFunc
Func _OwnTab_OnExit()
_GDIPlus_Shutdown()
If $hTimerAlarm Then _Timer_KillTimer($hOwnTabGui, $hTimerAlarm)
If $hTimerHover Then _Timer_KillTimer($hOwnTabGui, $hTimerHover)
EndFunc ;==>_OwnTab_Exit
Func _GetTextSize($nText, $sFont = 'Microsoft Sans Serif', $iFontSize = 8.5, $iFontAttributes = 0)
If $nText = '' Then Return
Local $hGui = GUICreate("Nothing")
;~ _GDIPlus_Startup()
Local $hFormat = _GDIPlus_StringFormatCreate(0)
Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
Local $hFont = _GDIPlus_FontCreate($hFamily, $iFontSize, $iFontAttributes, 3)
Local $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)
Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $nText, $hFont, $tLayout, $hFormat)
Local $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width"))
Local $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_GraphicsDispose($hGraphic)
;~ _GDIPlus_Shutdown()
GUIDelete($hGui)
Local $aSize[2] = [$iWidth, $iHeight]
Return $aSize
EndFunc ;==>_GetTextSize
Func _ProcessHover($hWnd, $Msg, $iIDTimer, $dwTime)
If $OwnTabHoverSwitch > 1 And $OwnTabHoverCtrl <> "" Then
If $aOwnTabHoverCount < $OwnTabHoverSwitch Then $aOwnTabHoverCount += 1
If $aOwnTabHoverCount >= $OwnTabHoverSwitch Then
ControlClick($hOwnTabGui, "", $OwnTabHoverCtrl)
$aOwnTabHoverCount = 0
$OwnTabHoverCtrl = ""
EndIf
EndIf
$ControlID = _HoverCheck()
If IsArray($ControlID) Then
If $ControlID[0] = "AcquiredHover" Then
$OwnTabHoverCtrl = $ControlID[1]
$aOwnTabHoverCount = 0
If $OwnTabHoverSwitch = "1" Then
Return ControlClick($hOwnTabGui, "", $OwnTabHoverCtrl)
Else
_HoverFound($ControlID[1])
EndIf
Else
If $ControlID[1] <> "" Then
_HoverLost($ControlID[1])
$OwnTabHoverCtrl = ""
EndIf
EndIf
EndIf
EndFunc ;==>_ProcessHover
Func _HoverLost($ControlID)
If _OwnTab_IsAlarmed($ControlID) Then Return
GUICtrlSetBkColor($ControlID, $OwnTabHoverCol[1])
If GUICtrlRead($ControlID + 2) <> "" Then _SetBkIcon($ControlID + 1, $OwnTabHoverCol[1], GUICtrlRead($ControlID + 2), GUICtrlRead($ControlID + 3), GUICtrlRead($ControlID + 4), GUICtrlRead($ControlID + 4))
EndFunc ;==>_HoverLost
Func _HoverFound($ControlID)
If _OwnTab_IsAlarmed($ControlID) Then Return
GUICtrlSetBkColor($ControlID, $OwnTabHoverCol[0])
If GUICtrlRead($ControlID + 2) <> "" Then _SetBkIcon($ControlID + 1, $OwnTabHoverCol[0], GUICtrlRead($ControlID + 2), GUICtrlRead($ControlID + 3), GUICtrlRead($ControlID + 4), GUICtrlRead($ControlID + 4))
EndFunc ;==>_HoverFound
Func _OwnTab_IsAlarmed($hCtrl)
Local $iSearch = _ArraySearch($aOwnTabAlarm, $hCtrl)
If $iSearch = -1 Then Return 0
Return SetExtended($iSearch, 1)
EndFunc
#Region _MouseHover.au3
;====================================================================================================================================
; UDF Name: _MouseHover.au3
;
; Author: marfdaman (Marvin)
;
; Contributions: RazerM (adding SetText parameter to _HoverFound and _HoverUndo).
;
; email: marfdaman at gmail dot com
;
; Use: Enable hover events for controls
;
; Note(s): If you want to use this i.c.w. an AdlibEnable in your current script, make your Adlib call "_HoverCheck()" as well.
; In this case, _HoverOn must NOT be called.
;====================================================================================================================================
;===============================================================================
; Description: _HoverAddCtrl
; Parameter(s): $___ControlID -> Control ID of control to be hoverchecked
;
; Requirement: Array.au3
; Return Value(s): None
;===============================================================================
Func _HoverAddCtrl($___ControlID)
_ArrayAdd($HoverArray, $___ControlID)
EndFunc ;==>_HoverAddCtrl
;===============================================================================
; Description: Checks whether the mousecursor is hovering over any of the defined controls.
; Parameter(s): None
; Requirement: None
; Return Value(s): If a control has matched, an array will be returned, with $array[1] being either
; "AcquiredHover" or "LostHover". $array[2] will contain the control ID.
; It is recommended that you put this function in an AdlibEnable, since it's EXTREMELY
; resource friendly.
;===============================================================================
Func _HoverCheck()
$HoverData = GUIGetCursorInfo()
If Not IsArray($HoverData) Then Return
$Temp_Found = 0
For $i = 1 To UBound($HoverArray) - 1
If $HoverData[4] = $HoverArray[$i] Or $HoverData[4] = $HoverArray[$i] + 1 Then
$Temp_Found = $i
EndIf
Next
Select
Case $Temp_Found = 0 And $HoverActive = 1 Or $Temp_Found <> 0 And $Temp_Found <> $Global_I And $HoverActive = 1
$HoverActive = 0
$Temp_Found = 0
$szTemp_Array[0] = "LostHover"
$szTemp_Array[1] = $HoverArray[$Global_I]
Return $szTemp_Array
Case $Temp_Found > 0 And $HoverActive = 0
$Global_I = $Temp_Found
$HoverActive = 1
$Temp_Found = 0
$szTemp_Array[0] = "AcquiredHover"
$szTemp_Array[1] = $HoverArray[$Global_I]
Return $szTemp_Array
EndSelect
EndFunc ;==>_HoverCheck
#EndRegion _MouseHover.au3
Func _SetBkIcon($ControlID, $iBackground, $sIcon, $iIndex, $iWidth, $iHeight)
;Yashied
;http://www.autoitscript.com/forum/index.php?showtopic=92207&view=findpost&p=662886
Const $STM_SETIMAGE = 0x0172
Local $tIcon, $tID, $hDC, $hBackDC, $hBackSv, $hBitmap, $hImage, $hIcon, $hBkIcon
$tIcon = DllStructCreate('hwnd')
$tID = DllStructCreate('hwnd')
$hIcon = DllCall('user32.dll', 'int', 'PrivateExtractIcons', 'str', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr', DllStructGetPtr($tIcon), 'ptr', DllStructGetPtr($tID), 'int', 1, 'int', 0)
If (@error) Or ($hIcon[0] = 0) Then
Return SetError(1, 0, 0)
EndIf
$hIcon = DllStructGetData($tIcon, 1)
$tIcon = 0
$tID = 0
$hDC = _WinAPI_GetDC(0)
$hBackDC = _WinAPI_CreateCompatibleDC($hDC)
$hBitmap = _WinAPI_CreateSolidBitmap(0, $iBackground, $iWidth, $iHeight)
$hBackSv = _WinAPI_SelectObject($hBackDC, $hBitmap)
_WinAPI_DrawIconEx($hBackDC, 0, 0, $hIcon, 0, 0, 0, 0, $DI_NORMAL)
;~ _GDIPlus_Startup()
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
$hBkIcon = DllCall($ghGDIPDll, 'int', 'GdipCreateHICONFromBitmap', 'hWnd', $hImage, 'int*', 0)
$hBkIcon = $hBkIcon[2]
_GDIPlus_ImageDispose($hImage)
GUICtrlSendMsg($ControlID, $STM_SETIMAGE, $IMAGE_ICON, _WinAPI_CopyIcon($hBkIcon))
_WinAPI_RedrawWindow(GUICtrlGetHandle($ControlID))
;~ _GDIPlus_Shutdown()
_WinAPI_SelectObject($hBackDC, $hBackSv)
_WinAPI_DeleteDC($hBackDC)
_WinAPI_ReleaseDC(0, $hDC)
_WinAPI_DeleteObject($hBkIcon)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteObject($hIcon)
Return SetError(0, 0, 1)
EndFunc ;==>_SetBkIcon
Thank you Water - You make it seem so easy. I have a question. Is it possible not to include people big signature in my attachment? and I only want it to save the pdf file not all the jpg gif that come with the email?
That's the problem. I assigned signature to outlook as default but when I ran through Itemcreate func. - it doesn't want to include signature. "New mail" and Reply from outlook work just fine.
; Script Start - Add your code below here
#include <OutlookEX.au3>
$oOutlook = _OL_Open()
$bodyOfEmail = "This email was sent. Thank you."
$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML, _
"HTMLBody=" & $bodyOfEmail)
$oItem.Display
I feel like something so simple as include signature in email can be so complicated. Am I missing any tag or something?
Keep forgetting:
Windows 7 SP1 x64
Outlook 2010/2007 (2 Separate machines same OS)
So the key "Default" doesn't apply to any default signature? This would be a difficult for multi-user because everyone signature might be different. I would assume there is a function just to use a preset default signature just like hitting "New Mail".
I can't seem to get it to work with assign. Can you tell me what i'm doing wrong?
Jmon - Thank you for pointing me with the switch. That's good way to replace it. Since the actual data is not random, is there a way to read the existing array and replace the value instead?
Updated: I solved with the right direction from Jmon using switch. Here is example if anyone ever need to replace array on fly.
#include <Array.au3> ; Required only for _ArrayDisplay().
#include <GUIConstantsEx.au3>
#include <GUIListView.au3>
#include <WindowsConstants.au3>
Example()
Func Example()
Local $iWidth = 600, $iHeight = 400, $iListView
Local $hGUI = GUICreate('_GUICtrlListView_CreateArray()', $iWidth, $iHeight, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
_CreateListView($hGUI, $iListView)
Local $iGetArray = GUICtrlCreateButton('REPLACE', $iWidth - 90, $iHeight - 28, 85, 25)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKSIZE + $GUI_DOCKBOTTOM)
Local $iRefresh = GUICtrlCreateButton('Refresh', $iWidth - 180, $iHeight - 28, 85, 25)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKSIZE + $GUI_DOCKBOTTOM)
GUISetState(@SW_SHOW, $hGUI)
Local $aReturn = 0, $aStringSplit = 0
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $iGetArray
$aReturn = _GUICtrlListView_CreateArray($iListView, Default) ; Use | as the default delimeter.
_ArrayDisplay($aReturn, 'BEFORE')
; replace string in array for specific column
For $A = 0 To UBound($aReturn, 1)-1
Switch $aReturn[$A ][0]
Case 1
$aReturn[$A ][0] = "Offline"
Case 3
$aReturn[$A ][0] = "Online"
Case 8
$aReturn[$A ][0] = "I don't even know"
EndSwitch
Next
_ArrayDisplay($aReturn, 'AFTEr')
Case $iRefresh
GUICtrlDelete($iListView)
_CreateListView($hGUI, $iListView)
EndSwitch
WEnd
GUIDelete($hGUI)
EndFunc ;==>Example
Func _CreateListView($hGUI, ByRef $iListView) ; Thanks to AZJIO for this function.
Local $aClientSize = WinGetClientSize($hGUI)
$iListView = GUICtrlCreateListView('', 0, 0, $aClientSize[0], $aClientSize[1] - 30)
GUICtrlSetResizing($iListView, $GUI_DOCKBORDERS)
Sleep(250)
Local $iColumns = 3
__ListViewFill($iListView, $iColumns, Random(25, 100, 1)) ; Fill the ListView with Random data.
For $i = 0 To $iColumns
_GUICtrlListView_SetColumnWidth($iListView, $i, $LVSCW_AUTOSIZE)
_GUICtrlListView_SetColumnWidth($iListView, $i, $LVSCW_AUTOSIZE_USEHEADER)
Next
EndFunc ;==>_CreateListView
Func __ListViewFill($hListView, $iColumns, $iRows) ; Required only for the Example.
If Not IsHWnd($hListView) Then
$hListView = GUICtrlGetHandle($hListView)
EndIf
Local $fIsCheckboxesStyle = (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_CHECKBOXES) = $LVS_EX_CHECKBOXES)
_GUICtrlListView_BeginUpdate($hListView)
For $i = 0 To $iColumns - 1
_GUICtrlListView_InsertColumn($hListView, $i, 'Column ' & $i + 1, 50)
_GUICtrlListView_SetColumnWidth($hListView, $i - 1, -2)
Next
For $i = 0 To $iRows - 1
_GUICtrlListView_AddItem($hListView, Random(1,9,1), $i)
If Random(0, 1, 1) And $fIsCheckboxesStyle Then
_GUICtrlListView_SetItemChecked($hListView, $i)
EndIf
For $j = 1 To $iColumns
_GUICtrlListView_AddItem($hListView, Random(1, 8, 1), $i)
_GUICtrlListView_AddSubItem($hListView, $i, 'Row ' & $i + 1 & ': Col ' & $j + 1, $j)
Next
Next
_GUICtrlListView_EndUpdate($hListView)
EndFunc ;==>__ListViewFill
; #FUNCTION# ====================================================================================================================
; Name ..........: _GUICtrlListView_CreateArray
; Description ...: Creates a 2-dimensional array from a lisview.
; Syntax ........: _GUICtrlListView_CreateArray($hListView[, $sDelimeter = '|'])
; Parameters ....: $hListView - Control ID/Handle to the control
; $sDelimeter - [optional] One or more characters to use as delimiters (case sensitive). Default is '|'.
; Return values .: Success - The array returned is two-dimensional and is made up of the following:
; $aArray[0][0] = Number of rows
; $aArray[0][1] = Number of columns
; $aArray[0][3] = Delimited string of the column name(s) e.g. Column 1|Column 2|Column 3|Column nth
; $aArray[1][0] = 1st row, 1st column
; $aArray[1][1] = 1st row, 2nd column
; $aArray[1][2] = 1st row, 3rd column
; $aArray[n][0] = nth row, 1st column
; $aArray[n][1] = nth row, 2nd column
; $aArray[n][2] = nth row, 3rd column
; Author ........: guinness
; Remarks .......: GUICtrlListView.au3 should be included.
; Example .......: yes
; ===============================================================================================================================
Func _GUICtrlListView_CreateArray($hListView, $sDelimeter = '|')
Local $iColumnCount = _GUICtrlListView_GetColumnCount($hListView), $iDim = 0, $iItemCount = _GUICtrlListView_GetItemCount($hListView)
If $iColumnCount < 3 Then
$iDim = 3 - $iColumnCount
EndIf
If $sDelimeter = Default Then
$sDelimeter = '|'
EndIf
Local $aColumns = 0, $aReturn[$iItemCount + 1][$iColumnCount + $iDim] = [[$iItemCount, $iColumnCount, '']]
For $i = 0 To $iColumnCount - 1
$aColumns = _GUICtrlListView_GetColumn($hListView, $i)
$aReturn[0][2] &= $aColumns[5] & $sDelimeter
Next
$aReturn[0][2] = StringTrimRight($aReturn[0][2], StringLen($sDelimeter))
For $i = 0 To $iItemCount - 1
For $j = 0 To $iColumnCount - 1
$aReturn[$i + 1][$j] = _GUICtrlListView_GetItemText($hListView, $i, $j)
Next
Next
Return SetError(Number($aReturn[0][0] = 0), 0, $aReturn)
EndFunc ;==>_GUICtrlListView_CreateArray
You shouldn't mask the new password without a second validation that the user had actually type new password or what they think they typed are two different thing.
The error never get trigger for SQL because you don't have any error handler. Default script crashed before it reach your @error
The following example gets all unread items with at least one attachment and writes the mail subject plus the name of all attachments to the Console.
Use _OL_ItemAttachmentSave to save the attachments of your mails.
#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
#include <OutlookEX.au3>
Global $aAttachments
; Connect to Outlook
Global $oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error opening connection to Outlook. @error = " & @error & ", @extended = " & @extended)
; Access the Inbox
Global $aFolder = _OL_FolderAccess($oOutlook, "", $olFolderInbox)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error accessing the Inbox. @error = " & @error & ", @extended = " & @extended)
; Search for unread items with attachments
Global $sFilter = "@SQL=""urn:schemas:httpmail:hasattachment"" = 1 and ""urn:schemas:httpmail:read""=0"
Global $aResult = _OL_ItemSearch($oOutlook, $aFolder[1], $sFilter, "EntryID,subject")
If @error Then
MsgBox(16, "OutlookEX UDF - _OL_ItemSearch Example Script", "Error running _OL_ItemSearch. @error = " & @error & ", @extended = " & @extended)
Else
_Arraydisplay($aResult, "Example 6")
EndIf
; Now get a list of attachments
For $i = 1 To $aResult[0][0]
ConsoleWrite($aResult[$i][1] & @CRLF) ; Mail subject
$aAttachments = _OL_ItemAttachmentGet($oOutlook, $aResult[$i][0])
For $j = 1 To $aAttachments[0][0]
ConsoleWrite(" " & $aAttachments[$j][2] & @CRLF) ; Name of atachment
Next
Next
_OL_Close($oOutlook)
Exit
I have considered to add a PST compact function. Unfortunately Outlook doesn't offer a method in the object model. So, no, there will be no such function in the OutlookEX UDF.
The only way to do it by script is to automate the Outlook GUI.
A better example that sorts a list view by the column that is clicked on that column's header. The column sorts acsending and decending with each click.
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1) ; 1 = enable.
Opt("GUICloseOnESC", 1) ; 1 = Send the $GUI_EVENT_CLOSE message when ESC is pressed (default).
Opt('MustDeclareVars', 1)
Global $hListView
_Example1()
While 1
Sleep(100)
WEnd
Func _Example1()
;Local $hImage
Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)
Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)
GUICreate("ListView Sort", 300, 400)
GUISetOnEvent($GUI_EVENT_CLOSE, "CloseGUI")
$hListView = GUICtrlCreateListView("Column1|Column2|Column3|Col4", 10, 10, 280, 380, -1, $iExWindowStyle)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $iExListViewStyle)
GUICtrlSetOnEvent($hListView, "sort")
_AddRow($hListView, "10/20/2001|2|7|10/14/2012")
_AddRow($hListView, "12/15/2000|1|8|5/22/2012")
_AddRow($hListView, "04/05/2004|----|----|----")
_AddRow($hListView, "1/22/2004|4|6|1/4/2012")
_AddRow($hListView, "11/05/2005|5|3|10/12/2012")
_AddRow($hListView, "8/15/2004|6|2|10/10/2010")
_AddRow($hListView, "10/05/2008|7||11/11/2011")
_AddRow($hListView, "11/05/2012|8|4|05/15/2005")
_AddRow($hListView, "12/05/2012|9|5|1/21/2004")
GUISetState()
_GUICtrlListView_RegisterSortCallBack($hListView)
EndFunc ;==>_Example1
Func sort()
Local $iCol = GUICtrlGetState($hListView)
Local $iRowCount = _GUICtrlListView_GetItemCount(ControlGetHandle("ListView Sort", "", $hListView))
; ----- If the column clicked contains date formated "MM/DD/YYYY" in the first, middle, or last
; row, then convert to date format "YYYY/MM/DD" ----
If StringRegExp(_GUICtrlListView_GetItemText($hListView, 0, $iCol), "(d{1,2})[/.-](d{1,2})[/.-](d{4})") Or _
StringRegExp(_GUICtrlListView_GetItemText($hListView, $iRowCount - 1, $iCol), "(d{1,2})[/.-](d{1,2})[/.-](d{4})") Or _
StringRegExp(_GUICtrlListView_GetItemText($hListView, Int($iRowCount / 2), $iCol), "(d{1,2})[/.-](d{1,2})[/.-](d{4})") Then
Local $aItem2D[$iRowCount][2], $aTemp
For $i = 0 To $iRowCount - 1
$aItem2D[$i][0] = _GUICtrlListView_GetItemText($hListView, $i, $iCol)
If StringRegExp($aItem2D[$i][0], "(d{1,2})[/.-](d{1,2})[/.-](d{4})") Then
$aTemp = StringRegExp($aItem2D[$i][0], "(d+)", 3)
$aItem2D[$i][1] = StringFormat("%4d/%02d/%02d", $aTemp[2], $aTemp[0], $aTemp[1])
_GUICtrlListView_SetItem($hListView, $aItem2D[$i][1], $i, $iCol)
Else
$aItem2D[$i][1] = $aItem2D[$i][0]
_GUICtrlListView_SetItem($hListView, $aItem2D[$i][1], $i, $iCol)
EndIf
;ConsoleWrite($aItem2D[$i][0] & " " & $aItem2D[$i][1] & @LF)
Next
;ConsoleWrite(@LF)
; -------- Sort all columns ----------
_GUICtrlListView_SortItems($hListView, $iCol)
; -------- Convert date format "YYYY/MM/DD" back to the original format --------
For $i = 0 To $iRowCount - 1
For $j = 0 To $iRowCount - 1
If StringCompare(_GUICtrlListView_GetItemText($hListView, $i, $iCol), $aItem2D[$j][1]) = 0 Then
_GUICtrlListView_SetItem($hListView, $aItem2D[$j][0], $i, $iCol)
ExitLoop 1
EndIf
Next
Next
Else
_GUICtrlListView_SortItems($hListView, $iCol)
EndIf
EndFunc ;==>sort
Func _AddRow($hWnd, $sItem)
Local $aItem = StringSplit($sItem, "|"), $iColWidth
Local $iIndex = _GUICtrlListView_AddItem($hWnd, $aItem[1], -1, _GUICtrlListView_GetItemCount($hWnd))
_GUICtrlListView_SetColumnWidth($hWnd, 0, $LVSCW_AUTOSIZE_USEHEADER)
For $x = 2 To $aItem[0]
_GUICtrlListView_AddSubItem($hWnd, $iIndex, $aItem[$x], $x - 1)
_GUICtrlListView_SetColumnWidth($hWnd, $x - 1, $LVSCW_AUTOSIZE)
$iColWidth = _GUICtrlListView_GetColumnWidth($hWnd, $x - 1)
_GUICtrlListView_SetColumnWidth($hWnd, $x - 1, $LVSCW_AUTOSIZE_USEHEADER)
If $iColWidth > _GUICtrlListView_GetColumnWidth($hWnd, $x - 1) Then
_GUICtrlListView_SetColumnWidth($hWnd, $x - 1, $LVSCW_AUTOSIZE)
EndIf
Next
EndFunc ;==>_AddRow
Func CloseGUI()
_GUICtrlListView_UnRegisterSortCallBack($hListView)
GUIDelete()
Exit
EndFunc ;==>CloseGUI