Beiträge von gmmg
-
-
-
Hallo Zusammen,
per GUICtrlCreateMenu habe ich ein Menü (Menü1) und 2 MenüItems (Menü2 / Exit) erzeugt.
Nun möchte ich, dass wenn Menü1 geklickt wird auch der entsprechende Case zweig reagiert.
Die Menü-Item (Menü2 und Exit) Einträge funktionieren ohne Probleme.
Gibt es da eine Lösung?
AutoIt
Alles anzeigen#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $mM1 = GUICtrlCreateMenu("Menü1") $mM2 = GUICtrlCreateMenuItem("Menü2",-1) $mExit = GUICtrlCreateMenuItem("Exit",-1) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $mExit Exit Case $mM1 MsgBox(0, "1", "I can be actioned!") Case $mM2 MsgBox(0, "2", "I can be actioned!") EndSwitch WEnd
Hier hatte ich im englischen Forum ein Beispiel gefudnen, allerdings fehlt da die Unterscheidung der Button.
AutoIt
Alles anzeigen#include <GUIConstantsEx.au3> #include <array.au3> #include <winapi.au3> #include <WindowsConstants.au3> $GUI = Guicreate("blabla") $FileMenu = GUICtrlCreateMenu("&Options") GUIRegisterMsg($WM_INITMENU,"_menuclick") Guisetstate() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case 3 MsgBox (0,"1","" ) EndSwitch WEnd Func _menuclick($hWndGUI, $MsgID, $WParam, $LParam) msgbox(0,"2","") EndFunc
Danke und allen vorab ein schönes Pfingstwochenende
Gruß gmmg
-
kein Problem, hast mir ja schon geholfen
Eventuell ist es ja trotzdem auch für andere interessant, da die Tools wie Greenshot usw, aktuell keine mir bekannte Möglichkeit haben, ein File zu übergeben, ohne das noch extra etwas gewählt werden muss.
Zu den aktuellen Todo's im Image Editor:
1. die Farbauswahl funktioniert nun -> erledigt
Es hatte nur die folgende Zeile im Case $idColor_IE gefehlt.
_GDIPlus_PenSetColor($hPen_IE, $IE_Pen_Col)
2. Beim Text hinzufügen, wird in das Bild hinein gezoomt. Kann man das verhindern? -> erledigt
Wenn man eine Text erstellt hat, diesen dann aber nicht nutzen möchte, also mit ESC abbricht, wird dennoch gezoomt. ->
offen-> erledigt in V3.3Hier nochmal die aktuelle Version:
Screenshot
Gruß gmmg
-
anbei der für meine Bedürfnisse angepasste Code.
Leider lässt sich aktuell ein größerer Text nicht anfügen, hier kommt die Meldung "Deine Nachricht ist zu lang. Es stehen maximal 40.000 Zeichen zur Verfügung."
Die Farbauswahl funktioniert, wird aber nicht auf die Elemte übernommen.
Was mir eben noch aufgefallen ist, wenn man eine Text hinzufügt, wird in das Bild leicht hinein gezoomt. Kann man das verhindern?
Danke
Gruß gmmg
-
Hallo UEZ,
Vielen Dank für deine Info.
Die Basic Image Editor.au3 läuft ganz gut. hier sind aber einige ToDo's nötig:
1. Save File funktioniert nicht, keine Funktion hinterlegt -> erledigt
2. Bilddatei "BMP" Datei beim Start übergeben -> erledigt
3. Farbeauswahl funktioniert nicht, wird nicht auf die Elemte übernommen.
Vielleicht hat da jemand eien passende Lösung.
Das Windows Screenshooter Tool v1.84 hab ich bis jetzt noch nicht ans laufen gebracht.
Da kommt der folgende Fehler:
AutoIt Windows Screenshooter v1.84 Build 2019-08-18\AutoIt Windows Screenshooter\_Source\Windows Screenshooter.au3"(122,107) : error: $GDIP_WrapModeTileFlipXY previously declared as a 'Const'.
Global Enum $GDIP_WrapModeTile, $GDIP_WrapModeTileFlipX, $GDIP_WrapModeTileFlipY, $GDIP_WrapModeTileFlipXY,
Gruß gmmg
-
Hallo Zusammen,
als Erweiterung des Screenshot Tools (Codeschnipsel von UEZ habe im englischen Forum habe ich folgendes Script von UEZ gefunden.
Screenshot Tool
AutoIt
Alles anzeigen#include-once #include <Clipboard.au3> #include <GUIConstantsEx.au3> #include <WinAPIConstants.au3> #include <WinAPIGdi.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> Global $iX1, $iY1, $iX2, $iY2, $aPos, $sMsg Global $hHBitmap ;--- Create GUI --- $hMain_GUI = GUICreate("Screenshot-Tool", 250, 50, @DeskTopWidth -285 , @DeskTopHeight -150) $hRect_Button = GUICtrlCreateButton("Screenshot erstellen", 35, 13, 180, 25) WinSetOnTop ( "Screenshot-Tool","", 1) GUISetState(@SW_SHOW) While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $hRect_Button If FileExists(@ScriptDir & "\Captured.bmp") then FileDelete(@ScriptDir & "\Captured.bmp") GUISetState(@SW_HIDE, $hMain_GUI) $hHBitmap = _WinAPI_MarkScreenRegionAndCapture() _WinAPI_SaveHBITMAPToFile(@ScriptDir & "\Captured.bmp", $hHBitmap) _WinAPI_DeleteObject($hHBitmap) ;If FileExists(@ScriptDir & "\Captured.bmp") Then ShellExecute(@ScriptDir & "\Captured.bmp") If FileExists(@ScriptDir & "\Captured.bmp") Then Run("mspaint " & @ScriptDir & "\Captured.bmp") ;If FileExists(@ScriptDir & "\Captured.bmp") Then Run("C:\Program Files\Greenshot\Greenshot.exe " & @ScriptDir & "\Captured.bmp") GUISetState(@SW_SHOW, $hMain_GUI) ;Exit EndSwitch WEnd ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinAPI_MarkScreenRegionAndCapture ; Description ...: Selected area on desktop will be captured and save to clipbord or GDI bitmap handle will be returned. ; Syntax ........: _WinAPI_MarkScreenRegionAndCapture([$iFillMode = 0[, $bClipboard = True]]) ; Parameters ....: $iFillMode - [optional] an integer value. Default is 0. ; 0: marked area filled with solid color ; 1: marked area filled with hatch pattern ($HS_DIAGCROSS) ; 2: marked area without any fill pattern / color - only red border ; $bClipboard - [optional] a boolean value. Default is False. If True then no GDI bitmap handle will be returned. ; If false then GDI bitmap handle will be returned. ; $bManual - [optional] a boolean value. Default is False. If True manual capturing is activated. ; $iX1 - [optional] an integer value. Default is 0. If $bManual is true enter the x1 screen pos. ; $iY1 - [optional] an integer value. Default is 0. If $bManual is true enter the Y1 screen pos. ; $iX2 - [optional] an integer value. Default is 0. If $bManual is true enter the x2 screen pos. ; $iY2 - [optional] an integer value. Default is 0. If $bManual is true enter the y2 screen pos. ; Return values .: 0 / 1 / -1 / GDI bitmap handle ; Author ........: UEZ ; Version .......: 0.92 build 2017-01-22 ; Modified ......: ; Remarks .......: Do not forget to dispose returned GDI bitmap handle for non clipboard mode using _WinAPI_DeleteObject! ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _WinAPI_MarkScreenRegionAndCapture($iFillMode = 0, $bClipboard = False, $bManual = False, $iX1 = 0, $iY1 = 0, $iX2 = 0, $iY2 = 0) If @OSBuild > 6299 Then ;https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx DllCall("Shcore.dll", "long", "PROCESS_DPI_AWARENESS", 1) ;PROCESS_SYSTEM_DPI_AWARE = 1 (https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx) Else DllCall("User32.dll", "bool", "SetProcessDPIAware") EndIf Local $iOld = AutoItSetOption("MouseCoordMode", 1) If Not $bManual Then Local Const $hDesktop = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Local Const $aFullScreen = WinGetPos($hDesktop) ;should work also on multi screens Local Const $iW = $aFullScreen[2], $iH = $aFullScreen[3] Local Const $hGUI_Screencapture = GUICreate("", $iW, $iH, $aFullScreen[0], $aFullScreen[1], $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) GUISetState(@SW_SHOW, $hGUI_Screencapture) Local Const $hDC = _WinAPI_GetDC($hGUI_Screencapture) Local Const $hGfxDC = _WinAPI_CreateCompatibleDC($hDC) Local Const $hBitmapGDI = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local $hObjOld = _WinAPI_SelectObject($hGfxDC, $hBitmapGDI) Local $tSize = DllStructCreate($tagSIZE) $tSize.x = $iW $tSize.y = $iH Local $tSource = DllStructCreate($tagPOINT) Local $tBlend = DllStructCreate($tagBLENDFUNCTION) $tBlend.Alpha = 0xFF $tBlend.Format = 1 Local $tDest = DllStructCreate($tagPOINT) $tDest.x = $aFullScreen[0] $tDest.y = $aFullScreen[1] Local Const $hPen = _WinAPI_CreatePen($PS_SOLID, 1, 0x0000FF) Local Const $hPen_Orig = _WinAPI_SelectObject($hGfxDC, $hPen) Local $hBrush, $iAlpha2, $iFlag $iFillMode = $iFillMode > 2 ? 2 : $iFillMode < 0 ? 0 : $iFillMode Switch $iFillMode Case 0 $hBrush = _WinAPI_CreateBrushIndirect($BS_SOLID, 0x808080) $iAlpha2 = 0xA0 $iFlag = $ULW_ALPHA Case 1 $hBrush = _WinAPI_CreateBrushIndirect($BS_HATCHED, 0x808000, $HS_DIAGCROSS) $iAlpha2 = 0x30 $iFlag = $ULW_ALPHA Case 2 $hBrush = _WinAPI_CreateBrushIndirect($BS_HOLLOW, 0x000000) $iAlpha2 = 0xFF ;not needed $iFlag = $ULW_COLORKEY EndSwitch Local $hBrush_Orig = _WinAPI_SelectObject($hGfxDC, $hBrush) Else If Not BitOr($iX1, $iX2, $iY1, $iY2) Then Return SetError(4, 0, 0) EndIf Local $aMPos[5], $aMPos_old[4], $tRECT = _WinAPI_CreateRect(0, 0, 0, 0) Do If $bManual Then $aMPos[2] = 1 Else GUISetCursor(16, 1, $hGUI_Screencapture) $aMPos = GUIGetCursorInfo($hGUI_Screencapture) $aMPos_old[0] = $aMPos[0] $aMPos_old[1] = $aMPos[1] $aMPos_old[2] = MouseGetPos(0) $aMPos_old[3] = MouseGetPos(1) EndIf Switch $aMPos[2] Case 0 ;display crosshair _WinAPI_BitBlt($hGfxDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $CAPTUREBLT) _WinAPI_DrawLine($hGfxDC, $tDest.x, $aMPos[1], $iW, $aMPos[1]) _WinAPI_DrawLine($hGfxDC, $aMPos[0], $tDest.y, $aMPos[0], $iH) _WinAPI_UpdateLayeredWindow($hGUI_Screencapture, $hDC, $tDest, $tSize, $hGfxDC, $tSource, 0, $tBlend, $ULW_COLORKEY) Case 1 ;capture selected region If Not $bManual Then $tBlend.Alpha = $iAlpha2 While $aMPos[2] ;mark region GUISetCursor(14, 1, $hGUI_Screencapture) ;WinGetHandle(AutoItWinGetTitle())) $aMPos = GUIGetCursorInfo($hGUI_Screencapture) _WinAPI_BitBlt($hGfxDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $CAPTUREBLT) ;clear bitmap ;draw rectangle $tRECT.Left = $aMPos_old[0] $tRECT.Top = $aMPos_old[1] $tRECT.Right = $aMPos[0] $tRECT.Bottom = $aMPos[1] _WinAPI_Rectangle($hGfxDC, $tRECT) If $iFillMode <> 2 Then _WinAPI_InvertRect($hGfxDC, $tRECT) _WinAPI_UpdateLayeredWindow($hGUI_Screencapture, $hDC, $tDest, $tSize, $hGfxDC, $tSource, 0, $tBlend, $iFlag) Sleep(10) WEnd _WinAPI_SelectObject($hGfxDC, $hObjOld) _WinAPI_ReleaseDC($hGUI_Screencapture, $hDC) _WinAPI_DeleteDC($hGfxDC) _WinAPI_DeleteObject($hBitmapGDI) _WinAPI_SelectObject($hGfxDC, $hPen_Orig) _WinAPI_DeleteObject($hPen) _WinAPI_SelectObject($hGfxDC, $hBrush_Orig) _WinAPI_DeleteObject($hBrush) GUIDelete($hGUI_Screencapture) ;capture region $aMPos[0] = MouseGetPos(0) $aMPos[1] = MouseGetPos(1) Else $aMPos_old[2] = $iX1 $aMPos_old[3] = $iY1 $aMPos[0] = $iX2 $aMPos[1] = $iY2 EndIf Local Const $hDC_Region = _WinAPI_GetDC(0) Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Region) Local Const $iW_Region = Abs($aMPos[0] - $aMPos_old[2]) + 1, $iH_Region = Abs($aMPos[1] - $aMPos_old[3]) + 1 Local $hHBitmap_Captured = _WinAPI_CreateCompatibleBitmap($hDC_Region, $iW_Region, $iH_Region) $hObjOld = _WinAPI_SelectObject($hMemDC, $hHBitmap_Captured) _WinAPI_BitBlt($hMemDC, 0, 0, $iW_Region, $iH_Region, $hDC_Region, _ $aMPos[0] > $aMPos_old[2] ? $aMPos_old[2] : $aMPos[0], _ $aMPos[1] > $aMPos_old[3] ? $aMPos_old[3] : $aMPos[1], BitOR($SRCCOPY, $CAPTUREBLT)) Local $hHBitmap_Clipboard = _WinAPI_CopyImage($hHBitmap_Captured, 0, 0, 0, BitOR($LR_COPYDELETEORG, $LR_COPYRETURNORG)) _WinAPI_SelectObject($hHBitmap_Captured, $hObjOld) _WinAPI_DeleteDC($hHBitmap_Captured) _WinAPI_ReleaseDC(0, $hDC_Region) AutoItSetOption("MouseCoordMode", $iOld) If $bClipboard Then ;put captured region to clipboard If Not _ClipBoard_Open(0) Then _WinAPI_DeleteObject($hHBitmap_Clipboard) Return SetError(1, 0, 0) EndIf If Not _ClipBoard_Empty() Then _WinAPI_DeleteObject($hHBitmap_Clipboard) Return SetError(2, 0, 0) EndIf Local Const $hCP = _ClipBoard_SetDataEx($hHBitmap_Clipboard, $CF_BITMAP) If Not $hCP Or @error Then _WinAPI_DeleteObject($hHBitmap_Clipboard) Return SetError(3, 0, 0) EndIf _ClipBoard_Close() _WinAPI_DeleteObject($hHBitmap_Clipboard) Return 1 Else Return $hHBitmap_Clipboard EndIf EndSwitch Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _WinAPI_SelectObject($hGfxDC, $hObjOld) _WinAPI_ReleaseDC($hGUI_Screencapture, $hDC) _WinAPI_DeleteDC($hGfxDC) _WinAPI_DeleteObject($hBitmapGDI) _WinAPI_SelectObject($hGfxDC, $hPen_Orig) _WinAPI_DeleteObject($hPen) GUIDelete($hGUI_Screencapture) AutoItSetOption("MouseCoordMode", $iOld) Return -1 EndSwitch Until False EndFunc ;==>_WinAPI_MarkScreenRegionAndCapture
Basic Image Editor
URL = https://www.autoitscript.com/f…ndComment&comment=1086282
Beispiel vom Basic Image Editor
Für das Screenshot Tool wäre es schön, wenn die Pfeile, Text, Rechteck und markieren funktionieren würde. Leider stürzt das Tool beim Text aktuell ab.
Gruß gmmg
-
bei mir funktioniert der Download mit folgendem Script auch. Aber die heruntergladene Datei hat die Endung .tmp nicht .exe
AutoIt
Alles anzeigen#include <InetConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> ; Save the downloaded file to the temporary folder. Local $sFilePath = _WinAPI_GetTempFileName(@ScriptDir) ; Download the file by waiting for it to complete. The option of 'get the file from the local cache' has been selected. Local $iBytesSize = InetGet("https://bits.avcdn.net/productfamily_ANTIVIRUS/insttype_FREE/platform_WIN/installertype_FULL/build_RELEASE/cookie_mmm_ava_998_999_000_m", $sFilePath, $INET_FORCERELOAD) ; Retrieve the filesize. Local $iFileSize = FileGetSize($sFilePath) ; Display details about the total number of bytes read and the filesize. MsgBox($MB_SYSTEMMODAL, "", "The total download size: " & $iBytesSize & @CRLF & _ "The total filesize: " & $iFileSize)
Ich nutze den Webdriver.exe mit Google Chrome und benenne die jeweilige Webdriver.exe entsprechend der Webdriver Version um "webdriver_113.exe" um.
Im Script wird dann die Version vom Webdriver und Chrome abgefragt.
AutoIt
Alles anzeigen$file = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" If FileExists($file) Then $google_chrome_version = FileGetVersion($file) $google_chrome_version_array = StringSplit($google_chrome_version,".") $webdriver = "chromedriver_" & $google_chrome_version_array[1] & ".exe" If Not FileExists(@ScriptDir & '\data\'& $webdriver) Then MsgBox(0,"Info","Google Chromedriver nicht vorhanden." & @CRLF & $webdriver) Exit EndIf Else MsgBox(0,"Info","Google Chrome in folgenden Pfad nicht vorhanden." & @CRLF & @CRLF & $file) Exit EndIf
Gruß gmmg
-
-
im englischen Forum gefunden: https://www.autoitscript.com/f…stion-about-requireadmin/
AutoIt
Alles anzeigenMsgBox(0, "Test", "User is " & (IsAdmin() ? "" : "not ") & "Admin.") If Not IsAdmin() Then _RerunAsAdmin() Else MsgBox(0, "Is Admin?", "Yes, Admin.") ;Example. EndIf Func _RerunAsAdmin() Local $sParameters = "" If Not @Compiled Then $sParameters = '"' & @ScriptFullPath & '"' EndIf ShellExecute(@AutoItExe, $sParameters, "", "runas") If @error Then Return MsgBox(16 + 262144, "ERROR!", "Unable to elevate to Admin due to UAC.") EndFunc
Beispiel GUI
AutoIt
Alles anzeigen#include <GUIConstantsEx.au3> GUICreate("AutoIt IsAdminTest", 220, 200) $Button_admin = GUICtrlCreateButton("admin", 10, 70, 50, 20) GUISetState(@SW_SHOW) MsgBox(0, "Test", "User is " & (IsAdmin() ? "" : "not ") & "Admin.") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_admin _RerunAsAdmin() Exit EndSelect WEnd MsgBox(0, "Test", "User is " & (IsAdmin() ? "" : "not ") & "Admin.") If Not IsAdmin() Then _RerunAsAdmin() Else MsgBox(0, "Is Admin?", "Yes, Admin.") ;Example. EndIf Func _RerunAsAdmin() Local $sParameters = "" If Not @Compiled Then $sParameters = '"' & @ScriptFullPath & '"' EndIf ShellExecute(@AutoItExe, $sParameters, "", "runas") If @error Then Return MsgBox(16 + 262144, "ERROR!", "Unable to elevate to Admin due to UAC.") EndFunc
Gruß gmmg
-
Racer: schau doch mal nach #RequireAdmin
Ich hatte mal folgendes Script im Einsatz, um eine msi zu installieren. vielleicht kannst du damit was anfangen.
AutoIt
Alles anzeigen;msi installer #RequireAdmin If Not IsAdmin() Then RunAs("****", @LogonDomain, "**********", 0, @ScriptFullPath, @ScriptDir, @SW_HIDE) Exit EndIf If IsAdmin() Then MsgBox(0, "", "Admin-Rechte erkannt.",1) EndIf MsgBox(0,"","Install beginnt",2) ;RunWait ('msiexec /i "C:\scripte\7z465.msi" /quiet', "" , @SW_HIDE) MsgBox(0,"","Install fertig",2)
Gruß gmmg
-
Ich glaube ich habe den Fehler gefunden. Es liegt am Antivierenprogramm, der blockt mir die AutoIt3.exe. Was komisch ist nur diese Version 3.3.16.1. Die AutoIt3_x64 wir auch nicht geblockt.
Ist also erledigt
-
-
AutoBert hat mir im engl. Forum den Hinweis gegegen.
Den Button mit GUICtrlDelete($File_Button) löschen und mit anderem Text erstellen.
Gruß gmmg
-
Hallo Zusammen,
für ein Projekt benutze ich die MetroGUI UDF.
Hier gibt es leider keine Funktion um den Text eines Buttons zur Laufzeit zu ändern. Das GUICtrlSetData($Button, "text") geht nicht, da der Metro Button per GDIPlus erzeugt wird.
$File_Button = _Metro_CreateButton("Screenshot oder Datei anfügen", 286, 605, 220, 25)
Hier mal das Demo File. Die UDF selbst ist als Attachment angehangen.
AutoIt
Alles anzeigen; =============================================================================================================================== ; Name ..........: MetroGUI UDF Example ; Version .......: v5.1 ; Author ........: BB_19 ; =============================================================================================================================== ;!Highly recommended for improved overall performance and responsiveness of the GUI effects etc.! (after compiling): #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /rm /pe ;YOU NEED TO EXCLUDE FOLLOWING FUNCTIONS FROM AU3STRIPPER, OTHERWISE IT WON'T WORK: #Au3Stripper_Ignore_Funcs=_iHoverOn,_iHoverOff,_iFullscreenToggleBtn,_cHvr_CSCP_X64,_cHvr_CSCP_X86,_iControlDelete ;Please not that Au3Stripper will show errors. You can ignore them as long as you use the above Au3Stripper_Ignore_Funcs parameters. ;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling()) #AutoIt3Wrapper_Res_HiDpi=y ; =============================================================================================================================== #NoTrayIcon #include "MetroGUI-UDF\MetroGUI_UDF.au3" #include "MetroGUI-UDF\_GUIDisable.au3" ; For dim effects when msgbox is displayed #include <GUIConstants.au3> ;=======================================================================Creating the GUI=============================================================================== ;Enable high DPI support: Detects the users DPI settings and resizes GUI and all controls to look perfectly sharp. _Metro_EnableHighDPIScaling() ; Note: Requries "#AutoIt3Wrapper_Res_HiDpi=y" for compiling. To see visible changes without compiling, you have to disable dpi scaling in compatibility settings of Autoit3.exe ;Set Theme _SetTheme("LightGreen");DarkTeal") ;See MetroThemes.au3 for selectable themes or to add more ;Create resizable Metro GUI $Form1 = _Metro_CreateGUI("Example", 500, 300, -1, -1, True) ;Add/create control buttons to the GUI $Control_Buttons = _Metro_AddControlButtons(True, True, True, True, True) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True ;Set variables for the handles of the GUI-Control buttons. (Above function always returns an array this size and in this order, no matter which buttons are selected.) $GUI_CLOSE_BUTTON = $Control_Buttons[0] $GUI_MAXIMIZE_BUTTON = $Control_Buttons[1] $GUI_RESTORE_BUTTON = $Control_Buttons[2] $GUI_MINIMIZE_BUTTON = $Control_Buttons[3] $GUI_FULLSCREEN_BUTTON = $Control_Buttons[4] $GUI_FSRestore_BUTTON = $Control_Buttons[5] $GUI_MENU_BUTTON = $Control_Buttons[6] ;====================================================================================================================================================================== ;Create Buttons $Button1 = _Metro_CreateButton("Button Style 1", 50, 245, 115, 40) $Button2 = _Metro_CreateButtonEx("Button Style 2", 195, 245, 115, 40) $Button3 = _Metro_CreateButtonEx2("Button Style 3", 340, 245, 115, 40) ;Create Checkboxes $Checkbox1 = _Metro_CreateCheckbox("Checkbox 1", 30, 70, 125, 30) $Checkbox2 = _Metro_CreateCheckboxEx("Checkbox 2", 30, 107, 125, 30) $Checkbox3 = _Metro_CreateCheckboxEx2("Checkbox 3", 29, 142, 125, 30) ;Set status to checked _Metro_CheckboxCheck($Checkbox1, True) _Metro_CheckboxCheck($Checkbox2, True) _Metro_CheckboxCheck($Checkbox3, True) ;Create 3 Radios that are assigned to Radio Group 1 $Radio1 = _Metro_CreateRadio("1", "Radio 1", 180, 70, 100, 30) $Radio2 = _Metro_CreateRadio("1", "Radio 2", 180, 110, 100, 30) $Radio3 = _Metro_CreateRadioEx("1", "Radio 3", 180, 150, 100, 30) ;Style with colored checkmark _Metro_RadioCheck("1", $Radio1) ;check $Radio1 which is assigned to radio group "1" and uncheck any other radio in group "1" ;Create Toggles $Toggle1 = _Metro_CreateToggle("Toggle 1", 320, 70, 130, 30) $Toggle2 = _Metro_CreateToggleEx("Toggle 2", 322, 107, 128, 30) $Toggle3 = _Metro_CreateOnOffToggle("Enabled", "Disabled", 320, 144, 130, 30) ; Creates a toggle with different texts for on/off. Alternatively you can use _Metro_CreateOnOffToggleEx for the secondary toggle style. ;Create Progressbar $Progress1 = _Metro_CreateProgress(100, 195, 300, 26) ;Set resizing options for the controls so they don't change in size or position. This can be customized to match your gui perfectly for resizing. See AutoIt Help file. GUICtrlSetResizing($Button1, 768 + 8) GUICtrlSetResizing($Button2, 768 + 8) GUICtrlSetResizing($Button3, 768 + 8) GUICtrlSetResizing($Checkbox1, 768 + 2 + 32) GUICtrlSetResizing($Checkbox2, 768 + 2 + 32) GUICtrlSetResizing($Checkbox3, 768 + 2 + 32) GUICtrlSetResizing($Radio1, 768 + 2 + 32) GUICtrlSetResizing($Radio2, 768 + 2 + 32) GUICtrlSetResizing($Radio3, 768 + 2 + 32) GUICtrlSetResizing($Toggle1, 768 + 2 + 32) GUICtrlSetResizing($Toggle2, 768 + 2 + 32) GUICtrlSetResizing($Toggle3, 768 + 2 + 32) GUICtrlSetResizing($Progress1[0], 768 + 2 + 32) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON _Metro_GUIDelete($Form1) ;Delete GUI/release resources, make sure you use this when working with multiple GUIs! Exit Case $GUI_MAXIMIZE_BUTTON GUISetState(@SW_MAXIMIZE, $Form1) Case $GUI_MINIMIZE_BUTTON GUISetState(@SW_MINIMIZE, $Form1) Case $GUI_RESTORE_BUTTON GUISetState(@SW_RESTORE, $Form1) Case $GUI_FULLSCREEN_BUTTON, $GUI_FSRestore_BUTTON ConsoleWrite("Fullscreen toggled" & @CRLF) ;Fullscreen toggle is processed automatically when $ControlBtnsAutoMode is set to true, otherwise you need to use here _Metro_FullscreenToggle($Form1) Case $GUI_MENU_BUTTON ;Create an Array containing menu button names Local $MenuButtonsArray[5] = ["Themes Demo", "Settings", "About", "Contact", "Exit"] ; Open the metro Menu. See decleration of $MenuButtonsArray above. Local $MenuSelect = _Metro_MenuStart($Form1, 150, $MenuButtonsArray) Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array. Case "0" ConsoleWrite("Returned 0 = Starting themes demo. Please note that the window border colors are not updated during this demo." & @CRLF) _ThemesDemo() Case "1" ConsoleWrite("Returned 1 = Settings button clicked." & @CRLF) Case "2" ConsoleWrite("Returned 2 = About button clicked." & @CRLF) Case "3" ConsoleWrite("Returned 3 = Contact button clicked." & @CRLF) Case "4" ConsoleWrite("Returned 4 = Exit button clicked." & @CRLF) _Metro_GUIDelete($Form1) Exit EndSwitch Case $Button3 _GUIDisable($Form1, 0, 30) ;For better visibility of the MsgBox on top of the first GUI. _Metro_MsgBox(0, "Metro MsgBox Example", "Try a rightclick on this button for rightclick menu demo.", 400, 11, $Form1) ; with 3 secs timeout _GUIDisable($Form1) Case $GUI_EVENT_SECONDARYDOWN ;Demo for starting rightclick menu Local $aCInfo = GUIGetCursorInfo($Form1) If $aCInfo[4] = $Button3 Then ;Create an Array containing menu button names Local $MenuButtonsArray[4] = ["Button 1", "Button 2", "Button 3", "Button 4"] ; Open the rightclick Menu. See decleration of $MenuButtonsArray above. Local $MenuSelect = _Metro_RightClickMenu($Form1, 300, $MenuButtonsArray) Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array. Case "0" ConsoleWrite("Returned 0 = Button 1 clicked." & @CRLF) Case "1" ConsoleWrite("Returned 1 = Button 2 clicked." & @CRLF) Case "2" ConsoleWrite("Returned 2 = Button 3 clicked." & @CRLF) Case "3" ConsoleWrite("Returned 3 = Button 4 clicked." & @CRLF) EndSwitch EndIf Case $Button2 _GUIDisable($Form1, 0, 30) ;For better visibility of the MsgBox on top of the first GUI. _Metro_MsgBox(0, "Metro MsgBox Example", "Button 2 clicked. (Button with 3 secs timeout)", 400, 11, $Form1, 3) ; with 3 secs timeout _GUIDisable($Form1) Case $Button1 _GUIDisable($Form1, 0, 30) Local $mInput = _Metro_InputBox("Please enter your name.", 11, "", False, True) If Not @error Then _Metro_MsgBox(0, "Metro MsgBox Example", "Hello " & $mInput & ", Press ok to set the progressbar.", 350, 11, $Form1) _GUIDisable($Form1) For $i = 0 To 85 Step +2 Sleep(1) _Metro_SetProgress($Progress1, $i) Next _GUIDisable($Form1, 0, 30) Local $Select_YesNo = _Metro_MsgBox(4, "Metro MsgBox Example", "Select yes to create a second GUI.", 350, 11, $Form1) If $Select_YesNo = "Yes" Then _SecondGUI() _GUIDisable($Form1) Case $Toggle1 If _Metro_ToggleIsChecked($Toggle1) Then _Metro_ToggleUnCheck($Toggle1) ConsoleWrite("Toggle unchecked!" & @CRLF) Else _Metro_ToggleCheck($Toggle1) ConsoleWrite("Toggle checked!" & @CRLF) EndIf Case $Toggle2 If _Metro_ToggleIsChecked($Toggle2) Then _Metro_ToggleUnCheck($Toggle2) ConsoleWrite("Toggle unchecked!" & @CRLF) Else _Metro_ToggleCheck($Toggle2) ConsoleWrite("Toggle checked!" & @CRLF) EndIf Case $Toggle3 If _Metro_ToggleIsChecked($Toggle3) Then _Metro_ToggleUnCheck($Toggle3) ConsoleWrite("Disabled!" & @CRLF) Else _Metro_ToggleCheck($Toggle3) ConsoleWrite("Enabled!" & @CRLF) EndIf Case $Checkbox1 If _Metro_CheckboxIsChecked($Checkbox1) Then _Metro_CheckboxUnCheck($Checkbox1) ConsoleWrite("Checkbox unchecked!" & @CRLF) Else _Metro_CheckboxCheck($Checkbox1) ConsoleWrite("Checkbox checked!" & @CRLF) EndIf Case $Checkbox2 If _Metro_CheckboxIsChecked($Checkbox2) Then _Metro_CheckboxUnCheck($Checkbox2) ConsoleWrite("Checkbox unchecked!" & @CRLF) Else _Metro_CheckboxCheck($Checkbox2) ConsoleWrite("Checkbox checked!" & @CRLF) EndIf Case $Checkbox3 If _Metro_CheckboxIsChecked($Checkbox3) Then _Metro_CheckboxUnCheck($Checkbox3) ConsoleWrite("Checkbox unchecked!" & @CRLF) Else _Metro_CheckboxCheck($Checkbox3) ConsoleWrite("Checkbox checked!" & @CRLF) EndIf Case $Radio1 _Metro_RadioCheck(1, $Radio1) ConsoleWrite("Radio 1 selected!" & @CRLF) Case $Radio2 _Metro_RadioCheck(1, $Radio2) ConsoleWrite("Radio 2 selected = " & _Metro_RadioIsChecked(1, $Radio2) & @CRLF) Case $Radio3 _Metro_RadioCheck(1, $Radio3) ConsoleWrite("Radio 3 (ExStyle) selected!" & @CRLF) EndSwitch WEnd Func _SecondGUI() Local $Form2 = _Metro_CreateGUI("Example2", 600, 400, -1, -1, True) ;Add control buttons Local $Control_Buttons_2 = _Metro_AddControlButtons(True, True, True, True) Local $GUI_CLOSE_BUTTON = $Control_Buttons_2[0] Local $GUI_MAXIMIZE_BUTTON = $Control_Buttons_2[1] Local $GUI_RESTORE_BUTTON = $Control_Buttons_2[2] Local $GUI_MINIMIZE_BUTTON = $Control_Buttons_2[3] Local $Button1 = _Metro_CreateButton("Close", 250, 340, 100, 40) GUICtrlSetResizing($Button1, 768 + 8) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Button1, $GUI_CLOSE_BUTTON _Metro_GUIDelete($Form2) ;Delete GUI/release resources, make sure you use this when working with multiple GUIs! Return 0 Case $GUI_MAXIMIZE_BUTTON GUISetState(@SW_MAXIMIZE, $Form2) Case $GUI_MINIMIZE_BUTTON GUISetState(@SW_MINIMIZE, $Form2) Case $GUI_RESTORE_BUTTON GUISetState(@SW_RESTORE, $Form2) EndSwitch WEnd EndFunc ;==>_SecondGUI Func _ThemesDemo() ;Loop through all themes by recreating all controls Local $ThemesArray[25] = ["DarkMidnightTeal", "DarkMidnightBlue", "DarkMidnightCyan", "DarkMidnight", "DarkTeal", "DarkBlueV2", "DarkBlue", "DarkCyan", "DarkRuby", "DarkGray", "DarkGreen", "DarkGreenV2", "DarkPurple", "DarkAmber", "DarkOrange", "LightTeal", "LightGray", "LightBlue", "LightCyan", "LightGreen", "LightRed", "LightOrange", "LightPurple", "LightPink", "DarkTealV2"] For $i = 0 To 24 GUISetState($Form1, @SW_LOCK) ConsoleWrite($ThemesArray[$i] & @CRLF) _SetTheme($ThemesArray[$i]) ;See MetroThemes.au3 for selectable themes or to add more GUICtrlDelete($Button1) GUICtrlDelete($Button2) GUICtrlDelete($Button3) GUICtrlDelete($Checkbox1) GUICtrlDelete($Checkbox2) GUICtrlDelete($Checkbox3) GUICtrlDelete($Radio1) GUICtrlDelete($Radio2) GUICtrlDelete($Radio3) GUICtrlDelete($Toggle1) GUICtrlDelete($Toggle2) GUICtrlDelete($Toggle3) GUICtrlDelete($Progress1[0]) GUICtrlDelete($GUI_CLOSE_BUTTON) GUICtrlDelete($GUI_MAXIMIZE_BUTTON) GUICtrlDelete($GUI_RESTORE_BUTTON) GUICtrlDelete($GUI_MINIMIZE_BUTTON) GUICtrlDelete($GUI_FULLSCREEN_BUTTON) GUICtrlDelete($GUI_FSRestore_BUTTON) GUICtrlDelete($GUI_MENU_BUTTON) GUISetBkColor($GUIThemeColor, $Form1) $Control_Buttons = _Metro_AddControlButtons(True, True, True, True, True) $GUI_CLOSE_BUTTON = $Control_Buttons[0] $GUI_MAXIMIZE_BUTTON = $Control_Buttons[1] $GUI_RESTORE_BUTTON = $Control_Buttons[2] $GUI_MINIMIZE_BUTTON = $Control_Buttons[3] $GUI_FULLSCREEN_BUTTON = $Control_Buttons[4] $GUI_FSRestore_BUTTON = $Control_Buttons[5] $GUI_MENU_BUTTON = $Control_Buttons[6] $Button1 = _Metro_CreateButton("Button Style 1", 50, 245, 115, 40) $Button2 = _Metro_CreateButtonEx("Button Style 2", 195, 245, 115, 40) $Button3 = _Metro_CreateButtonEx2("Button Style 3", 340, 245, 115, 40) $Checkbox1 = _Metro_CreateCheckbox("Checkbox 1", 30, 70, 125, 30) $Checkbox2 = _Metro_CreateCheckboxEx("Checkbox 2", 30, 107, 125, 30) $Checkbox3 = _Metro_CreateCheckboxEx2("Checkbox 3", 29, 142, 125, 30) _Metro_CheckboxCheck($Checkbox1, True) _Metro_CheckboxCheck($Checkbox2, True) _Metro_CheckboxCheck($Checkbox3, True) $Radio1 = _Metro_CreateRadio("1", "Radio 1", 180, 70, 100, 30) $Radio2 = _Metro_CreateRadio("1", "Radio 2", 180, 110, 100, 30) $Radio3 = _Metro_CreateRadioEx("1", "Radio 3", 180, 150, 100, 30) _Metro_RadioCheck("1", $Radio1) $Toggle1 = _Metro_CreateToggle("Toggle 1", 320, 70, 130, 30) $Toggle2 = _Metro_CreateToggleEx("Toggle 2", 322, 107, 128, 30) $Toggle3 = _Metro_CreateOnOffToggle("Enabled", "Disabled", 320, 144, 130, 30) $Progress1 = _Metro_CreateProgress(100, 195, 300, 26) GUICtrlSetResizing($Button1, 768 + 8) GUICtrlSetResizing($Button2, 768 + 8) GUICtrlSetResizing($Button3, 768 + 8) GUICtrlSetResizing($Checkbox1, 768 + 2 + 32) GUICtrlSetResizing($Checkbox2, 768 + 2 + 32) GUICtrlSetResizing($Checkbox3, 768 + 2 + 32) GUICtrlSetResizing($Radio1, 768 + 2 + 32) GUICtrlSetResizing($Radio2, 768 + 2 + 32) GUICtrlSetResizing($Radio3, 768 + 2 + 32) GUICtrlSetResizing($Toggle1, 768 + 2 + 32) GUICtrlSetResizing($Toggle2, 768 + 2 + 32) GUICtrlSetResizing($Toggle3, 768 + 2 + 32) GUICtrlSetResizing($Progress1[0], 768 + 2 + 32) GUISetState($Form1, @SW_UNLOCK) Sleep(1500) Next EndFunc ;==>_ThemesDemo
Hat da einer von Euch eine Idee?
Gruß gmmg
-
@Schnuffel: Danke funktioniert prima. Hab das nur noch etwas angepasst. Da das Array einen "0" Wert hat, wenn weniger als 4 Felder erzeugt werden, musste ich diese noch anfangen.
AutoIt
Alles anzeigen$date = _Now() $sp = "-----------------------------------------" $mbody = @CRLF & $sp & @CRLF & "gesendet am: " & $date & @CRLF & $sp & @CRLF & _ "von: " & $user & " " & $mail_txt & @CRLF & $sp & @CRLF & _ "Client: " & $computer & @CRLF & $sp & @CRLF & _ "System: " & $DataArray[0][0] & @CRLF & $sp & @CRLF & _ "Fehlerauswahl: " & $DataArray[1][0] & @CRLF ;& $sp & @CRLF For $i = 2 To UBound($DataArray) -1 ;$mbody &= $DataArray[$i][0] & ": " & $DataArray[$i][1] & @CRLF & $sp & @CRLF If $DataArray[$i][0] = "0" Then Else $mbody &= $sp & @CRLF & $DataArray[$i][0] & ": " & $DataArray[$i][1] & @CRLF EndIf Next $mbody &= $sp & @CRLF
Gruß gmmg
-
Schnuffel: Das sieht ja gut aus. Ich teste das aber erst am Montag
Vielen Dank für dein Hilfe
Gruß gmmg
-
Hallo Zusammen,
ich möchte gern mit den Daten aus einem Array einen Mailbody dynamisch erzeugen.
Beispiel:
autoit.de/wcf/attachment/90622/
Mein Statischer Mailbody sieht so aus bzw. habe ich in meinem Fall 5 davon, weil sich ja die Anzahl im Array verändern kann.
Wie kann ich das denn in einer Schleife am Besten zusammenbauen, dass immer die Festen Texte " gesendet am: usw. immer vorkommen + die dDaten aus dem Array ?
AutoIt
Alles anzeigen;-------------------mail body------------------ $date = _Now() $sp = "-----------------------------------------" $mbody = "gesendet am: " & $date & @CRLF & $sp & @CRLF & "von: " & $user & " " & $mail_txt & @CRLF & $sp & @CRLF & "Client: " & _ $computer & @CRLF & $sp & @CRLF & "System: " & $DataArray[0][0] & @CRLF & $sp & @CRLF & "Fehlerauswahl: " & $DataArray[1][0] & @CRLF & _ $sp & @CRLF & $DataArray[2][0] & ": " & $DataArray[2][1] & @CRLF & $sp & @CRLF & $DataArray[3][0] & ": " & $DataArray[3][1] & @CRLF & $sp & _ @CRLF & $DataArray[4][0] & ": " & $DataArray[4][1] & @CRLF & $sp & @CRLF & $DataArray[5][0] & ": " & $DataArray[5][1]
Hat da einer eine Idee?
Gruß gmmg
-
Hallo Zusammen,
danke für die Zahlreichen Infos.
UEZ: dein Skript startet bei mir mit der Autoit Version v3.3.16.1 aktuell nicht. Da sind bestimmte Variablen nicht definiert oder es fehlt ein Include.
Gruß gmmg
-
Andy,
Ich benötige die Screenshot Erweiterung in unserem in AutoIT gescripteten IT-Helpdesk Tool. Da gibt es zwar schon die Screenshotfunktion, aber da wird nur der komplette Bildschirm mitgeschnitten. Und die User haben oft die falschen Fenster im Vordergrund.
Den Dateinamen passe ich noch an, ebventuell auch mit der Möglichkeit mehrere Dateien zu erzeugen. Aus den Auswahlinfos des Tools + Screenshot wird dann im Endeffekt eine Email erzeugt und per SMTP verschickt.
Die IT-Helpdesk GUI bzw. die Icons | Label | Button | Input /Edit Felder + entsprechende Texte, werden dabei aktuell dynamisch mit Daten aus einer Access DB erzeugt.
Gruß gmmg