Diese Java-Version hier, könnte man verwenden. Anhänge werden zwar per Option mit entpackt, leider aber im Anschluß nicht im PDF angezeigt. Aber Du sagtest ja auch reine Texte !
Beiträge von Micha_he
-
-
Wäre ja dann so etwas wie 'Eml2Pdf'. Davon gibt es einige, leider habe ich keinen gefunden der Free und für die Kommandozeile ist. Aber wenn es Dir 2-3€ Wert ist, dann müsste da was zu finden sein...
Eml-Viewer gibt es ein paar freie, nur ist die Automation dann komplizierter, wegen der Oberfläche.
-
-
Sieht im ersten Moment eigentlich gut aus, jedenfalls kann ich den Fehler auch nicht erkennen.
Unter Umständen kannst Du auch die Funktion '_OOoCalc_BookOpen' aus der UDF 'OOoCalc.au3' von HIER nehmen. (sieht aber im Prinzip nach nahezu identischem Code/Befehlen aus)
-
Schau mal HIER !
Als Ausgangspunkt für einen Anfänger vielleicht brauchbar. Ob der erzeugte Code dann in der neusten AutoIt-Version immer läuft, würde ich bezweifeln. Aber mit den dann möglicherweise erscheinden Fehlern, findet man schnell den falschen Funktionsnamen oder ggf. den fehlenden Parameter.
Probier halt mal...
-
Du solltest in der AutoIt-Hilfe unter folgenden Befehlen das für Dich notwendige suchen:
WinWait, WinWaitActive, ControlCommand, ControlSend, ControlClick, Send
-
Einfach wäre z.B.:
AutoItIf StringLeft(@IPAddress1, 6) = "10.15." Then RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyEnable","REG_DWORD","1") MsgBox(64, "Proxy an") Else RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyEnable","REG_DWORD","0") MsgBox(64, "Proxy aus") EndIf
-
Du hast aber unter Windows 64bit, auch eine 64bit kompilierte Version des Scripts getestet, oder ?
-
Ich habe mal eine Lösung gebaut:
Script kompilieren (für x64 muss auch x64 kompiliert sein) und mit Parameter '-save' starten legt eine Ini im Scriptverzeichnis an.
Mit Parameter '-restore' werden die alten Positionen wieder hergestellt. Unter Win7 x64 läuft es noch !Spoiler anzeigen
AutoIt: SetGet_IconPos.au3
Alles anzeigen;################################################################################################# ; ; Titel: Restore-IconPos-Desktop ; Datum: 28. Jan. 2015 ; Version: 1.1 ; ; Anmerkungen: ; ; - Die Position der Icons und der Titel wird in einer INI Datei gespeichert ; - Das Script wird über Parameter aufgerufen: ; -save = Speichert die Positionen ; -restore = Plaziert die Icons wieder da wo sie waren ; - Unter einem x64-System, muss das Script auch als 64bit-kompiliertem ; Script oder mit AutoIt_x64.exe gestartet werden ! ; ; ; History: ; V1.0 - Erstrelease ; V1.1 - Anzahl wird jetzt mit korrektem Wer in der INI gespeichert ; ;################################################################################################# ;################################################################################################# ; Einfügen der Include Dateien ;################################################################################################# #include <Constants.au3> #Include <GuiListView.au3> #include <File.au3> #include <Array.au3> ;################################################################################################# ; Optionen setzen ;################################################################################################# #NoTrayIcon ;Kein TrayIcon anzeigen Opt("MustDeclareVars", 1) ;Variablen müssen deklariert werden ;################################################################################################# ; Variablen deklarieren ;################################################################################################# Local $handle ;Handle für den Desktop Local $anzIcons ;Anzahl der Icons auf dem Desktop Local $arrIcons[1] ;Array für Restore Local $arrayPos ;Position im Array Local $txt ;Für das zwischenspeichern von Texten Local $int ;Als Zähler Variable Local $icon ;Name des Icon Local $posX ;X Position Local $posY ;y Position Local $Mode = "Help" ;In welchem Modus das Script gestartet wurde Local $iniFile = @ScriptDir & "\icons.ini" ;Pfad zu der Ini-Datei If @OSArch = "X64" and not @Autoitx64 Then Msgbox(64, "Falsche Architektur !", "Unter einem 64bit Betriebssystem, muss auch eine 64bit-Variante" & @CRLF & "des Programms gestartet werden !") Exit EndIf ;################################################################################################# ; Programm Einstigspunkt (POE) ;################################################################################################# If $CmdLine[0] > 0 Then $Mode = $CmdLine[1] _CheckIniExist() Switch $CmdLine[1] Case "-save" ToolTip("Positionen der Icons werden gespeichert!",0,0,"Info") Sleep(1000) _SavePos() Case "-restore" ToolTip("Icons werden wieder hergestellt!",0,0,"Info") Sleep(1000) _RestorePos() Case Else _ShowHelp() EndSwitch Else _ShowHelp() EndIf Exit 0 ;Programm wird verlassen ;################################################################################################# ; _CheckIniExist ; Diese Funktion prüft ob die INI Datei vohanden ist, falls Nein, wird eine leere Datei ; erstellt. Ist eine vorhanden, wird gelöscht und eine neue erstellt, aber nur bei -save ;################################################################################################# Func _CheckIniExist() IF Not FileExists($iniFile) Then _FileCreate($iniFile) If @error Then MsgBox(48,"Fehler","INI-Datei konnte nicht erstellt werden.") Exit 1 EndIf ElseIf $Mode = "-save" Then If FileDelete($iniFile) = 0 Then MsgBox(48,"Fehler","INI-Datei konnte nicht gelöscht werden.") Exit 1 EndIf EndIf EndFunc ;################################################################################################# ; _ShowHelp ; Wenn das Script ohne Parameter gestartet wird, wird diese Hilfe angezeigt, oder wenn ein ; falscher Parameter übergeben wurde. ;################################################################################################# Func _ShowHelp() $txt = "Parameter:" & @CRLF $txt &= "-save = Speichert die Positionen" & @CRLF $txt &= "-restore = Plaziert die Icons wieder da wo sie waren" MsgBox(64,"Hilfe - Restore-IconPos-Desktop", $txt) Exit 0 EndFunc ;################################################################################################# ; _SavePos ; Speichern der Icon Positionen in der INI Datei ;################################################################################################# Func _SavePos() $handle = ControlGetHandle("Program Manager", "", "SysListView321") $anzIcons = _GUICtrlListView_GetItemCount ($handle) IniWrite($iniFile,"Global","Anzahl",$anzIcons) For $int = 0 To $anzIcons - 1 IniWrite($iniFile,"IconPos" & $int,"Icon",_GUICtrlListView_GetItemText($handle,$int)) IniWrite($iniFile,"IconPos" & $int,"X-Pos",_GUICtrlListView_GetItemPositionX ($handle,$int)) IniWrite($iniFile,"IconPos" & $int,"Y-Pos",_GUICtrlListView_GetItemPositionY ($handle,$int)) Next EndFunc ;################################################################################################# ; _RestorePos ; Stellt die Icon Positionen an Hand der INI Datei wieder her ;################################################################################################# Func _RestorePos() $anzIcons = IniRead($iniFile,"Global","Anzahl",-1) If $anzIcons = -1 Then MsgBox(48,"Fehler","INI-Datei ist leer.") Exit 1 Else $handle = ControlGetHandle("Program Manager", "", "SysListView321") ReDim $arrIcons[_GUICtrlListView_GetItemCount ($handle)] For $int = 0 To UBound($arrIcons) - 1 $arrIcons[$int] = _GUICtrlListView_GetItemText($handle,$int) Next For $int = 0 To $anzIcons - 1 $icon = IniRead($iniFile,"IconPos" & $int,"Icon",-1) $posX = IniRead($iniFile,"IconPos" & $int,"X-Pos",-1) $posY = IniRead($iniFile,"IconPos" & $int,"Y-Pos",-1) If $icon = -1 Or $posX = -1 Or $posY = -1 Then ContinueLoop $arrayPos = _ArraySearch($arrIcons,$icon,0,0,1,False) If $arrayPos = -1 Then ContinueLoop _GUICtrlListView_SetItemPosition($handle,$arrayPos,$posX,$posY) Next EndIf EndFunc
Edit: Gerade getestet, läuft auch unter Win10 x64 noch !
-
-
Dies müsste die Original-UDF dazu sein:
-
Ich übergebe dann das als Funktionsparameter:
AutoIt: Test1.au3
Alles anzeigen#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "Test2.au3" Local $Form1 = GUICreate("Form1", 167, 96, 192, 182) Local $Input1 = GUICtrlCreateInput("Input123", 8, 8, 121, 21) Local $Button1 = GUICtrlCreateButton("Klick mich", 8, 30, 121, 21) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _Testfunc($Input1) EndSwitch WEnd
-
Ich habe auch noch eine Lösung. Unter Win10 läufts, Win8 habe ich nicht getestet.
Hier ist sie:
AutoIt
Alles anzeigen#include <GUIToolBar.au3> $sTitle = "WinVNC" $hTray = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') $iCount = _GUICtrlToolbar_ButtonCount($hTray) For $i = 0 To $iCount If StringInStr(_GUICtrlToolbar_GetButtonText($hTray, _GUICtrlToolbar_IndexToCommand ($hTray, $i )), $sTitle) Then $iPid = WinGetProcess(_SysTrayIconHandle($i)) If $iPid > 0 Then _GUICtrlToolbar_DeleteButton($hTray, _GUICtrlToolbar_IndexToCommand ($hTray, $i )) ProcessClose($iPid) EndIf EndIf Next ;=============================================================================== ; ; Function Name: _SysTrayIconHandle($iIndex, $iWin = 1) ; Description: Gets hwnd of window associated with systray icon of given index ; Parameter(s): $iIndex - icon index (Note: starting from 0) ; $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; ; Requirement(s): ; Return Value(s): On Success - Returns hwnd of found icon ; On Failure - Sets @error and returns -1 ; | See _SysTrayGetButtonInfo for @error returns ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _SysTrayIconHandle($iIndex, $iWin = 1) Local $TRAYDATA = _SysTrayGetButtonInfo($iIndex, $iWin, 2) If @error Then Return SetError(@error, 0, -1) Else Return Ptr(DllStructGetData($TRAYDATA, 1)) EndIf EndFunc ;==>_SysTrayIconHandle ; INTERNAL ===================================================================== ; ; Function Name: _SysTrayGetButtonInfo($iIndex, $iWin = 1, $iInfo = 0) ; Description: Gets Tray Button Info ; Parameter(s): $iIndex - icon index (Note: starting from 0) ; $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; $iInfo - Info to return ; | 1 - TBBUTTON structure ; | 2 - TRAYDATA structure ; | 3 - tooltip ; | 4 - icon position ; Requirement(s): ; Return Value(s): On Success - Returns requested info ; On Failure - Sets @error and returns -1 ; | 1 - Failed to find tray window ; | 2 - Failed to get tray window PID ; | 3 - Failed to open process ; | 4 - Failed to allocate memory ; | 5 - Failed to get TBBUTTON info ; ; Author(s): Erik Pilsits, Tuape ; ;=============================================================================== Func _SysTrayGetButtonInfo($iIndex, $iWin = 1, $iInfo = 1) Local Const $TB_GETBUTTON = 1047 ;~ Local Const $TB_GETBUTTONTEXT = 1099 ;~ Local Const $TB_GETBUTTONINFO = 1089 Local Const $TB_GETITEMRECT = 1053 Local Const $ACCESS = BitOR(0x0008, 0x0010, 0x0400) ; VM_OPERATION, VM_READ, QUERY_INFORMATION Local $TBBUTTON If @OSArch = "X86" Then $TBBUTTON = DllStructCreate("int iBitmap;int idCommand;byte fsState;byte fsStyle;byte bReserved[2];dword dwData;int iString") Else ; X64 $TBBUTTON = DllStructCreate("int iBitmap;int idCommand;byte fsState;byte fsStyle;byte bReserved[6];uint64 dwData;int64 iString") EndIf Local $TRAYDATA If @OSArch = "X86" Then $TRAYDATA = DllStructCreate("hwnd hwnd;uint uID;uint uCallbackMessage;dword Reserved[2];handle hIcon") Else $TRAYDATA = DllStructCreate("uint64 hwnd;uint uID;uint uCallbackMessage;dword Reserved[2];uint64 hIcon") EndIf Local $trayHwnd = _FindTrayToolbarWindow($iWin) If $trayHwnd = -1 Then Return SetError(1, 0, -1) Local $return, $err = 0 Local $ret = DllCall("user32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $trayHwnd, "dword*", 0) If @error Or Not $ret[2] Then SetError(2, 0, -1) Local $pId = $ret[2] Local $procHandle = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $ACCESS, "bool", False, "dword", $pId) If @error Or Not $procHandle[0] Then Return SetError(3, 0, -1) Local $lpData = DllCall("kernel32.dll", "ptr", "VirtualAllocEx", "handle", $procHandle[0], "ptr", 0, "ulong", DllStructGetSize($TBBUTTON), "dword", 0x1000, "dword", 0x04) If Not @error And $lpData[0] Then $ret = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $trayHwnd, "uint", $TB_GETBUTTON, "wparam", $iIndex, "lparam", $lpData[0]) If Not @error And $ret[0] Then DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $procHandle[0], "ptr", $lpData[0], "struct*", $TBBUTTON, "ulong", DllStructGetSize($TBBUTTON), "ulong*", 0) Switch $iInfo Case 2 ; TRAYDATA structure DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $procHandle[0], "ptr", DllStructGetData($TBBUTTON, 6), "struct*", $TRAYDATA, "ulong", DllStructGetSize($TRAYDATA), "ulong*", 0) $return = $TRAYDATA Case 3 ; tooltip $return = "" If BitShift(DllStructGetData($TBBUTTON, 7), 16) <> 0 Then Local $intTip = DllStructCreate("wchar[1024]") ; we have a pointer to a string, otherwise it is an internal resource identifier DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $procHandle[0], "ptr", DllStructGetData($TBBUTTON, 7), "struct*", $intTip, "ulong", DllStructGetSize($intTip), "ulong*", 0) $return = DllStructGetData($intTip, 1) ;else internal resource EndIf Case 4 ; icon position If Not BitAND(DllStructGetData($TBBUTTON, 3), 8) Then ; 8 = TBSTATE_HIDDEN Local $pos[2], $RECT = DllStructCreate("int;int;int;int") DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $trayHwnd, "uint", $TB_GETITEMRECT, "wparam", $iIndex, "lparam", $lpData[0]) DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $procHandle[0], "ptr", $lpData[0], "struct*", $RECT, "ulong", DllStructGetSize($RECT), "ulong*", 0) $ret = DllCall("user32.dll", "int", "MapWindowPoints", "hwnd", $trayHwnd, "ptr", 0, "struct*", $RECT, "uint", 2) $pos[0] = DllStructGetData($RECT, 1) $pos[1] = DllStructGetData($RECT, 2) $return = $pos Else $return = -1 EndIf Case Else ; TBBUTTON $return = $TBBUTTON EndSwitch Else $err = 5 EndIf DllCall("kernel32.dll", "bool", "VirtualFreeEx", "handle", $procHandle[0], "ptr", $lpData[0], "ulong", 0, "dword", 0x8000) Else $err = 4 EndIf DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $procHandle[0]) If $err Then Return SetError($err, 0, -1) Else Return $return EndIf EndFunc ;==>_SysTrayGetButtonInfo ;=============================================================================== ; ; Function Name: _FindTrayToolbarWindow($iWin = 1) ; Description: Utility function for finding Toolbar window hwnd ; Parameter(s): $iWin ; | 1 - ToolbarWindow32, Win2000+ ; | 2 - NotifyIconOverflowWindow, Win7+ ; ; Requirement(s): ; Return Value(s): On Success - Returns Toolbar window hwnd ; On Failure - returns -1 ; ; Author(s): Tuape, Erik Pilsits ; ;=============================================================================== Func _FindTrayToolbarWindow($iWin = 1) Local $hwnd, $ret = -1 If $iWin = 1 Then $hWnd = DllCall("user32.dll", "hwnd", "FindWindow", "str", "Shell_TrayWnd", "ptr", 0) If @error Then Return -1 $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "TrayNotifyWnd", "ptr", 0) If @error Then Return -1 If @OSVersion <> "WIN_2000" Then $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "SysPager", "ptr", 0) If @error Then Return -1 EndIf $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "ToolbarWindow32", "ptr", 0) If @error Then Return -1 $ret = $hwnd[0] ElseIf $iWin = 2 Then ; NotifyIconOverflowWindow for Windows 7 $hWnd = DllCall("user32.dll", "hwnd", "FindWindow", "str", "NotifyIconOverflowWindow", "ptr", 0) If @error Then Return -1 $hWnd = DllCall("user32.dll", "hwnd", "FindWindowEx", "hwnd", $hWnd[0], "hwnd", 0, "str", "ToolbarWindow32", "ptr", 0) If @error Then Return -1 $ret = $hwnd[0] EndIf Return $ret EndFunc ;==>_FindTrayToolbarWindow
-
Meinst Du hierhin ?
control.exe /name Microsoft.DefaultPrograms /page pageFileAssoc
oder hierher:
control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram
Quelle: https://msdn.microsoft.com/en-us/library/…DefaultPrograms
-
AutoIt
Alles anzeigen#RequireAdmin #include <AutoItConstants.au3> ;#include <Constants.au3> Global $data Global $sFilename = @ScriptDir & "\resultat.txt" $DefragPath = " /c Defrag D: /A" $pid = Run(@ComSpec & $DefragPath, @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD); Stdout Do $data &= StdOutRead($pid) Until @error $file = FileOpen($sFilename, 2) FileWrite($file, $data) FileClose($file) sleep(1000) ShellExecute($sFilename) Exit
Zeile 2-3 musste ich bei mir austauschen, wahrscheinlich nutzt die aktuellste AutoIt-Version ein anderes Include
Zeile 6+13+17 ShellExecute funktioniert nicht mit dem FileHandleUnd wichtig: Muss auf einem 64bit-Windows auch mit x64 kompiliert ausgeführt werden. Scheinbar gibt es auf einem x64-System kein 32bit Defrag.exe.
-
-
Ohne auf die grundlegende Arbeit der Funktion einzugehen, würde ich schätzen/raten das die Aktualisierung der GUI (GUICtrlSetData) mehr Zeit benötigt wie der restliche Teil !
Ggf. würde ich die Progressbar nur aktualisieren, wenn sich der zu setzende Wert geändert hat.
z.B.:AutoIt$new_perc = Int($perc * $i) If $new_perc <> $old_perc Then GUICtrlSetData($pb_Progress,....) $old_perc = $new_perc EndIf
Statt 10Mio Änderungen nur noch 100 !
Anschließend würde ich mir die 10Mio mal durchlaufende, ziemlich komplexe If...ElseIf-Anweisung anschauen. Die wird bei jedem Durchlauf geprüft und ich könnte mit vorstellen, das die mehrfache Prüfung der If-Anweisung doch schon etwas an Zeit verbraucht...
-
-
Weil das Array $var1 bei Eingabe eines kürzeren Codes keine 9 Felder hat, du sie aber in den Zeilen 13-21 einer neuen Variable zuweisen willst. Warum auch immer... ???
So vielleicht... (ungetestet)
Spoiler anzeigen
AutoIt
Alles anzeigenHotKeySet("{ESC}", "Terminate") Func Terminate() Exit EndFunc $Input = InputBox("Arbeitspositionen", "Bitte gib den Code für die Arbeitspositionen an", "", "", -1, -1, 0, 0) $var1 = StringSplit($Input,"") For $i = 1 To $var[0] If $var1[$i] = 0 Then ShellExecuteWait ("nix" & $i & ".au3") If $var1[$i] = 1 Then ShellExecuteWait ("5min" & $i & ".au3" ) If $var1[$i] = 2 Then ShellExecuteWait ("istsoll" & $i & ".au3" ) Sleep (300) Next
-
Readfile und Openfile sind umgekehrt anzuwenden, ansonsten funktioniert es so....