Hi,
wenn die Funktion aufgerunfen wird, dann wird sie abgearbeitet samt deiner Schleife, danach wird dahin gesprungen wo die Funktion aufgerufen wurde.
Mega
Hi,
wenn die Funktion aufgerunfen wird, dann wird sie abgearbeitet samt deiner Schleife, danach wird dahin gesprungen wo die Funktion aufgerufen wurde.
Mega
#include<Array.au3>
Global $array[3][3] = [[1,2,3],[4,5,6],[7,8,9]]
_ArrayDisplay($array)
Hi,
guck dir mal TeamViewer an, da brauchst du keine Installation.
Mega
Hi,
zu 1) Du kannst einen ganzen Ordner kopieren.
zu 2) Move die Files doch einfach in den Papierkorb falls es kein löschen gibt.
Mega
Hi,
oder
[autoit]Dim $Array1[4] = ["A", "B", "C", "D"]
Dim $Array2[4] = ["1", "2", "3", "4"]
Dim $Array3[4] = ["X", "Y", "Z", "ß"]
Dim $arrays[3] = [$Array1, $Array2, $Array3]
For $y = 0 To UBound($arrays) - 1
$a = $arrays[$y]
For $i = 0 To UBound($a) - 1
ConsoleWrite("Array-Wert von Array Nr." & $i & " " & $a[$i] & @CRLF)
Next
Next
Mega
Aha, verstanden! Gute Frage. ![]()
Hi,
was fehlt dir denn noch? Es gibt doch Haken, Viereck, leer als Status
Mega
Hi,
wenn es in VB geht, dann geht es auch in Autoit. Die Funktionen sind lediglich noch nicht in einer UDF untergebracht!
Mega
Hi,
neu erstellte Word Dokumente mit der Endung docx können entpackt werden, dann entstehen ca 11 xml files. Das docment.xml enthält dann den Text.
Mega
Hi,
wie ist das?
Opt('WinTitleMatchMode', 4)
[/autoit] [autoit][/autoit] [autoit]Run('notepad')
[/autoit] [autoit][/autoit] [autoit]Sleep(1000)
Global $handle = WinGetHandle('[CLASS:Notepad]')
WinMove($handle, '', 300, 300, 500, 500, 1)
Global $colors_A = _getPixelColors(50, 50, 200, 200)
_paintPixel($colors_A, $handle, 50, 50)
Func _getPixelColors($start_X = 0, $start_Y = 0, $end_X = @DesktopWidth, $end_Y = @DesktopHeight)
Local $coord[$end_X - $start_X][$end_Y - $start_Y]
For $x = 0 To UBound($coord, 1) - 1
For $y = 0 To UBound($coord, 2) - 1
$coord[$x][$y] = PixelGetColor($x + $start_X, $y + $start_Y)
Next
Next
Return $coord
EndFunc ;==>_getPixelColors
Func _paintPixel(ByRef $coord, $handle, $start_X = 0, $start_Y = 0)
Local $dc
For $x = 0 To UBound($coord, 1) - 1
For $y = 0 To UBound($coord, 2) - 1
$dc = DllCall("user32.dll", "int", "GetDC", "hwnd", $handle)
DllCall("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $x + $start_X, "long", $y + $start_Y, "long", $coord[$x][$y])
DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0])
Next
Next
Return $coord
EndFunc ;==>_paintPixel
Mega
Hi,
habe keine Zeit mehr, aber die schnell eine Starthilfe generiert.
#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$GUI = GUICreate("GUI", 351, 119, 193, 125)
GUICtrlCreateGroup("", 5, -5, 340, 120)
GUICtrlCreateLabel("Path", 15, 15, 26, 17)
$path_I = GUICtrlCreateInput("", 65, 15, 201, 21)
GUICtrlCreateLabel("Duration", 15, 40, 83, 17)
$duration_I = GUICtrlCreateInput("", 65, 40, 121, 21)
GUICtrlCreateLabel("Min", 15, 70, 46, 17)
$min_I = GUICtrlCreateInput("", 65, 65, 121, 21)
GUICtrlCreateLabel("Max", 15, 95, 36, 17)
$max_I = GUICtrlCreateInput("", 65, 90, 121, 21)
$browse = GUICtrlCreateButton("Browse", 270, 15, 70, 20, 0)
$next_B = GUICtrlCreateButton("Next", 195, 40, 145, 20, 0)
$view_B = GUICtrlCreateButton("View", 195, 65, 145, 20, 0)
$start_B = GUICtrlCreateButton("Start", 195, 90, 145, 20, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $path_A[1], $min_A[1], $max_A[1], $duration_A[1]
[/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $browse
$re = FileOpenDialog('', @ScriptDir, 'All (*.*)')
If Not @error Then GUICtrlSetData($path_I, $re)
Case $next_B
_ArrayAdd($path_A, GUICtrlRead($path_I))
_ArrayAdd($duration_A, GUICtrlRead($duration_I))
_ArrayAdd($min_A, GUICtrlRead($min_I))
_ArrayAdd($max_A, GUICtrlRead($max_I))
GUICtrlSetData($path_I, '')
GUICtrlSetData($duration_I, '')
GUICtrlSetData($min_I, '')
GUICtrlSetData($max_I, '')
Case $view_B
Local $a[UBound($path_A)][4]
For $i = 0 To UBound($path_A) - 1
$a[$i][0] = $path_A[$i]
$a[$i][1] = $duration_A[$i]
$a[$i][2] = $min_A[$i]
$a[$i][3] = $max_A[$i]
Next
_ArrayDisplay($a)
EndSwitch
WEnd
Mega
kein Problem, so schwer war das ja nicht.
Hi,
die Idee hatten schon viele vor dir, deshalb gibt es sowas schon. ![]()
So long,
Mega
Hi,
dann mach einfach
[autoit]$fh = FileOpen('c:\Downloads\PG.txt', 0)
$content = FileRead($fh)
FileClose($fh)
FileWrite(FileOpen('c:\Downloads\PG.txt', 2), StringRegExpReplace($content, @CRLF, '', 1))
[/autoit]Mega
Hi,
nimm einfach
[autoit][/autoit][autoit][/autoit][autoit]$retval = _ReplaceStringInFile($file_2,@CRLF,'', 0,0)
[/autoit]Mega
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#Include <Array.au3>
#Include <GuiListBox.au3>
$SS_SUNKEN = 0x1000
$SS_CENTER = 0x01
FileDelete(@TempDir & "\au3.txt")
Opt("OnExitFunc", "endscript")
Dim $TInfo, $R_[7], $Temp_File, $Temp_Type = StringSplit(".au3,.txt,.ini,.dat,.log,", ",")
Dim $Last_loc = "C:\Program Files\AutoIt3\Examples"
$AutoItBetaLocation = IniRead(@ScriptDir & "\IE-library.ini", "exe", "dir", "")
$Program_2 = $AutoItBetaLocation & "\Autoit3.exe"
$maingui = GUICreate("Script/Text Manager v1.0.6", 500, 365)
GUISetFont(9, 400, -1, "MS Sans Serif")
$vStatus = GUICtrlCreateLabel("View: Search Window", 0, 350, 130, 15, $SS_SUNKEN + $SS_CENTER)
GUICtrlCreateLabel("Manager Status:", 130, 350, 120, 15, $SS_SUNKEN + $SS_CENTER)
$Status = GUICtrlCreateLabel("System is Ready...", 250, 350, 250, 15, $SS_SUNKEN + $SS_CENTER)
GUICtrlSetColor(-1, 0xff0000)
GUISetState()
$searchgui = GUICreate("Script Finder", 500, 350, 0, 0, $WS_CHILD + $WS_BORDER, "", $maingui)
GUISetFont(9, 400, -1, "MS Sans Serif")
$location = GUICtrlCreateInput($Last_loc, 20, 20, 340, 20)
$C_browse = GUICtrlCreateCheckbox("All Sub-Folders", 380, 20, 100, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
$browse_btn = GUICtrlCreateButton("Browse Folders", 380, 50, 100, 20)
$R_word = GUICtrlCreateRadio("", 20, 50, 20, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
$word_search = GUICtrlCreateInput("Search word/phrase", 40, 50, 145, 20)
$R_title = GUICtrlCreateRadio("", 195, 50, 20, 20)
$title_search = GUICtrlCreateInput("Search FileName/Folder", 215, 50, 145, 20)
GUICtrlCreateGroup('File Type', 20, 78, 340, 38)
$R_[1] = GUICtrlCreateRadio(".au3", 30, 92, 50, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
$R_[2] = GUICtrlCreateRadio(".txt", 80, 92, 50, 20)
$R_[3] = GUICtrlCreateRadio(".ini", 130, 92, 50, 20)
$R_[4] = GUICtrlCreateRadio(".dat", 180, 92, 50, 20)
$R_[5] = GUICtrlCreateRadio(".log", 230, 92, 50, 20)
$R_[6] = GUICtrlCreateRadio("", 280, 92, 15, 20)
$R_Input = GUICtrlCreateInput("Type", 298, 90, 50, 20)
$go_btn = GUICtrlCreateButton("Start Search", 380, 85, 100, 30)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
$Edit1 = GUICtrlCreateList("Found File list", 20, 130, 460, 150, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_DISABLENOSCROLL, $WS_HSCROLL))
_GUICtrlListBox_SetHorizontalExtent ($Edit1, 720)
$label = GUICtrlCreateLabel("Files Found with Phrase: None", 140, 290, 220, 20, $SS_SUNKEN + $SS_CENTER)
$label2 = GUICtrlCreateLabel("Files Found: None", 20, 290, 100, 20, $SS_SUNKEN + $SS_CENTER)
$manage_btn = GUICtrlCreateButton("Manage View", 20, 320, 100, 20)
$view_btn = GUICtrlCreateButton("View File", 140, 320, 100, 20)
$SciTE_btn = GUICtrlCreateButton("Open in SciTE", 260, 320, 100, 20)
$Run_btn = GUICtrlCreateButton("Run File", 380, 290, 100, 20)
$Exit_btn = GUICtrlCreateButton("Close", 380, 320, 100, 20)
GUISetState()
$filesgui = GUICreate("Script Finder", 500, 350, 0, 0, $WS_CHILD + $WS_BORDER, "", $maingui)
$Edit2 = GUICtrlCreateList("Searched File list", 20, 20, 460, 270, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_DISABLENOSCROLL, $WS_HSCROLL))
_GUICtrlListBox_SetHorizontalExtent ($Edit2, 720)
$Search_btn = GUICtrlCreateButton("Search View", 20, 320, 100, 20)
$copy_btn = GUICtrlCreateButton("Copy File", 140, 320, 100, 20)
$rename_btn = GUICtrlCreateButton("Rename File", 260, 320, 100, 20)
$Delete_btn = GUICtrlCreateButton("Delete File", 380, 320, 100, 20)
$labelA = GUICtrlCreateLabel("Files Found with Phrase: None", 140, 290, 220, 20, $SS_SUNKEN + $SS_CENTER)
$label2A = GUICtrlCreateLabel("Files Found: None", 20, 290, 100, 20, $SS_SUNKEN + $SS_CENTER)
$Run_btnA = GUICtrlCreateButton("Run File", 380, 290, 100, 20)
GUISetState(@SW_HIDE)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Exit_btn
Exit
Case $msg = $browse_btn
GUICtrlSetData($Status, "Selecting Folder to Search...")
$find_loc = FileSelectFolder("Choose a Folder.", "")
If $find_loc = "" Then ContinueLoop
GUICtrlSetData($location, $find_loc)
IniWrite(@ScriptDir & "\IE-library.ini", "search", "dir", $find_loc)
Case $msg = $go_btn
search_Folders()
GUICtrlSetState($word_search, $GUI_FOCUS)
Case $msg = $view_btn
view()
Case $msg = $copy_btn
Set_Copy()
Case $msg = $rename_btn
Set_Rename()
Case $msg = $Delete_btn
Set_Delete()
Case $msg = $Run_btn
$TInfo = GUICtrlRead($Edit1)
Set_Run($TInfo)
Case $msg = $Run_btnA
$TInfo = GUICtrlRead($Edit2)
Set_Run($TInfo)
Case $msg = $SciTE_btn
open_SciTE()
Case $msg = $manage_btn
GUICtrlSetData($vStatus, "View: Manage Window")
GUISetState(@SW_HIDE, $searchgui)
GUISetState(@SW_SHOW, $filesgui)
view_all()
Case $msg = $Search_btn
GUICtrlSetData($vStatus, "View: Search Window")
GUISetState(@SW_HIDE, $filesgui)
GUISetState(@SW_SHOW, $searchgui)
EndSelect
GUICtrlSetData($Status, "System is Ready...")
Sleep(20)
WEnd
Func search_Folders()
If Set_File() = -1 Then Return
GUICtrlSetData($Status, "Searching for Files...")
FileDelete(@TempDir & "\au3.txt")
$Found = 0
$Searched = 0
$title = 0
GUICtrlSetData($label, "Files Found with Phrase: " & $Found)
GUICtrlSetData($labelA, "Files Found with Phrase: " & $Found)
GUICtrlSetData($label2, "Files Found: " & $Searched)
GUICtrlSetData($label2A, "Files Found: " & $Searched)
GUICtrlSetData($Edit1, "")
GUICtrlSetData($Edit2, "")
$Temp_Dir = (GUICtrlRead($location))
If $Temp_Dir = "" Then
GUICtrlSetData($Status, "No Folder Selected...")
MsgBox(262208, "Sorry", "No Folders Selected. ", 2)
Return
EndIf
If StringRight($Temp_Dir, 1) <> "\" Then $Temp_Dir = $Temp_Dir & "\"
$Temp_Word = (GUICtrlRead($word_search))
If GUICtrlRead($C_browse) = 1 Then
GUICtrlSetData($Status, "Searching in Sub-Folders...PLEASE WAIT")
RunWait(@ComSpec & ' /c ' & 'dir "' & $Temp_Dir & $Temp_File & '" /a :h /b /s' & ' > "' & @TempDir & '\au3.txt"', '', @SW_HIDE)
Else
GUICtrlSetData($Status, "Searching in Local Folder...")
$FileList = _FileListToArray($Temp_Dir, $Temp_File, 1)
If (Not IsArray($FileList)) Or (@error = 1) Then
GUICtrlSetData($Status, "No Files Found...")
MsgBox(262208, "Sorry", "No Files Found.", 2)
Return
EndIf
$F_File = FileOpen(@TempDir & "\au3.txt", 2)
For $x = 1 To $FileList[0]
FileWriteLine($F_File, $Temp_Dir & $FileList[$x])
Next
FileClose($F_File)
EndIf
GUICtrlSetData($Status, "Listing...")
If GUICtrlRead($R_title) = 1 Then
$Temp_Word = (GUICtrlRead($title_search))
$title = 1
EndIf
$hFile = FileOpen(@TempDir & "\au3.txt", 0)
While 1
$sLine = FileReadLine($hFile)
If @error = -1 Then
FileClose($hFile)
Return
EndIf
$Temp_Dir = $sLine
If $title = 0 Then $Temp_Search = FileRead($sLine, FileGetSize($sLine))
If $title = 1 Then $Temp_Search = $sLine
If StringInStr($Temp_Search, $Temp_Word) Then
GUICtrlSetData($Edit1, $sLine, 1)
$Found = $Found + 1
GUICtrlSetData($label, "Files Found with Phrase: " & $Found)
GUICtrlSetData($labelA, "Files Found with Phrase: " & $Found)
EndIf
$Searched = $Searched + 1
GUICtrlSetData($label2, "Files Found: " & $Searched)
GUICtrlSetData($label2A, "Files Found: " & $Searched)
GUICtrlSetData($Status, "Searched:" & $sLine)
WEnd
FileClose($hFile)
EndFunc ;==>search_Folders
Func view()
GUICtrlSetData($Status, "Viewing in Notepad...")
$Temp_Edit = GUICtrlRead($Edit1)
$Temp_Word = (GUICtrlRead($word_search))
If $Temp_Edit = "" Or $Temp_Edit = "Found File list" Then
GUICtrlSetData($Status, "No File/Folder Selected...")
MsgBox(262208, "Sorry", "No Files\Folders Selected. ", 2)
Return
EndIf
Run("notepad.exe " & $Temp_Edit)
WinWaitActive("")
If GUICtrlRead($R_title) = 1 Then Return
GUICtrlSetData($Status, "Searching Notepad...")
Sleep(200)
Send("!EF")
Sleep(200)
Send($Temp_Word, 1)
Sleep(200)
Send("!f")
EndFunc ;==>view
Func view_all()
GUICtrlSetData($Status, "Viewing Manager Window...")
If Not FileExists(@TempDir & "\au3.txt") Then
GUICtrlSetData($Status, "No Searches Were Completed...")
MsgBox(262208, "Sorry", "No Files\Folders Searched. ", 2)
Return
EndIf
GUICtrlSetData($Edit2, "")
$vFile = FileOpen(@TempDir & "\au3.txt", 0)
While 1
$vLine = FileReadLine($vFile)
If @error = -1 Then ExitLoop
GUICtrlSetData($Edit2, $vLine, 1)
GUICtrlSetData($Status, "Setting Files: " & $vLine)
WEnd
EndFunc ;==>view_all
Func Set_Run(ByRef $TInfo)
GUICtrlSetData($Status, "Setting up Run Command...")
If $TInfo = "" Or $TInfo = "Found File list" Or $TInfo = "Searched File list" Then
GUICtrlSetData($Status, "No File Selected to Run...")
MsgBox(262208, "Sorry", "No Run File was Selected. ", 2)
Return
EndIf
If GUICtrlRead($R_[6]) = 1 And StringInStr($TInfo, ".au3") = 0 Then
GUICtrlSetData($Status, "Running File...")
$TInfo = FileGetShortName($TInfo)
ShellExecute($TInfo)
$TInfo = ""
Return
EndIf
If StringInStr($TInfo, ".au3") = 0 Then
GUICtrlSetData($Status, "File Not an Au3 Type...")
MsgBox(262208, "Sorry", "Run File was NOT an *au3* Type. " & @CRLF & @CRLF & "Opening File in Notepad ", 2)
GUICtrlSetData($Status, "Viewing in Notepad...")
Run("notepad.exe " & $TInfo)
$TInfo = ""
Return
EndIf
$TInfo = FileGetShortName($TInfo)
GUICtrlSetData($Status, "Running File...")
RunWait($Program_2 & " " & $TInfo)
$TInfo = ""
EndFunc ;==>Set_Run
Func Set_Copy()
GUICtrlSetData($Status, "Setting up Copy...")
$CInfo = GUICtrlRead($Edit2)
If $CInfo = "" Or $CInfo = "Found File list" Or $CInfo = "Searched File list" Then
GUICtrlSetData($Status, "No File Selected to Copy...")
MsgBox(262208, "Sorry", "No Copy File was Selected. ", 2)
Return
EndIf
GUICtrlSetData($Status, "Find Destination Folder...")
$Linfo = FileSelectFolder("Choose a Destination Folder.", "")
If $Linfo = "" Then
GUICtrlSetData($Status, "No Folder Selected...")
MsgBox(262208, "Sorry", "No Destination Folder was Selected. ", 2)
Return
EndIf
$NInfo = StringSplit($CInfo, "\")
$NInfo = $Linfo & "\" & $NInfo[$NInfo[0]]
GUICtrlSetData($Status, "Checking if file exists...")
If FileExists($NInfo) Then
$iMsgBoxAnswer = MsgBox(262212, "Overwrite Existing File?", "The File " & $NInfo & " was found " & @CRLF & @CRLF & "Over-Write File?")
If $iMsgBoxAnswer = 7 Then
Return
EndIf
EndIf
GUICtrlSetData($Status, "Copying File...")
$var1 = FileCopy($CInfo, $NInfo, 1)
If $var1 = 1 Then
MsgBox(262208, "Success", "The file was Copied ", 2)
Else
MsgBox(262208, "Fail", "The file was NOT Copied ", 2)
EndIf
EndFunc ;==>Set_Copy
Func Set_Rename()
GUICtrlSetData($Status, "Setting Rename File...")
$RInfo = GUICtrlRead($Edit2)
If $RInfo = "" Or $RInfo = "Found File list" Or $RInfo = "Searched File list" Then
GUICtrlSetData($Status, "No File Selected...")
MsgBox(262208, "Sorry", "No Rename File was Selected. ", 2)
Return
EndIf
GUICtrlSetData($Status, "Prompt for FileName...")
$Minfo = InputBox("Rename File", "Please Type a New FileName. ", "", "", -1, 150)
If $Minfo = "" Then
GUICtrlSetData($Status, "No Name Given...")
MsgBox(262208, "Sorry", "No File Name was Selected. ", 2)
Return
EndIf
$result = StringInStr($RInfo, "\", 0, -1)
$NInfo = StringLeft($RInfo, $result) & $Minfo & StringRight($Temp_File, 4)
GUICtrlSetData($Status, "Checking if File Exists...")
If FileExists($NInfo) Then
$iMsgBoxAnswer = MsgBox(262212, "Overwrite Existing File?", "The File " & $NInfo & " was found " & @CRLF & @CRLF & "Over-Write File?")
If $iMsgBoxAnswer = 7 Then
Return
EndIf
EndIf
GUICtrlSetData($Status, "Renaming File...")
$var1 = FileMove($RInfo, $NInfo, 1)
If $var1 = 1 Then
FileDelete($RInfo)
MsgBox(262208, "Success", "The file was Renamed ", 2)
Else
MsgBox(262208, "Fail", "The file was NOT Renamed ", 2)
EndIf
$ret = _GUICtrlListBox_FindString ($Edit2, $RInfo, 1)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error #1", "Unknown error from _GUICtrlListBox_FindString")
Else
$ret2 = _GUICtrlListBox_DeleteString ($Edit2, $ret)
If ($ret2 == $LB_ERR) Then
MsgBox(16, "Error #2", "Unknown error from _GUICtrlListDeleteItem")
EndIf
EndIf
EndFunc ;==>Set_Rename
Func Set_Delete()
GUICtrlSetData($Status, "Setting up Delete...")
$DInfo = GUICtrlRead($Edit2)
If $DInfo = "" Or $DInfo = "Found File list" Or $DInfo = "Searched File list" Then
GUICtrlSetData($Status, "No File Selected...")
MsgBox(262208, "Sorry", "No Delete File was Selected. ", 2)
Return
EndIf
GUICtrlSetData($Status, "Verify that File Exists...")
If FileExists($DInfo) Then
$iMsgBoxAnswer = MsgBox(262212, "Confirm - Delete File?", "The File " & $DInfo & " was found " & @CRLF & @CRLF & "Delete File?")
If $iMsgBoxAnswer = 7 Then
Return
EndIf
EndIf
GUICtrlSetData($Status, "Deleting File...")
$var1 = FileDelete($DInfo)
If $var1 = 1 Then
MsgBox(262208, "Success", "The file was Deleted ", 2)
Else
MsgBox(262208, "Fail", "The file was NOT Deleted ", 2)
EndIf
$ret = _GUICtrlListBox_FindString ($Edit2, $DInfo, 1)
If ($ret == $LB_ERR) Then
MsgBox(16, "Error #1", "Unknown error from _GUICtrlListBox_FindString")
Else
$ret2 = _GUICtrlListBox_DeleteString ($Edit2, $ret)
If ($ret2 == $LB_ERR) Then
MsgBox(16, "Error #2", "Unknown error from _GUICtrlListDeleteItem")
EndIf
EndIf
EndFunc ;==>Set_Delete
Func Set_File()
GUICtrlSetData($Status, "Checking File Type...")
For $t = 1 To $Temp_Type[0]
If GUICtrlRead($R_[$t]) = 1 Then
If $t = $Temp_Type[0] Then
$Read_Temp = GUICtrlRead($R_Input)
If $Read_Temp = "" Or StringInStr($Read_Temp, ".") = 0 Then
GUICtrlSetData($Status, "No File Type Selected...")
MsgBox(262208, "Sorry", "No File Type Selected. " & @CRLF & "Example .exe or .dll ", 5)
Return -1
EndIf
$Temp_File = "*" & $Read_Temp
Else
$Temp_File = "*" & $Temp_Type[$t]
EndIf
Return
EndIf
Next
EndFunc ;==>Set_File
Func open_SciTE()
GUICtrlSetData($Status, "Setting up SciTE...")
$Temp_Edit = GUICtrlRead($Edit1)
If $Temp_Edit = "" Or $Temp_Edit = "Found File list" Then
GUICtrlSetData($Status, "No File Selected for SciTE...")
MsgBox(262208, "Sorry", "No Files\Folders Selected. ", 2)
Return
EndIf
GUICtrlSetData($Status, "Checking for Au3 File...")
If StringInStr($Temp_Edit, ".au3") = 0 Then
$iMsgBoxAnswer = MsgBox(262212, "Verify File Type", "The File " & $Temp_Edit & " is NOT an *au3* Type. " & @CRLF & @CRLF & "Open in SciTE.exe?")
If $iMsgBoxAnswer = 7 Then
Return
EndIf
EndIf
GUICtrlSetData($Status, "Check if SciTE is Running...")
If ProcessExists("SciTE.exe") Then
MsgBox(262208, "SciTE is Running", "Placing File in Scite.exe ", 2)
Opt("WinTitleMatchMode", 4)
$Temp_Text = FileRead($Temp_Edit, FileGetSize($Temp_Edit))
WinActivate("classname=SciTEWindow")
WinWaitActive("classname=SciTEWindow")
ControlSend("classname=SciTEWindow", "", "", "^n")
Sleep(50)
ControlSetText("classname=SciTEWindow", "", "Scintilla1", $Temp_Text)
Opt("WinTitleMatchMode", 1)
Return
EndIf
GUICtrlSetData($Status, "Running SciTE Now...")
$Temp_Edit = FileGetShortName($Temp_Edit)
Run(@ComSpec & " /c Start " & $Temp_Edit, "", @SW_HIDE)
EndFunc ;==>open_SciTE
Func endscript()
MsgBox(262208, "Thanks", "... Valuater ", 1)
FileDelete(@TempDir & "\au3.txt")
EndFunc ;==>endscript
Hi,
du erstellst 2 Dateien in denen jeweils die erste Zeile leer ist. Diese möchtest du löschen, richtig? Vermeiden geht nicht?
Folgende Möglichkeiten:
_FileReadToArray und dann _FileWriteFromArray ab Postion X
oder
dein while 1
$line = FileReadLine($file)
If @error = -1 Then ExitLoop
ändern in For $i = DEINE erste ZEILE bis _FileCountLines() und dann FileReadLine( ..., $i)
oder mit _ReplaceStringInFile den ersten @CRLF löschen
oder mit dieser alten Funktion von mir mal gucken ob du die Zeile löschen kannst.
#include <File.au3>
#include <Array.au3>
_removeLineInFile(@ScriptDir & "\x.txt", "X", 3, 1, 0, 0, "", 0)
ConsoleWrite('Error: ' & @error & '
' & 'Extended: ' & @extended & @CRLF)
;===============================================================================
;
; Function Name: _removeLineInFile
; Description:: _removeLineInFile
; Parameter(s):
; 1. $h_path = Path to file
; 2. $s_search = string pattern
; 3. Opt = 1 Delete/keep line if matches $s_search
; Opt = 2 Delete/keep line if starts with $s_search
; Opt = 3 Delete/keep line if ends with $s_search
; Opt = 4 Delete/keep line if contains $s_search
; 4. 0 = not case sensitive (default)
; 1 = case sensitive
; 5. $i_count = How many occurrances should be deleted
; 6. $i_TopDown = 0 (default) search --> 1-end
; $i_TopDown = 1 search bottumUp --> end-1
; 7. $h_pathNew = "" file will be overwritten
; $h_pathNew = ... the result is saved in new path
; 8. $i_inEx = 0 delete
; $i_inEx = 1 keep
;
; Requirement(s): #include <File.au3> and #include <Array.au3>
; Return Value(s): 1 success
; -1 file not found
; -2 invalid $opt
; -3 invalid path to write
; Extented = Number of lines matched
; Author(s): th.meger
;
;===============================================================================
;
Func _removeLineInFile($h_path, $s_search, $i_opt = 1, $i_caseSensitive = 0, $i_count = 0, $i_topDown = 0, $h_pathNew = "", $i_inEx = 0)
Local $i_countFound = 0
Local $a_FileOne
Local $a_FileTwo[1]
Local $a_FileThree[1]
If $h_pathNew = "" Then $h_pathNew = $h_path
If $i_count = 0 Then $i_count = -1
If Not _FileReadToArray($h_path, $a_FileOne) Then Return -1
_ArrayDelete($a_FileOne, 0) ; do not need the number
If $i_topDown = 1 Then _ArrayReverse($a_FileOne)
For $i = 0 To UBound($a_FileOne) - 1
If $i_countFound <> $i_count Then
Switch $i_opt
Case 1
If $i_caseSensitive = 1 Then
If $a_FileOne[$i] == $s_search Then
$i_countFound += 1
_ArrayAdd($a_FileThree, $a_FileOne[$i])
Else
_ArrayAdd($a_FileTwo, $a_FileOne[$i])
EndIf
Else
If $a_FileOne[$i] = $s_search Then
$i_countFound += 1
_ArrayAdd($a_FileThree, $a_FileOne[$i])
Else
_ArrayAdd($a_FileTwo, $a_FileOne[$i])
EndIf
EndIf
Case 2
If $i_caseSensitive = 1 Then
If StringLeft($a_FileOne[$i], StringLen($s_search)) == $s_search Then
$i_countFound += 1
_ArrayAdd($a_FileThree, $a_FileOne[$i])
Else
_ArrayAdd($a_FileTwo, $a_FileOne[$i])
EndIf
Else
If StringLeft($a_FileOne[$i], StringLen($s_search)) = $s_search Then
$i_countFound += 1
_ArrayAdd($a_FileThree, $a_FileOne[$i])
Else
_ArrayAdd($a_FileTwo, $a_FileOne[$i])
EndIf
EndIf
Case 3
If $i_caseSensitive = 1 Then
If StringRight($a_FileOne[$i], StringLen($s_search)) == $s_search Then
$i_countFound += 1
_ArrayAdd($a_FileThree, $a_FileOne[$i])
Else
_ArrayAdd($a_FileTwo, $a_FileOne[$i])
EndIf
Else
If StringRight($a_FileOne[$i], StringLen($s_search)) = $s_search Then
$i_countFound += 1
_ArrayAdd($a_FileThree, $a_FileOne[$i])
Else
_ArrayAdd($a_FileTwo, $a_FileOne[$i])
EndIf
EndIf
Case 4
If StringInStr($a_FileOne[$i], $s_search, $i_caseSensitive) = 0 Then
_ArrayAdd($a_FileTwo, $a_FileOne[$i])
Else
$i_countFound += 1
_ArrayAdd($a_FileThree, $a_FileOne[$i])
EndIf
Case Else
Return -2
EndSwitch
Else
If $i_inEx = 0 Then
_ArrayAdd($a_FileTwo, $a_FileOne[$i])
_ArrayAdd($a_FileThree, $a_FileOne[$i])
EndIf
EndIf
Next
_ArrayDelete($a_FileTwo, 0)
_ArrayDelete($a_FileThree, 0)
If $i_topDown = 1 Then
_ArrayReverse($a_FileTwo)
_ArrayReverse($a_FileThree)
EndIf
If $i_inEx = 0 Then
_FileWriteFromArray($h_pathNew, $a_FileTwo)
Else
_FileWriteFromArray($h_pathNew, $a_FileThree)
EndIf
SetExtended($i_countFound)
If @error = 0 Then Return 1
Return -3
EndFunc ;==>_removeLineInFile
Mega
Hi,
bevor du die Datei schreibst, laß sie dir doch mal anzeigen, ob da wirklich eine Leerzeile steht.
Mega