Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/06/2014 in all areas

  1. funkey

    My OwnTab-Control

    I made my own tab-control! OwnTab-Gallery Example #include "OwnTab.au3" #cs Known Bugs: --> Bug mit $OwnTab_Style, da diese Variable zur Laufzeit abgefragt wird beim Verstecken und erneuten Anzeigen der Register. --> "Zittern" der alarmierten Register, wenn diese bereits angewählt wurden --> durch blinken mit der selben Farbe #ce Local $hGui = GUICreate("Funkey's OwnTab-UDF Example", 500, 350) GUISetBkColor(0xbbbbbb) $OwnTab_Style = Random(0, 1, 1) ;random style (only 2 styles available!!) Local $aTabText[5] = ["Settings", "Register without icon", "Pic", "Status", "Tab in Tab"] ;Declare the regions for the OwnTab-control Local $aTabIcons[5][2] = [["shell32.dll", 130],[""],["shell32.dll", 139],["shell32.dll", 90], ["shell32.dll", 43]] Global $aCtrlTab = _OwnTab_Create($hGui, $aTabText, 10, 10, 480, 300, 30, 0xD5D5D5, 0xCFE0E7, 0xCFE0E7, $aTabIcons) Local $aTabTip[5] = ["Tip Item 1", "Tip Item 2", "Tip Item 3", "Alarm-Register"] _OwnTab_SetTip($aCtrlTab, $aTabTip) ;set the tooltips for the OwnTab-control #Region Tab1 _OwnTab_Add($aCtrlTab) ;Start controls tab1 Global $Edit1 = GUICtrlCreateEdit("Edit in Tab1", 20, 55, 300, 50, 0) Global $Button1 = GUICtrlCreateButton("Simulate an alarm", 20, 120, 300, 20) Global $Box1 = GUICtrlCreateCheckbox("Switch on hover - set time -->", 20, 180) GUICtrlSetBkColor(-1, 0xCFE0E7) Global $Input1 = GUICtrlCreateInput("1", 200, 180, 50, 20) GUICtrlCreateUpdown($Input1) GUICtrlSetLimit(-1, 15, 1) #EndRegion Tab1 #Region Tab2 _OwnTab_Add($aCtrlTab) ;Start controls tab2 Global $Edit2 = GUICtrlCreateEdit("Edit in Tab2", 20, 150, 300, 50, 0) Global $Label2 = GUICtrlCreateLabel("Label in Tab2", 20, 220, 300, 20, 0x201) GUICtrlSetBkColor(-1, -2) ;$GUI_BKCOLOR_TRANSPARENT #EndRegion Tab2 #Region Tab3 _OwnTab_Add($aCtrlTab) ;Start controls tab3 Global $Labe3 = GUICtrlCreateLabel("If you see this label, you can change the picture-path in scriptline " &@ScriptLineNumber + 1 & "!!", 40, 150, 400, 30, 0x201) 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", 20, 120, 300, 20) Global $Button5 = GUICtrlCreateButton("Enable tab 3", 20, 150, 300, 20) Global $Button6 = GUICtrlCreateButton("Disable tab 3", 20, 180, 300, 20) Global $Button7 = GUICtrlCreateButton("Hide tab 2", 20, 240, 300, 20) Global $Button8 = GUICtrlCreateButton("Show tab 2", 20, 210, 300, 20) #EndRegion Tab4 #Region Tab5 and "Tab in Tab" _OwnTab_Add($aCtrlTab) ;Start controls tab5 GUICtrlCreateLabel("Style Black", 30, 50, 200, 20, 0x201) $OwnTab_Style = 0 Local $aTabText[2] = ["Tab1", "New Info"] ;Declare the regions for the OwnTab-control Local $aTabIcons[2][2] = [["shell32.dll", 20],["shell32.dll", 40]] Global $aCtrlTab2 = _OwnTab_Create($hGui, $aTabText, 30, 80, 200, 200, 30, 0xD5D5D5, 0x00ff00, 0x00ff00, $aTabIcons) _OwnTab_Add($aCtrlTab2) ;Start controls tab1 Global $BtnSet = GUICtrlCreateButton("Simulate", 80, 150, 100, 20) _OwnTab_Add($aCtrlTab2) ;Start controls tab2 Global $BtnReset = GUICtrlCreateButton("Acknowledge", 80, 170, 100, 20) _OwnTab_End($aCtrlTab2) GUICtrlCreateLabel("Style White", 270, 50, 200, 20, 0x201) $OwnTab_Style = 1 Local $aTabText[2] = ["Tab1", "Tab2"] ;Declare the regions for the OwnTab-control Local $aTabIcons[2][2] = [["shell32.dll", 10],["shell32.dll", 60]] Global $aCtrlTab3 = _OwnTab_Create($hGui, $aTabText, 270, 80, 200, 200, 30, 0xD5D5D5, 0x00ff00, 0x00ff00, $aTabIcons) _OwnTab_Add($aCtrlTab3) ;Start controls tab1 GUICtrlCreateLabel("Just testing...", 280, 150, 100, 20) GUICtrlSetBkColor(-1, -2) _OwnTab_Add($aCtrlTab3) ;Start controls tab2 GUICtrlCreateLabel("Hello from tab2", 280, 150, 100, 20) GUICtrlSetBkColor(-1, -2) _OwnTab_End($aCtrlTab3) #EndRegion Tab5 _OwnTab_End($aCtrlTab) ;new: end control-definition AND inizialize the OwnTab _OwnTab_Disable($aCtrlTab, 3) ;new: disable tabitems _OwnTab_SetFontCol($aCtrlTab, 0xFF) ;new: set font-color GUISetState() _OwnTab_Hover($aCtrlTab, 0xFFFF88) ;start hover-function if you want _OwnTab_AlarmInit() Local $msg While 1 $msg = GUIGetMsg() For $a = 1 To UBound($aCtrlTab, 1) - 1 If $msg = $aCtrlTab[$a][0] Then _OwnTab_Switch($aCtrlTab, $a) If $a = 5 Then _OwnTab_Switch($aCtrlTab2, $aCtrlTab2[0][0], 1) _OwnTab_Switch($aCtrlTab3, $aCtrlTab3[0][0], 1) EndIf EndIf Next For $a = 1 To UBound($aCtrlTab2, 1) - 1 If $msg = $aCtrlTab2[$a][0] Then _OwnTab_Switch($aCtrlTab2, $a) EndIf Next For $a = 1 To UBound($aCtrlTab3, 1) - 1 If $msg = $aCtrlTab3[$a][0] Then _OwnTab_Switch($aCtrlTab3, $a) EndIf Next Switch $msg Case $Button1 _OwnTab_SetAlarm($aCtrlTab, 4, 0xFF0000) Case $Button4 _OwnTab_ResetAlarm($aCtrlTab, 4) Case $BtnSet _OwnTab_SetAlarm($aCtrlTab2, 2, 0x5050FF) Case $BtnReset _OwnTab_ResetAlarm($aCtrlTab2, 2) 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 $Box1 If GUICtrlRead($Box1) = 1 Then _OwnTab_Hover($aCtrlTab, 0xFFFF88, GUICtrlRead($Input1)) Else _OwnTab_Hover($aCtrlTab, 0xFFFF88, 0) EndIf Case $Input1 If GUICtrlRead($Box1) = 1 Then _OwnTab_Hover($aCtrlTab, 0xFFFF88, GUICtrlRead($Input1)) Case -3 Exit EndSwitch Sleep(10) WEnd 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 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] = $aSize[0] + 5 + $iOffset ;labelwidth $aCtrl[$i + 1][0] = GUICtrlCreateLabel($aTabText[$i], $xPos + $xLast + 5, $yPos + 2, $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 + $xLast + 8, $yPos + 5, $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 += $aCtrl[$i + 1][9] Next GUICtrlCreateLabel("", $xPos, $yPos + $iItemHeight, $iWidth, $iHeight, 0x411000, $OwnTab_Style) GUICtrlSetState(-1, 128) ;$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 + $xLast + 6, $yPos + $iItemHeight - $OwnTab_Style, $aSize2[$i][0] + 3 + $iOffset, 2+2*$OwnTab_Style) GUICtrlSetBkColor(-1, $nColSel) $xLast += $aSize2[$i][0] + 5 + $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]), 32) Then Return GUICtrlSetState($aOwnTab[$iIndex][0], 32) ;$GUI_HIDE GUICtrlSetState($aOwnTab[$iIndex][1], 32) ;$GUI_HIDE GUICtrlSetState($aOwnTab[$iIndex][6], 32) ;$GUI_HIDE Local $Offset = 3 For $o = 0 To $iIndex - 1 $Offset += $aOwnTab[$o][9] - 0 Next For $o = $iIndex + 1 To UBound($aOwnTab, 1) - 1 GUICtrlSetPos($aOwnTab[$o][0], $Offset, $aOwnTab[0][9]) GUICtrlSetPos($aOwnTab[$o][1], $Offset + 1, $aOwnTab[0][9] + $aOwnTab[0][1] - 2 - $OwnTab_Style) GUICtrlSetPos($aOwnTab[$o][6], $Offset + 3, $aOwnTab[0][9] + 3) $Offset += $aOwnTab[$o][9] 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 Local $Offset = 3 For $o = 0 To UBound($aOwnTab, 1) - 2 $Offset += $aOwnTab[$o][9] - 0 Next For $o = UBound($aOwnTab, 1) - 1 To $iIndex + 1 Step -1 GUICtrlSetPos($aOwnTab[$o][0], $Offset, $aOwnTab[0][9]) GUICtrlSetPos($aOwnTab[$o][1], $Offset + 1, $aOwnTab[0][9] + $aOwnTab[0][1] - 2 - $OwnTab_Style) GUICtrlSetPos($aOwnTab[$o][6], $Offset + 3, $aOwnTab[0][9] + 3) $Offset -= $aOwnTab[$o - 1][9] Next GUICtrlSetState($aOwnTab[$iIndex][0], 16) ;$GUI_SHOW GUICtrlSetState($aOwnTab[$iIndex][6], 16) ;$GUI_SHOW 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) ;Author: Bugfix ;Modified: funkey If $nText = '' Then Return Local $hGui = GUICreate("Textmeter by Bugfix") ;~ _GDIPlus_Startup() Local $hFormat = _GDIPlus_StringFormatCreate(0) Local $hFamily = _GDIPlus_FontFamilyCreate($sFont) Local $hFont = _GDIPlus_FontCreate($hFamily, $iFontSize, $iFontAttributes, 3) Local $tLayout = _GDIPlus_RectFCreate(15, 171, 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($__g_hGDIPDll, '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 Have fun! Edit: Fixed a problem with the hover-function Edit2: New version with Icon-support and hover-switch Edit3: 2009 New improved version!! Edit4: 2021 Updated UDF to work with actual version of AutoIt. (Thanks for downloading and using this script over 1350 times) OwnTab.au3 OwnTab_Example.au3
    1 point
  2. BuckMaster

    Form Builder beta

    Update v1.0.6 Major script overhaul, I literally started over from scratch only adding parts of code from the old script that were solid. I don’t have a help file made as of now so I am going to explain all of the functionality in this post - Form Builder is no longer bi-directional, you now toggle between script mode and GUI mode using a button in the top right or F4 - The script no longer recompiles on every change but instead inserts changes into the script - Form Builder no longer cares about Event mode or GuiGetMsg mode - No more .gui files, you now edit .au3 scripts directly - Script edit is now a SciLexer control, includes syntax highlighting, folding, call tips, keywords, and inline error annotations. - Script output console is now at the bottom in script mode - Main GUI menu redone, most functions from SciTe have been added along with their hotkeys - All restrictions to editing the script have been removed - GDI+ and Graphic editors removed - Cleanup of script, stability greatly increased - Hotkeys no longer use _IsPressed they now use GUIAccelerator keys (with exception to a few) - Multiple scripts can be open - Form Builder buffers the open scripts and adds an asterisk * to scripts that have been modified - Rich Edit, GUIScrollbars, Dummy, and Updown are disabled for now until I can add them - GUI Menu controls cannot be created as of now but will be rendered in the editor - Undo and Redo actions in script mode and GUI mode added, the GUI undo and redo buffer is cleared switching between modes - The Undo and Redo buffers do not have a limit but are cleared when switching between modes or scripts - Undo and Redo actions do not work for controls that have no control handle - The Treeview now works as a Go to function for controls and functions in script mode - Form Builder now tries to preserve as much of the original content as possible, it will save whitespace in-between parameters and comments on controls - Treeview context menu reworked, much more responsive - Unicode support added File -> Encoding -> UTF-8 - Language support added, I added a couple of language files and used Google translate just so I could size my GUI's for different languages, I do not support what those language files say - Selecting a GUI in the Treeview in GUI mode will allow you to change the GUI's Handle, Position, Background Color, State, Cursor, Font, Font Size and Font Attributes - Auto Declare is no longer hiding in the settings, it is now on the top right and is a toggle between Off, Global and Local - Help File Lookup added (Ctrl + H), allows you to search selected text in the help file, Any variable will be searched and the first result will be displayed, any string will be searched as a keyword in the index - Added current script line, column, and selection length in the bottom left - Standard undeclared style constants are checked before script execution and the script will prompt if an undefined style constant is found - You can now toggle script whitespace, EOL characters, line numbers, margins and output in the View menu - View -> Toggle All Folds works as it does in SciTe, only base level folds are changed and the first fold found determines whether to expand or contract - Form Builder Settings redone - Bugs with submitting data and control selection have been fixed - Fixed problems with frequently called repetitive functions causing issues with large scripts - Fixed bugs with B, I, U and S font attribute buttons getting stuck and called when enter was pressed Update v1.0.7 - Help File Look-up hotkey changed to Ctrl+B - Replace hotkey changed to Ctrl+H - Changes to $SCN_MODIFIED so only text events are notified - Bookmarks added, Ctrl+M to add or delete a Bookmark from the current line - Edit -> Bookmarks -> Set Bookmark changes the currently selected Bookmark - Edit -> Clear Current Bookmarks deletes only the currently selected Bookmark - Allows you to change foreground and background colors of Bookmarks - Added F2 hotkey for Next Bookmark - Added Shift+F2 hotkey for Previous Bookmark - Fixed a bug that made it so script annotation did not show up for some people - Script errors and warnings now add a Bookmark on each line - Ctrl+E hotkey added to clear all Bookmarks and Annotations - Minor GUI tweaks - Fixed a bug with the GUI Style undo action - Undo and Redo actions for GUI windows will now update the window properties if the GUI is selected - F4 Hotkey no longer switches modes, switching modes is now F10 - F4 is to toggle next error or warning message, works like it does in SciTe, bookmarks the line and highlights the error in the console - Shift+F4 Hotkey added to toggle previous error or warning message - Shift+F5 Hotkey added to clear script output - Ctrl+F5 Hotkey added as SyntaxCheck Prod - Form Builder now performs a SyntaxCheck before entering GUI Mode and prompts on Error or Warning - Language Select Menu Added Settings -> Lanugage - Icons added to main menu - Languages added to all new menu items and msgbox's - Language Files updated for new data - Language Support added for Arabic, Chinese, Dutch, French, German, Hebrew, Japanese, Swedish, Thai, and Vietnamese [ Google Translate ] - Fixed bug with updating a language that made it look like ANSI and UTF-8 were both selected - Added redo button next to undo button - Font attribute buttons Bold, Italic, Underline and Strike-Out changed to labels Update v1.0.8 - Somehow a main function got deleted causing the script to crash on some changes - Fixed some issues with updating Languages Hotkeys Ctrl + N - New Blank Script Ctrl + G - New GUI Script Ctrl + O - Open Script Ctrl + Shift + S - Save As Ctrl + S - Save Esc - Close Open Script Alt + F4 - Exit Ctrl + Z - Undo Ctrl + Y - Redo Ctrl + X - Cut Ctrl + C - Copy Ctrl + V - Paste Ctrl + A - Select All Ctrl + W - Clear inline script annotation Ctrl + E - Clear inline script annotation and bookmarks Ctrl + F - Find Ctrl + F3 - Find Next Shift + F3 - Find Previous (doesn’t work yet) Ctrl + B - Help File Lookup F5 - Go Alt + F5 - Beta Run F7 - Build Ctrl + F7 - Compile F11 - Full screen F8 - Toggle Show/Hide Script Output Ctrl + I - Open Include Ctrl + H - Replace F1 - AutoIt Help File Ctrl + D - Duplicate Control Delete - Delete Control Ctrl + Shift + 8 - Toggle Show/Hide Script Whitespace Ctrl + Shift + 9 - Toggle Show/Hide Script EOL characters Ctrl - GUI Mode multicontrol selection F10 - Switch Modes F4 - Next Message Shift+F4 - Previous Message Shift+F5 - Clear Output Ctrl+M - Add Bookmark F2 - Next Bookmark Shift+F2 - Previous Bookmark Basic GUI Mode How To Create a Control - click a control on the left - click in the GUI you wish to add the control Left Click: Click and drag to auto resize the control Right Click: Creates the control at a standard size Select a Control - click inside the control or select it in the treeview Change a controls Data - First select the control - modify the controls data on the right, press enter to submit changes state, cursor, font and resizing update when you change the data - when modifying the data parameter the script recognizes if there is a variable in the data and will add quotes accordingly ex. data parameter = $data, End result in script: GUICtrlCreateButton($data, 50, 50, 100, 20) ex. data parameter = data, End result in script: GUICtrlCreateButton("data", 50, 50, 100, 20) ex. data parameter = "data"&$data, End result in script: GUICtrlCreateButton("data"&$data, 50, 50, 100, 20) Applying an Image to a control - select a control - control styles must be applied to some controls before adding an image - click the ... button next to the Image input in the Control Properties area in the bottom right - select the image you want to display, allows jpg, bmp, gif, ico and dll files - selecting a dll will open another prompt to choose which resource to display Control Grouping - multiple controls must be selected - press the group controls button - control grouping allows you to resize and move multiple controls at the same time, as of now groups are deleted when leaving GUI mode I only have a couple odds and ends to finish up before everything should be complete, I need to add Undo and Redo actions for copying and duplicating controls and a couple other minor things, eventually I want to try to add all of the UDF controls as well. If people are willing to translate the language file I would be very grateful, the ones I have right now are from Google translate, I only used them for testing and have no idea what they say. I want to thank Kip, Prog@ndy, Isi360 and all of the other contributors on this forum, without you guys i don't think i could have written this script. Please post any comments, problems or suggestions, BuckMaster * I only used one "magic number" on my main close case statement, only for faster locating, and i don't care. Form Builder Source.zip Form Builder.zip
    1 point
  3. I change Pause function as Stop and I added a pause function what only pause the script. So now work fine. I am able to: Run script Pause script Exit from loop Restart / continue the script Did not know u can use True / False on pause function like this. More simple then Help file examples. Ps.: Your english is good enough. So do not worry about it. Thank you! Tricky
    1 point
  4. /c and /k are cmd-specific, not AutoIt. See here: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true
    1 point
  5. In your Run line, instead of " /c" do " /k". More importantly, is there a reason you're doing it this way than with the built in Ping function, which will give you the results as well? Something like this: #include <File.au3> $pc = InputBox("Asset tag", "Please enter the asset tag you wish to ping.") $var = Ping($pc) If @error = 0 Then MsgBox(0, "", $pc & " located!") Else MsgBox(0, "", "Could not ping " & $pc) EndIf
    1 point
  6. JLogan3o13

    Group Caption

    This is working for me. My question would be how are you setting $Ping_Rtr, I don't see it anywhere in your code. While 1 Local $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 GUICtrlSetData($Group_Main, "Text Changed") EndSelect WEnd Edit: Dang page didn't refresh. Too slow
    1 point
  7. Danyfirex

    Group Caption

    Hi. use Guictrlsetdata(ControlID,"New Name") #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <EditConstants.au3> #include <ButtonConstants.au3> $Form1_1 = GUICreate("Ping Utility", 395, 412, 299, 204) $Input_1 = GUICtrlCreateInput("", 64, 8, 97, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) GUICtrlSetLimit(-1, 4) $Input_2 = GUICtrlCreateInput("64", 248, 9, 81, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) $Group_Main = GUICtrlCreateGroup("Main Router", 8, 40, 377, 185) $Group_POS = GUICtrlCreateGroup("POS", 16, 56, 217, 161) $Checkbox_Reg1 = GUICtrlCreateCheckbox("Register 1", 24, 80, 81, 41) GUICtrlSetState(-1, $GUI_CHECKED) $Checkbox_Reg2 = GUICtrlCreateCheckbox("Register 2", 120, 80, 81, 41) GUICtrlSetState(-1, $GUI_CHECKED) $Checkbox_Reg3 = GUICtrlCreateCheckbox("Register 3", 24, 128, 81, 41) $Checkbox_Reg4 = GUICtrlCreateCheckbox("Register 4", 120, 128, 81, 41) $Checkbox_RmtPRT = GUICtrlCreateCheckbox("Remote Printer", 64, 179, 105, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $Checkbox_RTR = GUICtrlCreateCheckbox("Router", 256, 64, 97, 41) GUICtrlSetState(-1, $GUI_CHECKED) $Checkbox_Shoppertrak = GUICtrlCreateCheckbox("Shopper Trak", 256, 151, 89, 41) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("PING", 8, 360, 161, 41, $BS_DEFPUSHBUTTON) $BTN_Exit = GUICtrlCreateButton("Exit", 224, 360, 161, 41) $Group_Uplink = GUICtrlCreateGroup("Uplink Router/Switch", 8, 232, 377, 113) $Checkbox_Rtr2 = GUICtrlCreateCheckbox("Uplink Router\Switch", 16, 256, 129, 33) $Checkbox_CCTV = GUICtrlCreateCheckbox("CCTV", 152, 256, 57, 33) $Checkbox_DMX = GUICtrlCreateCheckbox("DMX", 224, 256, 45, 33) $Checkbox_Style = GUICtrlCreateCheckbox("Style Wall", 288, 256, 89, 33) $Checkbox_BRT1 = GUICtrlCreateCheckbox("BrightSign-1", 16, 304, 80, 33) $Checkbox_BRT2 = GUICtrlCreateCheckbox("BrightSign-2", 104, 304, 80, 33) $Checkbox_BRT3 = GUICtrlCreateCheckbox("BrightSign-3", 200, 304, 80, 33) $Checkbox_BRT4 = GUICtrlCreateCheckbox("BrightSign-4", 296, 304, 80, 33) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label2 = GUICtrlCreateLabel("Store:", 8, 8, 45, 17) $Label1 = GUICtrlCreateLabel("Packet Size:", 176, 7, 61, 17) GUISetState(@SW_SHOW) Sleep(1000) GUICtrlSetData($Group_Main,"New Name") Sleep(1000) Saludos
    1 point
  8. Could you also think about giving your posts meaningful titles in the future? Everyone on this forum is confused about something, or they wouldn't be seeking help
    1 point
  9. a person who sticks out his tongue? -running
    1 point
  10. http://www.autoitscript.com/wiki/FAQ#Why_does_the_Ctrl_key_get_stuck_down_after_I_run_my_script.3F
    1 point
  11. Furthermore, Windows gives no guarantee that the order of the files will be the same even between subsequent runs, so knowing which file was last returned from FindNextFile() wouldn't do you any good anyway. You need either a sorted list or some other method to keep track of where you are. FileListToArray() is indeed a good point to start with.
    1 point
  12. rschroll, I would use FileListToArray to get an array of the files. Then you can loop through them and keep a count of where you are so that if you are interrupted you know where to restart. M23 And welcome to the AutoIt forum, by the way.
    1 point
  13. Rather than replacing each variable with a corresponding array, I used the fact that only one richedit could be used at a time, therefore Added two functions _Edit_List_Suspend() and _Edit_List_Restore(). So that multiple richedits could be used at a time. I even provided an example. Please check the original post. Regards Phoenix XL
    1 point
  14. _StringEncrypt is outdated, therefore try to use the _Crypt_*** functions. Look at using _Crypt_EncryptData instead. #include <Constants.au3> #include <Crypt.au3> Example() Func Example() ; Encrypt text using a generic password. Local $sEncrypted = StringEncrypt(True, 'Encrypt this data.', 'securepassword') ; Display the encrypted text. MsgBox($MB_SYSTEMMODAL, '', $sEncrypted) ; Decrypt the encrypted text using the generic password. Local $sDecrypted = StringEncrypt(False, $sEncrypted, 'securepassword') ; Display the decrypted text. MsgBox($MB_SYSTEMMODAL, '', $sDecrypted) EndFunc ;==>Example Func StringEncrypt($fEncrypt, $sData, $sPassword) _Crypt_Startup() Local $sReturn = '' If $fEncrypt Then $sReturn = _Crypt_EncryptData($sData, $sPassword, $CALG_RC4) Else $sReturn = BinaryToString(_Crypt_DecryptData($sData, $sPassword, $CALG_RC4)) EndIf _Crypt_Shutdown() Return $sReturn EndFunc ;==>StringEncrypt
    1 point
×
×
  • Create New...