Jump to content

vin1

Active Members
  • Posts

    34
  • Joined

  • Last visited

vin1's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. i have a script that selects a text file and deletes a line (text input required) in the text file selected i have to make it remove all lines found on a file i name, toRemoveLines.txt it has to remove lines from all text files found in a folder this is the script that has to be modified where it says "select file" it has to be "select folder" where it says "line text input" it has to be all lines from a text file #Include <File.au3> Global $success = False $file_name = FileOpenDialog("Select file", @ScriptDir, "All files (*.*)", 1+4) $line_text_input = InputBox("Line's text", "Line must contain following text:", "line contains this text") $file_count_lines = _FileCountLines($file_name) for $i = 0 to $file_count_lines $Lines_text_output = FileReadLine($file_name, $i) if StringInStr($Lines_text_output, $line_text_input) then _FileWriteToLine($file_name, $i, "", 1) $success = True ExitLoop EndIf Next if $success = True Then MsgBox(0, "Success", "Line has been deleted") Else MsgBox(0, "Failure", "Line wasn't found") EndIf
  2. gives a 0 as the only result
  3. i have a script that let you type text then give a random result on an output box, writes the result on a text file and tries to add the result text to an edit box but doesn't support multiple lines. I want the script to add lines of results on the edit box (as a log of results) #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <File.au3> #include <Date.au3> Global $result1s[3]=["one", "two", "three"] _Main() Func _Main() Local $button1 Local $output, $die, $msg, $results1 Local $file = FileOpen("test.txt", 1) Local $g_idEdit GUICreate("test", 600, 400, -1, -1) $button1 = GUICtrlCreateButton("Result", 432, 350, 80, 40) $sText = $results1 $edit = GUICtrlCreateEdit($sText & @CRLF & $sText & @CRLF & $sText, 60, 50, 450, 300, BitOr($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) $output1 = GUICtrlCreateInput("", 60, 30, 450, 20, BitOR($ES_CENTER, $ES_READONLY)) $g_idEdit = GUICtrlCreateEdit("", 60, 10, 450, 20, $SS_LEFT) $die = GUICtrlCreateLabel("", 700, 500, 700, 20, $SS_SUNKEN) GUICtrlSetFont($output, 8, 800, "", "Verdana") GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $button1 $results1 = Random(1, 2, 1) GUICtrlSetData($output1, $result1s[$results1]) GUICtrlSetData($edit, $result1s[$results1]) $read1 = GUICtrlRead($output1) FileWriteLine($file, _NowDate()& " " & _nowTime() & " " &GUICtrlRead($g_idEdit)) FileWriteLine($file, _NowDate()& " " & _nowTime() & " " &$read1) EndSelect If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>_Main
  4. I'll use it to rewrite articles from online websites. I'll try to create a rephrase version that rearranges text differently than the source text please help if possible
  5. i need a script that can replace words in text with other words from a words list it has to have 2 edit boxes input/output and a button "run" from word_list.txt it choses which word to replace with. words are separated with commas for multiple choice ; AutoIt GUI Example ; Created: 17/01/2005 - CyberSlug ; Modifed: 05/12/2011 - guinness ; Modifed: 09/06/2014 - mLipok #Region INCLUDE #include <AVIConstants.au3> #include <GuiConstantsEx.au3> #include <TreeViewConstants.au3> #EndRegion INCLUDE #Region GUI GUICreate("Sample GUI", 400, 420) GUISetIcon(@SystemDir & "\mspaint.exe", 0) #EndRegion GUI #Region EDIT GUICtrlCreateEdit(@CRLF & " Sample Edit Control", 10, 10, 380, 175) GUICtrlSetTip(-1, '#Region EDIT') #EndRegion EDIT #Region EDIT2 GUICtrlCreateEdit(@CRLF & " Sample Edit Control", 10, 185, 380, 175) GUICtrlSetTip(-1, '#Region EDIT') #EndRegion EDIT2 #Region BUTTON GUICtrlCreateButton("Sample Button", 10, 360, 100, 30) GUICtrlSetTip(-1, '#Region BUTTON') #EndRegion BUTTON #Region GUI MESSAGE LOOP GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete() #EndRegion GUI MESSAGE LOOP
  6. I have this script that gives an error, how to fix it? #include <File.au3> $file = @DesktopDir & "\temp.txt" $file_output = @DesktopDir & "\output.txt" Local $array[1] _FileReadToArray($file, $array) $hOutput = FileOpen($file_output, 2) $iMultiplier = 3 Global $aTemp, $Text For $i = 1 To $array[0] $aTemp = StringSplit($array[$i], @TAB) If Not Mod($i, 50) Then $iMultiplier += 1 $text = "" For $j = 1 To $aTemp[0] $text &= $aTemp[$j] * $iMultiplier & @TAB Next $text = StringTrimRight($text, 1) FileWriteLine($hOutput, $text) Next FileClose($hOutput)
  7. thanks a lot, it works
  8. #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <File.au3> #include <Date.au3> Global $result1s[19]=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] Global $result2s[19]=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] Global $result3s[19]=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] Global $result4s[19]=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] _Main() Func _Main() Local $button1 Local $output, $die, $msg, $results1, $results2, $results3, $results1 Local $file = FileOpen("test.txt", 1) GUICreate("test", 600, 200, -1, -1) $button1 = GUICtrlCreateButton("Result", 460, 110, 50, 30) $output1 = GUICtrlCreateInput("", 60, 10, 450, 20, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlCreateLabel("1", 5, 12) $output2 = GUICtrlCreateInput("", 60, 30, 450, 20, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlCreateLabel("2", 5, 32) $output3 = GUICtrlCreateInput("", 60, 50, 450, 20, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlCreateLabel("3", 5, 52) $output4 = GUICtrlCreateInput("", 60, 70, 450, 20, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlCreateLabel("4", 5, 72) GUICtrlCreateInput("Sample Input Box", 60, 90, 450, 20) $die = GUICtrlCreateLabel("", 700, 500, 700, 20, $SS_SUNKEN) GUICtrlSetFont($output, 8, 800, "", "Verdana") GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $button1 $results1 = Random(1, 19, 1) GUICtrlSetData($output1, $result1s[$results1-1]) $read1 = GUICtrlRead($output1) $results2 = Random(1, 19, 1) GUICtrlSetData($output2, $result2s[$results2-1]) $read2 = GUICtrlRead($output2) $results3 = Random(1, 19, 1) GUICtrlSetData($output3, $result3s[$results3-1]) $read3 = GUIctrlRead($output3) $results4 = Random(1, 19, 1) GUICtrlSetData($output4, $result4s[$results4-1]) $read4 = GUICtrlRead($output4) FileWriteLine($file, _NowDate()& " " & _nowTime() & " " $read1) FileWriteLine($file, _NowDate()& " " & _nowTime() & " " $read2) FileWriteLine($file, _NowDate()& " " & _nowTime() & " " $read3) FileWriteLine($file, _NowDate()& " " & _nowTime() & " " $read4) FileClose($file) EndSelect If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>_Main I want the code to write to the text file so the contents look like this (like in the first post): 01/02/2016 02:15:30: Sample Input Box 01/02/2016 02:15:30: 6 01/02/2016 02:15:30: 4 01/02/2016 02:15:30: 4 01/02/2016 02:15:30: 15
  9. _NowDate gives an error, "Error in expression"
  10. how to add a date stamp to it for every line of $read#
  11. how to instead of FileWriteLine($file, "text") make FileWriteLine($file, $read1) work
  12. I added some code but I get an empty text file #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <File.au3> Global $result1s[19]=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] Global $result2s[19]=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] Global $result3s[19]=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] Global $result4s[19]=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] _Main() Func _Main() Local $button1 Local $output, $die, $msg, $results1, $results2, $results3, $results1 Local $file = FileOpen("test.txt", 1) GUICreate("test", 600, 200, -1, -1) $button1 = GUICtrlCreateButton("Result", 150, 150, 50, 30) $output1 = GUICtrlCreateInput("", 60, 10, 450, 20, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlCreateLabel("1", 5, 12) $output2 = GUICtrlCreateInput("", 60, 30, 450, 20, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlCreateLabel("2", 5, 32) $output3 = GUICtrlCreateInput("", 60, 50, 450, 20, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlCreateLabel("3", 5, 52) $output4 = GUICtrlCreateInput("", 60, 70, 450, 20, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlCreateLabel("4", 5, 72) GUICtrlCreateInput("Sample Input Box", 60, 90, 450, 20) $read1 = GUICtrlRead($output1) $read2 = GUICtrlRead($output2) $read3 = GUICtrlRead($output3) $read4 = GUICtrlRead($output4) $die = GUICtrlCreateLabel("", 700, 500, 700, 20, $SS_SUNKEN) GUICtrlSetFont($output, 8, 800, "", "Verdana") GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $button1 $results1 = Random(1, 19, 1) GUICtrlSetData($output1, $result1s[$results1-1]) $results2 = Random(1, 19, 1) GUICtrlSetData($output2, $result2s[$results2-1]) $results3 = Random(1, 19, 1) GUICtrlSetData($output3, $result3s[$results3-1]) $results4 = Random(1, 19, 1) GUICtrlSetData($output4, $result4s[$results4-1]) FileWriteLine($file, $read1) FileWriteLine($file, $read2) FileWriteLine($file, $read3) FileWriteLine($file, $read4) EndSelect If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>_Main how to make it work? thanks again in advance
  13. I have a script that gives 4 results at a time through output boxes. I want to write the results to a text file with time stamp and text from a fifth input box this should be written in the text file from the example screenshot 01/02/2016 02:15:30: Sample Input Box 01/02/2016 02:15:30: 6 01/02/2016 02:15:30: 4 01/02/2016 02:15:30: 4 01/02/2016 02:15:30: 15 this is the script #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <StaticConstants.au3> Global $result1s[19]=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] Global $result2s[19]=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] Global $result3s[19]=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] Global $result4s[19]=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] _Main() Func _Main() Local $button1 Local $output, $die, $msg, $results1, $results2, $results3, $results1 GUICreate("test", 600, 200, -1, -1) $button1 = GUICtrlCreateButton("Result", 150, 150, 50, 30) $output1 = GUICtrlCreateInput("", 60, 10, 450, 20, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlCreateLabel("1", 5, 12) $output2 = GUICtrlCreateInput("", 60, 30, 450, 20, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlCreateLabel("2", 5, 32) $output3 = GUICtrlCreateInput("", 60, 50, 450, 20, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlCreateLabel("3", 5, 52) $output4 = GUICtrlCreateInput("", 60, 70, 450, 20, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlCreateLabel("4", 5, 72) GUICtrlCreateInput("Sample Input Box", 60, 90, 450, 20) $die = GUICtrlCreateLabel("", 700, 500, 700, 20, $SS_SUNKEN) GUICtrlSetFont($output, 8, 800, "", "Verdana") GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $button1 $results1 = Random(1, 19, 1) GUICtrlSetData($output1, $result1s[$results1-1]) $results2 = Random(1, 19, 1) GUICtrlSetData($output2, $result2s[$results2-1]) $results3 = Random(1, 19, 1) GUICtrlSetData($output3, $result3s[$results3-1]) $results4 = Random(1, 19, 1) GUICtrlSetData($output4, $result4s[$results4-1]) EndSelect If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>_Main thanks a lot in advance
  14. i have to copy and paste but paste different every time 1st paste Click, 221, 140 Left, Down Sleep, 141 Click, 221, 140 Left, Up Sleep, 2328 Send, {Down} Sleep, 500 Send, {Enter} 2nd paste Click, 221, 140 Left, Down Sleep, 141 Click, 221, 140 Left, Up Sleep, 2328 Send, {Down} Sleep, 500 Send, {Down} Sleep, 500 Send, {Enter} every time i paste i have to add 1 more Send, {Down} Sleep, 500 to what i paste
  15. how to open port 7000 with autoit even behind a router?
×
×
  • Create New...