Herzlich willkommen!
Beiträge von funkey
-
-
Hier noch meine 2Cents
AutoIt
Alles anzeigen#include <Array.au3> ; Ausgangsarray: Local $aListViewData[10][4] = [ _ ["PC-001", "00:1A:2B:3C:4D:5E", "192.168.23.145", "Büro 101"], _ ["PC-002", "00:2B:3C:4D:5E:6F", "10.0.15.87", "Empfang"], _ ["PC-003", "00:3C:4D:5E:6F:7G", "172.16.78.209", "Besprechungsraum"], _ ["PC-004", "00:4D:5E:6F:7G:8H", "192.168.1.3", "Buchhaltung"], _ ["PC-005", "00:5E:6F:7G:8H:9I", "10.10.55.201", "Marketing"], _ ["PC-006", "00:6F:7G:8H:9I:0J", "172.20.100.50", "Entwicklung 1"], _ ["PC-007", "00:7G:8H:9I:0J:1K", "192.168.0.11", "Entwicklung 2"], _ ["PC-008", "00:8H:9I:0J:1K:2L", "10.1.1.254", "Personalabteilung"], _ ["PC-009", "00:9I:0J:1K:2L:3M", "172.31.255.1", "Kantine"], _ ["PC-010", "00:0J:1K:2L:3M:4N", "192.168.100.100", "Serverraum"] _ ] ; Spalte hinzufügen Local $iRows = UBound($aListViewData), $iCols = UBound($aListViewData, 2) Redim $aListViewData[$iRows][$iCols + 1] ; Spalte mit einem sortierbaren Wert (hier mit Nullen aufgefüllte IP-Adresse) füllen: For $i = 0 To $iRows - 1 $aListViewData[$i][$iCols] = _htonl(_inet_addr($aListViewData[$i][2])) Next ; nach dieser Spalte sortieren _ArraySort($aListViewData, 0, 0, 0, $iCols) ; letzte Spalte wieder löschen: Redim $aListViewData[$iRows][$iCols] ; Ergebnis ausgeben _ArrayDisplay($aListViewData) Func _inet_addr($sIP) Local $aRet = DllCall("ws2_32.dll", "ULONG", "inet_addr", "str", $sIP) Return $aRet[0] EndFunc ;==>_inet_addr ;host byte order to network byte order (long) Func _htonl($value) Local $aRet = DllCall("ws2_32.dll", "ULONG", "htonl", "ULONG", $value) Return $aRet[0] EndFunc ;==>_htonl
-
Ich hab das auch mal gemacht. Meine Lösung war, dass sich die Datei beim Ausführen selbst gelöscht hat, wenn das Datum überschritten war.
-
Bei mir kommt keine Meldung. Prinzipiell läuft das Skript.
Hab nur gesehen, dass sich manche Controls überschneiden und die Group muss AUF und ZU gemacht werden. Würde da wohl eigene Zeilen im Array anlegen, oder bei den Radios/Checkboxen eine Option mitgeben.
Edit: Das Problem ist wahrscheinlich, dass die die Variable $hRadioGroup nicht definierst/initialisierst. Die Funktion _CreateGuiElement() wird aber öfter aufgerufen und $hRadioGroup wird wieder überschrieben.
-
Nichts zu danken. Helfe gerne wenn ich Zeit haben.
-
Du hast den Text
$arElements[$i][8] --> "Öffnet die Settings" an den Style von GUICtrlCreateIcon gehängt. Deswegen funktionierte das Control nicht mehr richtig.
Außerdem dann eben $arElements[$i][9] anstelle von $arElements[$i][8] bei GUICtrlSetTip
-
Du hast dich da verzählt.
Hier mal so wie ich es machen würde. Hab's umgebaut auf Funktionen und Event-Mode
C
Alles anzeigen#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> Opt("GUIOnEventMode", 1) Global $arElements = [ _ [0, "Button1", "Button", "Save List", 10, 340, 100, 30, "Liste speichern", "", ""], _ [0, "Button2", "Button", "Host1", 210, 30, 70, 30, "nd", "", ""], _ [0, "Button3", "Button", "Host2", 210, 70, 70, 30, "nd", "", ""], _ [0, "Button4", "Button", "Workgroup", 210, 110, 70, 30, "nd", "", ""], _ [0, "Button5", "Button", "Fritz", 280, 30, 70, 30, "nd", "", ""], _ [0, "Button6", "Button", "IT-Service", 280, 70, 70, 30, "nd", "", ""], _ [0, "Button7", "Button", "Lesesaal", 280, 110, 70, 30, "nd", "", ""], _ [0, "Button14", "Button", "Save and choose file", 190, 340, 160, 30, "sdsds", "", ""], _ [0, "Checkbox1", "Checkbox", "AdminUser", 10, 390, 90, 20, "", $GUI_CHECKED, ">>>"], _ [0, "Label1", "Label", "Freie Listen", 210, 10, 100, 20, "", "", "9,800,800"], _ [0, "Icon1", "Icon", "shell32.dll", 168, 320, 390, 50, 50, "Öffnet die Settings", "", ""] _ ] Global $hParent = GUICreate("TESTGUI", 500, 500) _CreateControlFromArray($arElements) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetState(@SW_SHOW, $hParent) While 1 Sleep(10) WEnd Func _HandleCtrlEvent() Local $iIndex = _ArraySearch($arElements, @GUI_CtrlId, 0, 0, 0, 0, 1, 0) Switch $arElements[$iIndex][1] Case "Button1" MsgBox($MB_OK, "Button Clicked", "Save List") ; Meldung anzeigen, wenn Button1 geklickt wird Case "Button2" MsgBox($MB_OK, "Button Clicked", "Host1") ; Meldung anzeigen, wenn Button2 geklickt wird Case "Button3" MsgBox($MB_OK, "Button Clicked", "Host2") ; Meldung anzeigen, wenn Button3 geklickt wird Case "Button14" MsgBox($MB_OK, "Button Clicked", "Save and choose file") ; Meldung anzeigen, wenn Button14 geklickt wirdEndFunc EndSwitch EndFunc Func _Exit() Exit EndFunc Func _CreateControlFromArray(ByRef $aCtrlInfo) For $i = 0 To UBound($aCtrlInfo) -1 Switch $aCtrlInfo[$i][2] Case "Button" $aCtrlInfo[$i][0] = GUICtrlCreateButton($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7]) GUICtrlSetTip(-1, $aCtrlInfo[$i][8]) Case "Checkbox" $aCtrlInfo[$i][0] = GUICtrlCreateCheckbox($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6]) GUICtrlSetState(-1, $aCtrlInfo[$i][9]) Case "Label" $aCtrlInfo[$i][0] = GUICtrlCreateLabel($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6]) If $aCtrlInfo[$i][10] <> "" Then Local $fontParams = StringSplit($aCtrlInfo[$i][10], ",") GUICtrlSetFont(-1, $fontParams[1], $fontParams[2], $fontParams[3]) EndIf Case "Icon" $aCtrlInfo[$i][0] = GUICtrlCreateIcon($aCtrlInfo[$i][3], $aCtrlInfo[$i][4], $aCtrlInfo[$i][5], $aCtrlInfo[$i][6], $aCtrlInfo[$i][7], $aCtrlInfo[$i][8]) GUICtrlSetTip(-1, $aCtrlInfo[$i][9]) EndSwitch GUICtrlSetOnEvent(-1, "_HandleCtrlEvent") Next EndFunc
Schöne Grüße
funkey
-
Habe mir da zu wenig Zeit genommen und Verwirrung gestiftet mit der Übergabe von UINT anstelle vom Pointer.
Es funktioniert, aber es ist nicht richtig so. Außerdem wird ein 'True' bei einem Pointer leider auf 0 und nicht auf 1 gecastet, deshalb habe ich den Integer-Typen verwendet.
Hier nochmal ein Code zum Testen:
Code
Alles anzeigenGlobal Const $SPI_SETMOUSESONAR = 0x101D Global $iEnableSonar = 1; Global $aRet $aRet = DllCall("user32.dll", "BOOL", "SystemParametersInfoA", "UINT", $SPI_SETMOUSESONAR, "UINT", 0, "PTR", True, "UINT", 0) ConsoleWrite($aRet[3] & @CRLF) ; <-- 0 $aRet = DllCall("user32.dll", "BOOL", "SystemParametersInfoA", "UINT", $SPI_SETMOUSESONAR, "UINT", 0, "UINT", True, "UINT", 0) ConsoleWrite($aRet[3] & @CRLF) ; <-- 1 $aRet = DllCall("user32.dll", "BOOL", "SystemParametersInfoA", "UINT", $SPI_SETMOUSESONAR, "UINT", 0, "PTR", $iEnableSonar, "UINT", 0) ConsoleWrite($aRet[3] & @CRLF) ; <-- 1 Sleep(5000) $iEnableSonar = 0; $aRet = DllCall("user32.dll", "BOOL", "SystemParametersInfoA", "UINT", $SPI_SETMOUSESONAR, "UINT", 0, "PTR", $iEnableSonar, "UINT", 0)
-
Global Const $SPI_SETMOUSESONAR = 0x101D
Global $bEnableSonar = True;
Local $aRet = DllCall("user32.dll", "BOOL", "SystemParametersInfoA", "UINT", $SPI_SETMOUSESONAR, "UINT", 0, "UINT", $bEnableSonar, "UINT", 0) -
Ich verwende immer mal wieder das Whitespace welches man mit ALT+255 erzeugen kann. Hat noch immer funktioniert.
-
Vielleicht hilft das:
Determine if a Directory is a JunctionThis is almost too simple to post, but someone mentioned it in the beta thread. On Vista and 7 there are multiple junction points that point recursively within…www.autoitscript.com -
Wir durften in der Schule immer die letzten 20Minuten Shogun spielen.. Shogun (Computerspiel) – Wikipedia
Das war mega spannend!
-
Bei mir läuft ein Programm xy.exe. Dieses prüft alle 2 Sekunden ob es eine xy.exe.update.exe gibt. falls ja, dann wird xy.exe in xy.exe.old.exe kopiert, xy.exe beendet, xy.exe.update.exe in xy.exe umbenannt und gestartet. Das läuft bei mir über eine aufgerufene Batch-Datei und läuft problemlos, auch wenn es kompliziert klingt.
-
Code
Alles anzeigenLocal $sString = "123456789012345678901234567890123456789012345678901234567890" Local $sStringNew = $sString Local $aArr_1[4] = ["1", "a", "j", "t"] ; Ersetzungszeichen für "1" Local $cChange = "1" Local $cRdn Local $iStrPos = 1 Local $iFound Do $iStrPos = StringInStr($sStringNew, $cChange, 0, 1, $iStrPos, StringLen($sStringNew) - $iStrPos + 1) $cRdn = $aArr_1[Random(0, UBound($aArr_1) - 1, 1)] $iFound = $iStrPos If $cRdn <> $cChange And $iFound <> 0 Then $sStringNew = StringReplace($sStringNew, $iStrPos, $cRdn, 1) EndIf $iStrPos += 1 Until $iFound = 0 ConsoleWrite("OLD: " & $sString & @CRLF & "NEW: " & $sStringNew & @CRLF)
-
Sollte eventuell so heißen:
#include "ActiveDirektory\AD.au3"
-
Create a PDF with own styleGood morning I was looking around the forum if there were some customizable solutions about creating a PDF from "0" to something like a report... What I'd like…www.autoitscript.com
Hatte da mal was.
-
Hab da wohl zu wenig getestet...
Sollte jetzt funktionieren, hab's oben geändert.
Und jetzt auch mit den Standard-Button-Texten, also ohne SetButtonNames().
-
Hallo,
hab das mal in meine HookDlgBox-UDF eingebaut.
HookDlgBox.au3
AutoIt
Alles anzeigen#include-once #include <winapi.au3> #include <timers.au3> Global Const $tagCBT_CREATEWND = "ptr lpcs;HWND tagCBT_CREATEWND" Global Const $tagCREATESTRUCT = "ptr lpCreateParams;handle hInstance;HWND hMenu;HWND hwndParent;int cy;int cx;int y;int x;LONG style;ptr lpszName;ptr lpszClass;DWORD dwExStyle" Global $g__hProcDlgBox = DllCallbackRegister("__DlgBox_CbtHookProc", "LRESULT", "int;WPARAM;LPARAM") Global $g__TIdDlgBox = _WinAPI_GetCurrentThreadId() Global $g__hHookDlgBox = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($g__hProcDlgBox), 0, $g__TIdDlgBox) Global Const $g__MaxDlgBtns = 5 ; maximum of 5 buttons to rename text Global Const $g__MaxDlgItemId = 11 ; maximun ID of buttons to search is 11 as this is the maximun used in Messagebox Global $g__DlgBoxPosX, $g__DlgBoxPosY, $g__DlgBoxWidth, $g__DlgBoxHeight Global $g__aDlgBoxBtnText[$g__MaxDlgBtns] Global $g__DlgBtnCount = 0 Global $g_DlgBoxTimeout = 0 Global $g_DlgBoxTimeCtrlNum, $g_DlgBoxTimeCtrlId Global $g_DlgBoxTimerId _DlgBox_SetDefaults() OnAutoItExitRegister("__DlgBox_UnregisterHook") Func _DlgBox_SetButtonNames($TxtBtn1 = Default, $TxtBtn2 = Default, $TxtBtn3 = Default, $TxtBtn4 = Default, $TxtBtn5 = Default) $g__aDlgBoxBtnText[0] = $TxtBtn1 $g__aDlgBoxBtnText[1] = $TxtBtn2 $g__aDlgBoxBtnText[2] = $TxtBtn3 $g__aDlgBoxBtnText[3] = $TxtBtn4 $g__aDlgBoxBtnText[4] = $TxtBtn5 $g__DlgBtnCount = @NumParams EndFunc ;==>_DlgBox_SetButtonNames Func _DlgBox_SetPosition($x = Default, $y = Default) ;only for MsgBox, not working and not needed for InputBox $g__DlgBoxPosX = $x $g__DlgBoxPosY = $y EndFunc ;==>_DlgBox_SetPosition Func _DlgBox_SetSize($w = Default, $h = Default) $g__DlgBoxWidth = $w $g__DlgBoxHeight = $h EndFunc ;==>_DlgBox_SetSize Func _DlgBox_SetDefaults() $g__DlgBoxPosX = Default $g__DlgBoxPosY = Default $g__DlgBoxWidth = Default $g__DlgBoxHeight = Default For $i = 0 To UBound($g__aDlgBoxBtnText) - 1 $g__aDlgBoxBtnText[$i] = Default Next $g_DlgBoxTimeout = 0 EndFunc ;==>_DlgBox_SetDefaults Func _DlgBox_SetTimeout($iTimeout = 0, $CtrlId = 1) $g_DlgBoxTimeout = $iTimeout $g_DlgBoxTimeCtrlNum = $CtrlId EndFunc ;==>_DlgBox_SetTimeout Func __DlgBox_CbtHookProc($nCode, $wParam, $lParam) Local $tcw, $tcs Local $iSearch = 0 Local $ahBtn[$g__DlgBtnCount] If $nCode < 0 Then Return _WinAPI_CallNextHookEx($g__hHookDlgBox, $nCode, $wParam, $lParam) EndIf Switch $nCode Case 3 ;5=HCBT_CREATEWND If _WinAPI_GetClassName(HWnd($wParam)) = "#32770" Then ;Dialog window class $tcw = DllStructCreate($tagCBT_CREATEWND, $lParam) $tcs = DllStructCreate($tagCREATESTRUCT, DllStructGetData($tcw, "lpcs")) If $g__DlgBoxPosX <> Default Then DllStructSetData($tcs, "x", $g__DlgBoxPosX) If $g__DlgBoxPosY <> Default Then DllStructSetData($tcs, "y", $g__DlgBoxPosY) If $g__DlgBoxWidth <> Default Then DllStructSetData($tcs, "cx", $g__DlgBoxWidth) If $g__DlgBoxHeight <> Default Then DllStructSetData($tcs, "cy", $g__DlgBoxHeight) If $g_DlgBoxTimeout <> 0 Then $g_DlgBoxTimerId = _Timer_SetTimer(HWnd($wParam), 1000, "_UpdateTime") EndIf EndIf Case 5 ;5=HCBT_ACTIVATE If _WinAPI_GetClassName(HWnd($wParam)) = "#32770" Then ;Dialog window class For $i = 1 To $g__MaxDlgItemId ;~ ConsoleWrite($i & " - " & $iSearch & " - " & _WinAPI_GetDlgItemText($wParam, $i) & @CRLF) If IsHWnd(_WinAPI_GetDlgItem($wParam, $i)) Then If $g_DlgBoxTimeout > 0 Then If $g__aDlgBoxBtnText[$iSearch] = Default Then $g__aDlgBoxBtnText[$iSearch] = _WinAPI_GetDlgItemText($wParam, $i) If $iSearch == $g_DlgBoxTimeCtrlNum - 1 Then $g_DlgBoxTimeCtrlId = $i If $g__aDlgBoxBtnText[$iSearch] <> Default Then _WinAPI_SetDlgItemText($wParam, $i, $g__aDlgBoxBtnText[$iSearch] & " [" & $g_DlgBoxTimeout & "]") Else If $g__aDlgBoxBtnText[$iSearch] <> Default Then _WinAPI_SetDlgItemText($wParam, $i, $g__aDlgBoxBtnText[$iSearch]) EndIf Else If $g__aDlgBoxBtnText[$iSearch] <> Default Then _WinAPI_SetDlgItemText($wParam, $i, $g__aDlgBoxBtnText[$iSearch]) EndIf $iSearch += 1 ;Vorzeitiges Abbrechen der Schleife deaktiviert ;~ If $iSearch >= UBound($ahBtn) Then ExitLoop EndIf Next EndIf ;Bugfix: OK-Button wechselt von ID1 nach ID2 wenn er alleine angezeigt wird!??? If $iSearch = 1 And $g_DlgBoxTimeCtrlId = 1 Then $g_DlgBoxTimeCtrlId = 2 Case 4 ;4=HCBT_DESTROYWND If _WinAPI_GetClassName(HWnd($wParam)) = "#32770" Then ;Dialog window class _Timer_KillTimer(HWnd($wParam), $g_DlgBoxTimerId) $g_DlgBoxTimeout = 0 EndIf EndSwitch Return _WinAPI_CallNextHookEx($g__hHookDlgBox, $nCode, $wParam, $lParam) EndFunc ;==>__DlgBox_CbtHookProc Func _UpdateTime($hWnd, $iMsg, $iIDTimer, $iTime) #forceref $hWnd, $iMsg, $iIDTimer, $iTime $g_DlgBoxTimeout -= 1 _WinAPI_SetDlgItemText($hWnd, $g_DlgBoxTimeCtrlId, $g__aDlgBoxBtnText[$g_DlgBoxTimeCtrlNum - 1] & " [" & $g_DlgBoxTimeout & "]") If $g_DlgBoxTimeout <= 0 Then WinClose($hWnd) EndIf EndFunc ;==>_UpdateTime Func __DlgBox_UnregisterHook() _WinAPI_UnhookWindowsHookEx($g__hHookDlgBox) DllCallbackFree($g__hProcDlgBox) EndFunc ;==>__DlgBox_UnregisterHook Func _WinAPI_SetDlgItemText($hDlg, $nIDDlgItem, $lpString) Local $aRet = DllCall('user32.dll', "int", "SetDlgItemText", _ "hwnd", $hDlg, _ "int", $nIDDlgItem, _ "str", $lpString) Return $aRet[0] EndFunc ;==>_WinAPI_SetDlgItemText Func _WinAPI_GetDlgItemText($hDlg, $nIDDlgItem) Local $aRet = DllCall('user32.dll', "uint", "GetDlgItemTextW", _ "hwnd", $hDlg, _ "int", $nIDDlgItem, _ "wstr", "", _ "int", 1000) Return $aRet[3] EndFunc ;==>_WinAPI_GetDlgItemText </timers.au3></winapi.au3>
HookDlgBox Timeout Beispiel
AutoIt
Alles anzeigen#include "HookDlgBox.au3" Global $Timeout = 5 _DlgBox_SetTimeOut($Timeout, 1) _DlgBox_SetButtonNames("one", "two", "three") Global $iRet1 = MsgBox(3, "Test 1", "Custom button texts", $Timeout) ConsoleWrite($iRet1 & @CRLF) Global $iRet2 = MsgBox(3, "Test 2", "Custom button texts", $Timeout) ConsoleWrite($iRet2 & @CRLF) _DlgBox_SetTimeOut($Timeout, 2) Global $iRet3 = MsgBox(3, "Test 3", "Custom button texts") ConsoleWrite($iRet3 & @CRLF) _DlgBox_SetTimeOut($Timeout, 3) Global $iRet4 = MsgBox(3, "Test 4", "Custom button texts") ConsoleWrite($iRet4 & @CRLF)
-
GUICtrlSetStyle(-1, $GUI_SS_DEFAULT_BUTTON)
-
Soll bei 81 (also genaue Quadratzahl) jetzt 9 oder 10 herauskommen?