Sehr schön!
Beiträge von Bitnugger
-
-
Die Ini* Funktionen von AutoIt erfordern z.B. zwingend einen Sektionsnamen, also [xxx].
Genau, es muss mindestens eine Sektion (z.B. [Global]) geben, ohne funktioniert es nicht. Das ist auch wieder so ein Ding...
-
Könntest Du bitte mal einen Blick in meinen Beitrag Sammelthread "AutoIt Interne Funktionen : Erwartetes Ergebnis -> Tatsächliches Ergebnis" werfen - falls Du es nicht bereits getan hast. Ist das einigermaßen verständlich ?
Das ist sehr gut verständlich, nur mit "ignoriert/übergangen" bist du mindestens einen Millimeter von der Wahrheit entfernt - denn die erste Sektion wird schlicht und einfach nicht erkannt, weil der BOM mit in dieser Zeile steht und somit das erste Zeichen keine öffnende Klammer "[" ist.
GetPrivateProfileString(A) zu erwähnen ist gut, dadurch bekommt man zumindest einen Einblick, warum es mit BOM zu Problemen kommt.
Zitat von MusashiWer dieses Verhalten der Standard IniRead* Funktionen aber nicht kennt wird sich ggf. wundern, warum Einträge nicht eingelesen werden .Nicht "Einträge", sondern nur "der erste Eintrag"...
-
Auf jeden Fall extrem interessant.
Dann findest du dieses Verhalten sicher auch interessant:
Wird Zeit das ich in Zukunft standardmäßig irgendein _IniRead verwende
Besser du überprüfst IniFiles einmalig beim Start deines Scripts mit einer speziellen Funktion.
Z.B. so:
AutoIt
Alles anzeigen;-- TIME_STAMP 2020-01-07 20:33:40 #include <FileConstants.au3> _CheckIni('IniFile.ini') ;~ _CheckIni('IniFile.ini', $FO_UTF8_NOBOM) Func _CheckIni($sIniFile, $FO = $FO_ANSI) If FileGetEncoding($sIniFile) <> $FO Then ConsoleWrite('! Old Encoding = ' & FileGetEncoding($sIniFile) & @CRLF) ; $FO_UTF8 = 128 Local $sIniString = FileRead($sIniFile) Local $hFile = FileOpen($sIniFile, BitOR($FO_OVERWRITE, $FO)) ; $FO_ANSI (512) oder $FO_UTF8_NOBOM (256), bzw. alles ohne BOM FileWrite($hFile, $sIniString) FileClose($hFile) ConsoleWrite('> New Encoding = ' & FileGetEncoding($sIniFile) & @CRLF) ; $FO_ANSI = 512 EndIf EndFunc ;==>_CheckIni
-
IniRead geht davon aus, dass die Datei als ANSI gespeichert wurde und kennt zudem auch keinen BOM, weshalb dieser als Inhalt der Datei mit eingelesen wird.
Aus Sicht von IniRead steht der BOM () dann nicht in einer eigenen Zeile, da dieser ja ohne Zeilenendekennung (CRLF) vorangestellt wird.
[Pfade]CRLF
Dadurch kann die Sektion "[Pfade]" nicht mehr erkannt werden, weil als erstes Zeichen in der Zeile die öffnende Klammer nicht gefunden wird.
Fügt man hinter dem BOM bzw. vor "[Pfade]" eine Zeilenendekennung ein, dann funktioniert es auch mit "UTF-8 mit BOM".
CRLF
[Pfade]CRLF
FileReadLine macht hier keine Probleme, denn es erwartet kein ANSI und kann einen BOM erkennen.
-
Bei WinMove ziehst du noch 1 ab, so dass du auf 7 kommst. Hast das gemacht, weil ich geschrieben habe, dass 7 richtig ist?
Nein, sondern weil die Automatik in Windows es so macht. 8 Pixel, wenn das Fenster vor dem Andocken maximiert war, anderfalls 7.
-
Teste dieses mal:
AutoIt
Alles anzeigen;-- TIME_STAMP 2020-01-05 18:46:46 #include <WindowsConstants.au3> #include <WinAPIGdi.au3> #include <WinAPISys.au3> Global $sExplorerPath, $hExplorer, $aPos, $hMonitor, $aMonitorInfo, $aMonitorRectangle, $aMonitorPos, $iCXFrame, $iCYFrame ;~ $sExplorerPath = "C:\" ; WindowTitle = "<DriveLabel> (C:)" oder "(C:) <DriveLabel>" $sExplorerPath = "C:\Windows\System32\" ; WindowTitle = "System32" Global $sRx, $aRx = [StringLeft($sExplorerPath, 2), DriveGetLabel($sExplorerPath)] $sRx = '[REGEXPCLASS:^(Explore|Cabinet)WClass$; REGEXPTITLE:^' & _ (StringRegExp($sExplorerPath, '(?i)(^[a-z]:\\?$)') _ ? '\(' & $aRx[0] & '\) ' & $aRx[1] & '|' & $aRx[1] & ' \(' & $aRx[0] & '\)' _ ; "C:\" : StringRegExpReplace($sExplorerPath, '(?:.+\\)?(.+)\\$', '\1')) & _ ; "C:\Windows\System32\" '$]' ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " $sRx --> " & $sRx & @CRLF) $hExplorer = WinGetHandle($sRx) If Not IsHWnd($hExplorer) Then ;~ RunWait("explorer.exe /N,/E," & $sExplorerPath, "", @SW_MAXIMIZE) RunWait("explorer.exe /N,/E," & $sExplorerPath, "", @SW_RESTORE) $hExplorer = WinWait($sRx, '', 3) Else ;~ WinSetState($hExplorer, '', @SW_MAXIMIZE) WinSetState($hExplorer, '', @SW_RESTORE) EndIf If IsHWnd($hExplorer) Then ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " $hExplorer --> " & $hExplorer & ' "' & WinGetTitle($hExplorer) & '"' & @CRLF) WinActivate($hExplorer) ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " @DesktopWidth --> " & @DesktopWidth & @CRLF) ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " @DesktopHeight --> " & @DesktopHeight & @CRLF) $aPos = WinGetPos($hExplorer) ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " @SW_MAXIMIZE $aPos --> " & StringFormat('%5i, %5i, %5i, %5i\r\n', $aPos[0], $aPos[1], $aPos[2], $aPos[3])) $hMonitor = _WinAPI_MonitorFromWindow($hExplorer) $aMonitorInfo = _WinAPI_GetMonitorInfo($hMonitor) $aMonitorRectangle = $aMonitorInfo[0] $aMonitorPos = _WinAPI_GetPosFromRect($aMonitorRectangle) ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " $aMonitorPos --> " & StringFormat('%5i, %5i, %5i, %5i\r\n', $aMonitorPos[0], $aMonitorPos[1], $aMonitorPos[2], $aMonitorPos[3])) $iCXFrame = _WinAPI_GetSystemMetrics($SM_CXSIZEFRAME) $iCYFrame = _WinAPI_GetSystemMetrics($SM_CYSIZEFRAME) ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " var: $iCXFrame --> " & $iCXFrame & @LF) ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " var: $iCYFrame --> " & $iCYFrame & @LF) ;~ Send('#{LEFT}') WinMove($hExplorer, '', $aMonitorPos[0] - ($iCXFrame -1), $aMonitorPos[1], $aMonitorPos[2] / 2, $aMonitorPos[3] + $iCYFrame -1) Sleep(2000) $aPos = WinGetPos($hExplorer) ;~ ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " Send #{LEFT} $aPos --> " & StringFormat('%5i, %5i, %5i, %5i\r\n', $aPos[0], $aPos[1], $aPos[2], $aPos[3])) ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " WinMove $aPos --> " & StringFormat('%5i, %5i, %5i, %5i\r\n', $aPos[0], $aPos[1], $aPos[2], $aPos[3])) EndIf
-
Leider wird er nicht nach ganz links oben geschoben.
Erst fängt nun bei x = 7 an.
Run("explorer.exe /N,/E," & $sPfad_explorer_tmp, "", @SW_MAXIMIZE)
Das Fenster wird somit maximiert angezeigt, wodurch der Rahmen nicht sichtbar ist... aber nach deinem WinMove ist es nicht mehr maximiert und auch nicht innerhalb eines Bereichs, in dem es automatisch von Windows angedockt wird, wodurch der Rahmen wieder sichtbar wird.
Versuche es mal hiermit:
AutoIt
Alles anzeigen;-- TIME_STAMP 2020-01-05 01:10:43 Global $sExplorerPath, $sRx, $hExplorer, $aPos $sExplorerPath = "C:\" ; WindowTitle = "<DriveLabel> (C:)" oder "(C:) <DriveLabel>" ;~ $sExplorerPath = "C:\Windows\System32\" ; WindowTitle = "System32" $sRx = '[REGEXPCLASS:^(Explore|Cabinet)WClass$; REGEXPTITLE:^' & _ (StringRegExp($sExplorerPath, '(?i)(^[a-z]:\\?$)') _ ? '\(' & StringLeft($sExplorerPath, 2) & '\) ' & DriveGetLabel($sExplorerPath) & '|' & DriveGetLabel($sExplorerPath) & ' \(' & StringLeft($sExplorerPath, 2) & '\)' _ ; "C:\" : StringRegExpReplace($sExplorerPath, '(?:.+\\)?(.+)\\$', '\1')) & _ ; "C:\Windows\System32\" '$]' ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " $sRx --> " & $sRx & @CRLF) $hExplorer = WinGetHandle($sRx) If Not IsHWnd($hExplorer) Then RunWait("explorer.exe /N,/E," & $sExplorerPath, "", @SW_MAXIMIZE) $hExplorer = WinWait($sRx, '', 3) Else WinSetState($hExplorer, '', @SW_MAXIMIZE) EndIf If IsHWnd($hExplorer) Then ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " $hExplorer --> " & $hExplorer & ' "' & WinGetTitle($hExplorer) & '"' & @CRLF) WinActivate($hExplorer) ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " @DesktopWidth --> " & @DesktopWidth & @CRLF) ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " @DesktopHeight --> " & @DesktopHeight & @CRLF) $aPos = WinGetPos($hExplorer) ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " @SW_MAXIMIZE $aPos --> " & StringFormat('%5i, %5i, %5i, %5i\r\n', $aPos[0], $aPos[1], $aPos[2], $aPos[3])) Send('#{LEFT}') Sleep(2000) $aPos = WinGetPos($hExplorer) ; <-- Diese Werte müssten bei WinMove angeben werden, damit es genauso wie mit Send('#{LEFT}') funktioniert! ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " Send #{LEFT} $aPos --> " & StringFormat('%5i, %5i, %5i, %5i\r\n', $aPos[0], $aPos[1], $aPos[2], $aPos[3])) EndIf
-
Jetzt verstehe ich es... sehr tückisch!
Ich denke aber, so kann man es fixen...
AutoIt
Alles anzeigen;-- TIME_STAMP 2020-01-04 03:39:00 #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <GuiHeader.au3> Example() Func Example() GUICreate("Insert col 0", 280, 180) Local $idListview = GUICtrlCreateListView("Col 1 |Col 2 |Col 3 ", 30, 25, 215, 100) Local $idItem1 = GUICtrlCreateListViewItem("cell-1a|cell-2a|cell-3a", $idListview) Local $idItem2 = GUICtrlCreateListViewItem("cell-1b|cell-2b|cell-3b", $idListview) Local $idItem3 = GUICtrlCreateListViewItem("cell-1c|cell-2c|cell-3c", $idListview) Local $idButton = GUICtrlCreateButton("Insert col 0", 100, 140, 70, 20) Local $iColumn = 0 GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton _GUICtrlListView_InsertColumn($idListview, $iColumn = 0 ? 1 : $iColumn, "Col 0") If $iColumn = 0 Then Local $hHeader = _GUICtrlListView_GetHeader($idListview) _GUICtrlHeader_SetItemText($hHeader, 1, _GUICtrlHeader_GetItemText($hHeader, 0)) _GUICtrlHeader_SetItemText($hHeader, 0, "Col 0") Local $iCount = _GUICtrlListView_GetItemCount($idListview) For $i = 0 To $iCount -1 Step 1 _GUICtrlListView_SetItemText($idListview, $i, _GUICtrlListView_GetItemText($idListview, $i, 0), 1) _GUICtrlListView_SetItemText($idListview, $i, '*', 0) Next EndIf GUICtrlSetState($idButton, $GUI_DISABLE) EndSwitch WEnd EndFunc ;==>Example
-
Besonderheit :
Microsoft hat es etwas schwierig gemacht, vor der Spalte 0 eine Spalte nativ einzufügen.
"etwas schwierig" ließe sich sicher mit "etwas Aufwand" meistern... wobei ich nicht verstehe, was daran schwierig sein soll.
"nativ einzufügen" - was soll das denn bedeuten?
In seinem Script sehe ich nichts von nativ beim Einfügen einer Spalte... denn das macht er ja mit:
_GUICtrlListView_InsertColumn($g_idListview, $iCol_Insert, $sHeader_TextNew, 100)
Wenn $iCol_Insert = 0 ist, wird die neue Spalte doch vor der bereits vorhanden ersten Spalte eingefügt. Und wieso schreibt er ein paar Zeilen darüber als Kommentar: "never insert a column before 1st column !"? Warum nicht?
-
Hier ein Bsp. ohne UDF...
AutoIt
Alles anzeigen;-- TIME_STAMP 2019-12-31 23:56:28 v 0.1 #Region ;************ Includes ************ #include-once #include <GUIConstantsEx.au3> #include <GuiTab.au3> #include <TabConstants.au3> #include <WinAPIConv.au3> #include <WindowsConstants.au3> #Include <GUIConstantsEx.au3> #include <GuiTab.au3> #EndRegion ;************ Includes ************ Opt('MustDeclareVars', 1) Opt('GUIResizeMode', $GUI_DOCKALL) Global $g_hGUI, $g_idTab, $g_hTab, $g_idBtn_1, $g_idBtn_2, $g_idBtn_3, $g_idBtn_4 _Main() Func _Main() Local $aWinPos = [200, 230, -1, -1], $aClientSize $g_hGUI = GUICreate("", $aWinPos[0], $aWinPos[1], $aWinPos[2], $aWinPos[3]) $aClientSize = WinGetClientSize($g_hGUI) $g_idTab = GUICtrlCreateTab(5, 5, $aClientSize[0] - 10, $aClientSize[1] - 10) $g_hTab = GUICtrlGetHandle($g_idTab) GUICtrlCreateTabItem("Tab 1") $g_idBtn_1 = GUICtrlCreateButton("Button 1", 50, 50, 100, 40) GUICtrlCreateTabItem("Tab 2") $g_idBtn_2 = GUICtrlCreateButton("Button 2", 50, 50, 100, 40) $g_idBtn_3 = GUICtrlCreateButton("Button 3", 50, 100, 100, 40) $g_idBtn_4 = GUICtrlCreateButton("Button 4", 50, 150, 100, 40) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW, $g_hGUI) GUIRegisterMsg($WM_NOTIFY, '_WM_NOTIFY') While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iIDFrom, $iCode Local $iCurTab, $aWinPos, $aClientSize, $aTabPos ; Au3Check soll keine Meldung machen, wenn bei #AutoIt3Wrapper_AU3Check_Parameters der Parameter -w 5 angegeben wurde und diese Variablen hier nicht verwendet werden. #forceref $hWnd, $iMsg, $wParam $tNMHDR = DllStructCreate($tagNMHDR, $lParam) ; Contains information about a notification message $hWndFrom = HWnd(DllStructGetData($tNMHDR, 'hWndFrom')) ; das Handle des auslösenden Controls ermitteln $iIDFrom = DllStructGetData($tNMHDR, 'IDFrom') ; die ID des auslösenden Controls ermitteln $iCode = DllStructGetData($tNMHDR, 'Code') ; den Code des auslösenden Controls ermitteln Switch $hWndFrom ; Welches GUI-Control-Element hat den Notify-Event ausgelöst Case $g_hTab ; Message from Tab-Control? ConsoleWrite('> _WM_NOTIFY: Case $g_hTab' & @CRLF) If $iCode = $TCN_SELCHANGE Then ; Wurde ein anderes Tabitem selektiert? $iCurTab = _GUICtrlTab_GetCurSel($g_idTab) $aWinPos = WinGetPos($g_hGUI) ConsoleWrite('! _WM_NOTIFY: $iCode = $TCN_SELCHANGE - $iCurTab = ' & $iCurTab & ' - ("' & _GUICtrlTab_GetItemText($g_idTab, $iCurTab) & '")' & @CRLF) Switch $iCurTab Case 0 ; Tab 1 $aWinPos[3] = 130 Case 1 ; Tab 2 $aWinPos[3] = 230 Case Else Return $GUI_RUNDEFMSG EndSwitch WinMove($g_hGUI, '', $aWinPos[0], $aWinPos[1], $aWinPos[2], $aWinPos[3]) $aTabPos = ControlGetPos($g_hGUI, '', $g_idTab) $aClientSize = WinGetClientSize($g_hGUI) GUICtrlSetPos($g_idTab, $aTabPos[0], $aTabPos[1], $aClientSize[0] - 10, $aClientSize[1] - 10) EndIf EndSwitch Return $GUI_RUNDEFMSG ; Anweisung an Windows, dass es mit der normalen Abarbeitung fortfahren kann EndFunc ;==>_WM_NOTIFY
-
Autoit liefert in den meisten Fällen nur so genannte Pseudo-Handles, die eigentlich nur Open-Counts sind. Die bekommst du z. B. auch bei OpenDll. Werden mehrere Dateien/Dlls geöffnet, erhöht sich der Counter jeweils um 1.
-
-
Ich denke mal du suchst dies hier...
Age (Alter) muss mindestens 18 sein, Male (Geschlecht) muss 1 (Mann), 2 (Frau) oder 3 (Zwitter) sein - erst wenn beide Bedingungen erfüllt sind, kann bei ShowXXX ein y|n eingegeben werden.
AutoIt
Alles anzeigen;-- TIME_STAMP 2019-11-30 16:14:23 v 0.1 #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <WinAPIConv.au3> #include <WinAPISysWin.au3> Global $g_iAge = 0, $g_iMale = 0, $g_bShowXXX = False, $g_hGUI, $g_idInputAge, $g_idInputMale, $g_idInputShowXXX, $g_hInputAge, $g_hInputMale, $g_hInputShowXXX Example() Func Example() $g_hGUI = GUICreate("input notify age", 460, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45) GUISetFont(11, 800, 0, 'Courier New') GUICtrlCreateLabel(" Age: ", 10, 5, 130, 20) $g_idInputAge = GUICtrlCreateInput("", 140, 5, 300, 20) $g_hInputAge = GUICtrlGetHandle(-1) GUICtrlCreateLabel(" Male: (1|2|3)", 10, 35, 130, 20) $g_idInputMale = GUICtrlCreateInput("", 140, 35, 300, 20) $g_hInputMale = GUICtrlGetHandle(-1) GUICtrlCreateLabel("ShowXXX: (y|n) ", 10, 65, 130, 20) $g_idInputShowXXX = GUICtrlCreateInput("", 140, 65, 300, 20) $g_hInputShowXXX = GUICtrlGetHandle(-1) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>Example Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode #forceref $hWnd, $iMsg ;~ Return $GUI_RUNDEFMSG $hWndFrom = $lParam $iIDFrom = _WinAPI_LoWord($wParam) $iCode = _WinAPI_HiWord($wParam) Switch $hWndFrom Case $g_hInputAge Switch $iCode Case $EN_CHANGE ; $EN_CHANGE message from one of the input / edit controls to its parent window. $g_iAge = Int(GUICtrlRead($g_idInputAge)) $g_bShowXXX = ($g_iAge >= 18) And $g_iMale ? True : False If $g_bShowXXX Then GUICtrlSetState($g_idInputShowXXX, $GUI_ENABLE) Else GUICtrlSetState($g_idInputShowXXX, $GUI_DISABLE) EndIf Case $EN_KILLFOCUS ; $EN_KILLFOCUS message from one of the input / edit controls to its parent window. If $g_bShowXXX Then GUICtrlSetState($g_idInputShowXXX, $GUI_ENABLE) Else If ControlGetHandle($g_hGUI, '', ControlGetFocus($g_hGUI)) <> $g_hInputMale Then ControlFocus($g_hInputAge, '', '') GUICtrlSetState($g_idInputShowXXX, $GUI_DISABLE) EndIf EndSwitch Case $g_hInputMale Switch $iCode Case $EN_CHANGE ; $EN_CHANGE message from one of the input / edit controls to its parent window. $g_iMale = Int(GUICtrlRead($g_idInputMale)) If $g_iMale < 1 Or $g_iMale > 3 Then $g_iMale = 0 GUICtrlSetData($g_idInputMale, '') EndIf If $g_iAge >= 18 And $g_iMale > 0 Then GUICtrlSetState($g_idInputShowXXX, $GUI_ENABLE) Else GUICtrlSetState($g_idInputShowXXX, $GUI_DISABLE) EndIf EndSwitch Case $g_hInputShowXXX Switch $iCode Case $EN_CHANGE ; $EN_CHANGE message from one of the input / edit controls to its parent window. Local $sShowXXX = StringUpper(GUICtrlRead($g_idInputShowXXX)) Switch $sShowXXX Case 'Y', 'N' ; ok Case Else GUICtrlSetData($g_idInputShowXXX, '') EndSwitch EndSwitch EndSwitch EndFunc ;==>_WM_COMMAND
-
Mit "Wer lesen kann..." meinte ich natürlich mich selbst!
-
Und das gibt dir den markierten Text zurück?
Wer lesen kann...
-
AutoIt
Alles anzeigenLocal $hPsPad = WinGetHandle('[CLASS:TfPSPad]') ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " var: $hPsPad --> " & $hPsPad & @LF) Local $hTPSSynEdit = ControlGetHandle($hPsPad, '', '[CLASS:TPSSynEdit; INSTANCE:1]') ConsoleWrite("@@_Debug_line" & @TAB & @TAB & @ScriptLineNumber & " var: $hTPSSynEdit --> " & $hTPSSynEdit & @LF) Local $sText = ControlGetText($hTPSSynEdit, '', '') ConsoleWrite('---------------------------------------------------' & @CRLF) ConsoleWrite($sText & @CRLF) ConsoleWrite('---------------------------------------------------' & @CRLF) WinActivate($hPsPad) Sleep(2000) ControlSetText($hTPSSynEdit, '', '', 'new text is good text', 1)
-
Bei _GUICtrlRichEdit_Create kannst du als Control style $ES_READONLY (Prevents the user from typing or editing text in the edit control) angeben. Zudem bekommst du von _GUICtrlRichEdit_Create ein Window-Handle zurück und kannst dir somit die GUI sparen.
-
Das ist ein ein kleiner Umweg, um zu verhindern, dass mehrere User gleichzeitig das Programm starten können - Eine Art Read-Only-Funktion.
Wieso benutzt du dafür nicht die Funktion _Singleton?
-
StringRegExpReplace($inhalt,"(\r\n|\n)+","\r\n")
Ich würde es so machen:
AutoIt
Alles anzeigen;-- TIME_STAMP 2019-10-24 16:45:15 v 0.1 #Include <StringConstants.au3> Local $inhalt = @CRLF & _ 'trtr' & @CRLF & @CRLF & _ 'ghgh' & @CRLF & _ 'jkjk' & @CRLF & @CRLF & _ 'xcxc' & @CRLF & _ 'qwqw' & @CRLF & @CRLF & @CRLF & _ 'zuzu' & @CRLF ConsoleWrite('--------------------------------------' & @CRLF) ConsoleWrite($inhalt) ConsoleWrite('--------------------------------------' & @CRLF) ConsoleWrite(StringStripWS(StringRegExpReplace($inhalt, '(\R+)', @CRLF), $STR_STRIPLEADING)) ConsoleWrite('--------------------------------------' & @CRLF)