Beiträge von Velted
-
-
Moin!
CodeobjItem.SetBiosSetting oReturn, _ "TPM Activation Policy", _ "No prompts", _ "<utf-16/>itrepair"
Wenn mich meine VBS-Erinnerungen nicht täuschen, sehe ich da oben 4 Parameter:
- eine nicht im eingestellten Scriptcode definierte Variable oReturn
- den String "TPM Activation Policy"
- den String "No prompts"
- und den String "<utf-16/>itrepair"
-
Steht doch eindeutig drin:
Na ja:
Zitat von AutoIt HilfeFunction FileWrite
Write text/data to the end of a previously opened file.
Ok, das trifft für mich erst einmal nicht zu, weil ich die Datei nicht vorher geöffnet habe. Wenn man aber das noch berücksichtigt
ZitatFunction FileWrite
If a filename is given rather than a file handle, the file will be opened and closed during the function call.
und beide Aussagen zusammenführt, ergibt sich eine klare und eindeutige Aussage. Es scheint kaum möglich, das eindeutiger zu formulieren.
-
2. Wird nur Filewrite genutzt, wird an das Ende der Datei der Text angehängt anstatt ihn mit dem neuen Inhalt zu ersetzen.
Das hatte ich nicht mehr im Hinterkopf. FileWrite() ersetzt also das gute alte FileAppend (wie es in AutoHotkey noch immer existiert).
Es wäre nicht falsch, wenn die Hilfe-Datei darauf hinweisen würde.
-
Ich habe nicht gesagt, FileOpen() würde dann nichts finden. Ich habe gesagt FileRead().
Und noch was:
AutoItFunc _Form3() local Const $Filename = @ScriptDir & "\test.txt" local $file = FileOpen($Filename) ... global $iEdit = GUICtrlCreateEdit(FileRead($file), 0, 0, 500, 400, $ES_WANTRETURN + $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_MULTILINE + $WS_TABSTOP) ... FileClose($file)
ist identisch mit
AutoItFunc _Form3() local Const $Filename = @ScriptDir & "\test.txt" ... global $iEdit = GUICtrlCreateEdit(FileRead($Filename), 0, 0, 500, 400, $ES_WANTRETURN + $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_MULTILINE + $WS_TABSTOP) ...
FileOpen() mit Standardwerten bringt hier keinen Vorteil, erfordert aber ein FileClose().
AutoItCase $hButton $file = FileOpen($Filename, $FO_OVERWRITE) If FileWrite($Filename, GuiCtrlRead($IEdit)) Then ... Endif FileClose($file)
sollte in der Funktion FileWrite() $file benutzen oder (wie oben) die Funktionen FileOpen() und FileClose() weglassen.
-
Zitat von FileWrite() -> Remarks
If a filename is given rather than a file handle, the file will be opened and closed during the function call.
Zitat von FileOpen()$FO_OVERWRITE (2) = Write mode (erase previous contents)
Moombas, wenn Du die Datei mit $FO_OVERWRITE öffnest, wird der anschließende Aufruf von FileRead() nicht viel finden.
-
Moin Moombas,
das Zitat aus Deinem lBeitrag #25 gilt meiner Meinung nach auch für FileWrite().
FileOpen() ist für mich nur da wichtig, wo wiederholt auf Teile der Datei zugegriffen werden soll oder die Codierung vom Standard abweicht.
-
Moin,
in diesem Fall wird die Datei ja immer komplett gelesen bzw. geschrieben. Es macht für mich deshalb nicht viel Sinn, per FileOpen() ein Dateihandle zu erzeugen, das dann doch gleich wieder geschlossen werden muss.
FileRead() und FileWrite() akzeptieren auch den Dateinamen. Das scheint mir hier die bessere Option.
-
Moin,
Es wirkt auf mich eher wenig 'dynamisch', wenn Arrayelemente fest mit den Buttons verbunden sind. Wo besteht für Dich der Vorteil?
-
BugFix, Wunder über Wunder! Danke!
(Das sollte schon gestern rausgehen!)
-
-
Moin,
ich habe absolut keine Ahnung und habe Outlook auch noch nie benutzt. Aber ich habe ein Beispiel und einige vielleicht hilfreiche Links gefunden:
HTML
Alles anzeigenpublic void SendEmailViaOutlook() { String htmlTemplate = "<html>\n"; htmlTemplate += " <head>\n"; htmlTemplate += " <style type=\"text//css\">\n"; htmlTemplate += " #Header {border-width: 1; border: solid; text-align: center}\n"; htmlTemplate += " #Content {border-width: 1; border: solid; text-align: center}\n"; htmlTemplate += " #Footer {border-width: 1; border: solid; text-align: center}\n"; htmlTemplate += " </style>\n"; htmlTemplate += " </head>\n"; htmlTemplate += " <body>\n"; htmlTemplate += " <table>\n"; htmlTemplate += " <tr><td><img src=\"cid:companylogo.jpg@embed\"/></td></tr>\n"; htmlTemplate += " <tr><td><div id=\"Header\">$HEADER$</div></td></tr>\n"; htmlTemplate += " <tr><td><div id=\"Contentr\">$CONTENT$</div></td></tr>\n"; htmlTemplate += " <tr><td><div id=\"Footer\">$FOOTER$</div></td></tr>\n"; htmlTemplate += " <tr><td><img src=\"cid:usersign.jpg@embed\"/></td></tr>\n"; htmlTemplate += " </table>\n"; htmlTemplate += " </body>n"; htmlTemplate += "</html>\n"; //the code is simplified to demostrate problem //$CONTENT etc. will be replaced by another html from custom html wysiwyg editor try { Outlook.Application outlook = new Outlook.Application(); Outlook._MailItem outLookMailMessage = outlook.CreateItem(Outlook.OlItemType.olMailItem) as Outlook._MailItem; outLookMailMessage.BodyFormat = Outlook.OlBodyFormat.olFormatHTML; outLookMailMessage.HTMLBody = htmlTemplate; outLookMailMessage.Subject = this.Subject; outLookMailMessage.Recipients.Add("somenone@somewhere.com"); path = ""; //set some path to folder with images Outlook.Attachment attachment1 = outLookMailMessage.Attachments.Add(path, Outlook.OlAttachmentType.olEmbeddeditem, null, ""); attachment1.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", "companylogo.jpg@EMBED"); Outlook.Attachment attachment2 = outLookMailMessage.Attachments.Add(path, Outlook.OlAttachmentType.olEmbeddeditem, null, ""); attachment2.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", "usersign.jpg@EMBED"); outLookMailMessage.Send(); outLookMailMessage = null; } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
Den Tag ContentId gibt es als ANSI (0x001E) und als Unicode (0x001F) Typ. Vielleicht funktioniert Unicode besser.
-
Moombas: Gefällt mir auch besser!
-
Moin,
wie schon gesagt, wenn keine IP-Adresse ermittelt wird, passiert meiner Meinung nach gar nichts.
Versuch mal das:
AutoIt
Alles anzeigen;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _ActiveIP() Local $objAdapter Local $objWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & $sHost & "\root\cimv2") If IsObj($objWMIService) Then Local $colAdapter = $objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration WHERE IPEnabled = True", "WQL", 0x30) If IsObj($colAdapter) Then For $objAdapter In $colAdapter If ($objAdapter.IPAddress(0)) Then If $objAdapter.DefaultIPGateway(0) Then If IsString($objAdapter.IPAddress(0)) And IsString($objAdapter.DefaultIPGateway(0)) Then $IP = $objAdapter.IPAddress(0) GUICtrlSetData($IPLabel, $IP) $Gateway = $objAdapter.DefaultIPGateway(0) Return ; <<<<< wenn eine IP-Adresse gefunden wurde, ist hier Schluss EndIf EndIf EndIf Next Endif EndIf GUICtrlSetData($IPLabel, "Kein Netz") ; <<<<< ansonsten landen wir hier EndFunc ;==>_ActiveIP
Wenn der Adapter beim Verbindungsverlust die letzte IP-Adresse hält, nützt das allerdings auch nicht.
-
In der Adlib-Funktion wird nur in das GUI geschrieben, wenn er eine IP-Adresse findet.
-
Moin,
was soll er denn schreiben, 'wenn das Kabel gezogen ist'?
-
Und damit die Prozessorlast noch etwas runtergeht, ...
Dazu ist mir nach längerem Herumprobieren wieder eingefallen, dass es auch ohne GDI-Bitmap geht, wenn man anstelle der GDIP-Bitmap eine GDI-DIBSECTION verwendet. Diese Technik habe ich aber nicht selbst erfunden:
AutoIt
Alles anzeigen#include <Array.au3> #include <GDIPlus.au3> #include <StructureConstants.au3> #include <WinAPIConstants.au3> #include <WinAPIGdi.au3> #include <WinAPIGdiDC.au3> #include <WinAPIHObj.au3> #include <WinAPISysInternals.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global $aSelect = _SelectRange() ; Rueckgabe: Array[Left, Top, Width, Height] ;~ _ArrayDisplay($aSelect) _GDIPlus_Shutdown() Func _SelectRange($iCrossW = 3, $iCrossColor = 0xFF0000FF, $iSelColor = 0x40FFFF00) Local $iVSX = _WinAPI_GetSystemMetrics($SM_XVIRTUALSCREEN) Local $iVSY = _WinAPI_GetSystemMetrics($SM_YVIRTUALSCREEN) Local $iVSW = _WinAPI_GetSystemMetrics($SM_CXVIRTUALSCREEN) Local $iVSH = _WinAPI_GetSystemMetrics($SM_CYVIRTUALSCREEN) Local $hBgGui = GUICreate('FullScreen', $iVSW, $iVSH, $iVSX, $iVSY, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $WS_EX_LAYERED)) Local $hMagnifier = GUICreate('Magnifier', 200, 200, 0, 0, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW, $hBgGui) Local $hMemDC = _WinAPI_CreateCompatibleDC(0) Local $hDIB = _WinAPI_CopyImage(_WinAPI_CreateBitmap($iVSW, $iVSH, 1, 32), $IMAGE_BITMAP, 0, 0, BitOR($LR_COPYDELETEORG, $LR_CREATEDIBSECTION)) Local $hOld = _WinAPI_SelectObject($hMemDC, $hDIB) If $hOld Then _WinAPI_DeleteObject($hOld) Local $pGraphics = _GDIPlus_GraphicsCreateFromHDC($hMemDC) Local $hPen = _GDIPlus_PenCreate($iCrossColor, $iCrossW) Local $hBrush = _GDIPlus_BrushCreateSolid($iSelColor) Local $hPen2 = _GDIPlus_PenCreate(BitXOR($iSelColor, 0xFFFFFF)) Local $tSize = DllStructCreate($tagSIZE) Local $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $iVSW) DllStructSetData($tSize, "Y", $iVSH) Local $tSource = DllStructCreate($tagPOINT) Local $pSource = DllStructGetPtr($tSource) DllStructSetData($tSource, "X", 0) DllStructSetData($tSource, "Y", 0) Local $tBlend = DllStructCreate($tagBLENDFUNCTION) Local $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", 255) ; $iOpacity DllStructSetData($tBlend, "Format", 1) GUISetCursor(16, 1, $hBgGui) GUISetCursor(16, 1, $hMagnifier) GUISetState(@SW_SHOW, $hBgGui) GUISetState(@SW_SHOW, $hMagnifier) Local $aOldPos[4] = [$iVSX - 10, $iVSY - 10, 0, 0], $aInfo[5], $aSelCoord[4] = [0, 0, 0, 0], $iX, $iY Do $aInfo = GUIGetCursorInfo($hBgGui) If $aInfo[2] Then ; wenn linke Maustaste gedrueckt If Not $aOldPos[2] Then ; wenn vorher nicht gedrueckt $aOldPos[2] = 1 $aSelCoord[0] = $aInfo[0] $aSelCoord[1] = $aInfo[1] EndIf $aSelCoord[2] = Abs($aInfo[0] - $aSelCoord[0]) $aSelCoord[3] = Abs($aInfo[1] - $aSelCoord[1]) $iX = $aInfo[0] > $aSelCoord[0] ? $aSelCoord[0] : $aSelCoord[0] - $aSelCoord[2] $iY = $aInfo[1] > $aSelCoord[1] ? $aSelCoord[1] : $aSelCoord[1] - $aSelCoord[3] Else ; wenn linke Maustaste losgelassen $aOldPos[2] = 0 EndIf If $aInfo[0] <> $aOldPos[0] Or $aInfo[1] <> $aOldPos[1] Then $aOldPos[0] = $aInfo[0] $aOldPos[1] = $aInfo[1] If $aInfo[0] < 200 And $aInfo[1] < 200 Then If $aOldPos[3] = 0 Then WinMove($hMagnifier, '', @DesktopWidth - 202, 0) $aOldPos[3] = 1 EndIf Else If $aOldPos[3] = 1 Then WinMove($hMagnifier, '', 0, 0) $aOldPos[3] = 0 EndIf EndIf _GDIPlus_GraphicsClear($pGraphics, 0x08FFFFFF) _GDIPlus_GraphicsFillRect($pGraphics, $iX, $iY, $aSelCoord[2], $aSelCoord[3], $hBrush) _GDIPlus_GraphicsDrawRect($pGraphics, $iX, $iY, $aSelCoord[2], $aSelCoord[3], $hPen2) _GDIPlus_GraphicsDrawLine($pGraphics, $iVSX, $aInfo[1], $iVSW, $aInfo[1], $hPen) _GDIPlus_GraphicsDrawLine($pGraphics, $aInfo[0], $iVSY, $aInfo[0], $iVSH, $hPen) _WinAPI_UpdateLayeredWindow($hBgGui, 0, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _ShowMagnifier($hMagnifier, $aInfo, $iVSW, $iVSH, $iVSX, $iVSY) EndIf Sleep(10) Until $aInfo[3] ; warten, bis rechte Maustaste gedrueckt _GDIPlus_PenDispose($hPen) _GDIPlus_PenDispose($hPen2) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($pGraphics) _WinAPI_DeleteObject($hDIB) _WinAPI_DeleteDC($hMemDC) GUIDelete($hBgGui) GUIDelete($hMagnifier) $aSelCoord[0] += $iVSX $aSelCoord[1] += $iVSY Return $aSelCoord EndFunc ;==>_SelectRange Func _ShowMagnifier($hWnd, $aInfo, $iVSW, $iVSH, $iVSX, $iVSY) Local $iRight = $iVSX + $iVSW, $iBottom = $iVSY + $iVSH Local $hSrcDC, $hDestDC, $iLeft, $iTop $hDestDC = _WinAPI_GetDC($hWnd) If @error Then Return $hSrcDC = _WinAPI_GetDC(0) If Not @error Then $iLeft = $aInfo[0] - 25 If $iLeft < 0 Then $iLeft = 0 If $iLeft + 50 > $iRight Then $iLeft = $iRight - 50 $iTop = $aInfo[1] - 25 If $iTop < 0 Then $iTop = 0 If $iTop + 50 > $iBottom Then $iTop = $iBottom - 50 _WinAPI_StretchBlt($hDestDC, 0, 0, 200, 200, $hSrcDC, $iLeft, $iTop, 50, 50, $SRCCOPY) _WinAPI_ReleaseDC(0, $hDestDC) EndIf _WinAPI_ReleaseDC($hWnd, $hSrcDC) EndFunc ;==>_ShowMagnifier
-
-
Für die Consolenausgabe werden die AutoIt-Strings intern nach ANSI konvertiert. Mit dem 'falschen' Format klappt das, weil sich alle Zeichen in ANSI abbilden lassen. Das 'richtige' Format enthält aber Unicode-Zeichen, für die es in ANSI keine Entsprechung gibt. Die werden bei der Konvertierung mit ? ersetzt. Und weil Deine SCIte-Konsole auf UTF8 eingestellt ist, werden anscheinend für bei UTF8 nicht zulässige ANSI-Zeichen die Hex-Werte angezeigt.
-
Fällt mir jetzt erst auf: Sollte das nicht nach Hilfe & Unterstützung verschoben werden?