vinnyMS Posted November 5, 2020 Posted November 5, 2020 is it possible to create a script that writes in a text file exactly the text from another text file it has to point at the source text file address the cursor focus has to be on an empty text file window press a key to start writing letter by letter with the same formatting exactly also it could have a writing speed value both source and target text file should be 100% identical when finished
Nine Posted November 5, 2020 Posted November 5, 2020 48 minutes ago, vinnyMS said: is it possible Yes I don't see anything in your requirements that would not be doable in AutoIt. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Multi-Threading Made Easy
caramen Posted November 6, 2020 Posted November 6, 2020 (edited) You could do that copying the file itself or copying the strings inside the file. Both are possible without any problem. You may check these function in the helpfile : FileCopy DirCopy FileRead MouseMove Mouseclick WinActive WinActivate Send ClipPut ClipGet Edited November 6, 2020 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
vinnyMS Posted November 6, 2020 Author Posted November 6, 2020 thank you can someone post a script i can start with?
caramen Posted November 6, 2020 Posted November 6, 2020 (edited) #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.5 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here Give it a try comon ;), then after we will help you. Type any of the function I gave you then you hit the F1 key when you have the cursor on it. And watch what happen. Edited November 6, 2020 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
abberration Posted November 7, 2020 Posted November 7, 2020 I don't know if the parts about writing each letter is a necessity, but if you just want to accomplish the task of creating a 2nd text file with identical text, this will get you started: #include <file.au3> $aText = FileReadToArray("test.txt") Now you need to do is write one line of code (hint: _filewritefromarray). Easy MP3 | Software Installer | Password Manager
vinnyMS Posted November 13, 2020 Author Posted November 13, 2020 I want the script to type everything from the source text file to a new file window letter by letter with a timer of half a second
Nine Posted November 13, 2020 Posted November 13, 2020 You truly need to make your "wantings" clearer. Maybe it seems to you that it is obvious, but it is not for us. If you want some help (and you will get I assure you), provide an example of the input and the expected output. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Multi-Threading Made Easy
pseakins Posted November 14, 2020 Posted November 14, 2020 (edited) 5 hours ago, vinnyMS said: I want the script to type everything from the source text file to a new file window What do you mean by "new file window"? That's not a thing. It sounds like you may be automating a game or something, where the keystrokes are defined in the input file and the chars are injected into the game one at a time. Is that what you are doing? Or do you want the text from the source file to be typed into perhaps a Notepad window, to make it look as though someone was typing it out slowly? Edited November 14, 2020 by pseakins typo Phil Seakins
vinnyMS Posted November 14, 2020 Author Posted November 14, 2020 i want the text from the source file to be typed into a notepad window i want to record the screen while the autoit program types on a notepad window
pseakins Posted November 15, 2020 Posted November 15, 2020 5 hours ago, vinnyMS said: i want the text from the source file to be typed into a notepad window We are not supposed to write scripts for you, you are supposed to figure it out for yourself and then we help when you get stuck. But this will help you get started, It is taken in part from the Notepad automation tutorial in the Scite help. Copy this example into your Scite editor and then save it, giving it a suitable name. Then just press F5. This example uses itself as the source file and copies it character by character into a Notepad window. Whether you save the file and/or run screen capture is up to you. $iDelay = 10 ; number of milliseconds to pause between characters MsgBox(0, "", "Click ok when ready") Run("notepad.exe") WinWaitActive("Untitled - Notepad") Sleep(5000) ; allow operator time to start the capturing process $hFile = FileOpen(@ScriptDir & "\" & @ScriptName) $x = FileReadLine($hFile) While Not @error For $i = 1 To StringLen($x) Send(StringMid($x, $i, 1)) Sleep($iDelay) Next Send(@CR) $x = FileReadLine($hFile) WEnd FileClose($hFile) WinClose("Untitled - Notepad") JockoDundee 1 Phil Seakins
JockoDundee Posted November 15, 2020 Posted November 15, 2020 50 minutes ago, pseakins said: Copy this example into your Scite editor and then save it, giving it a suitable name. Nice work.! Actually kinda cool to watch. One thing for the OP to be careful of since he says: On 11/5/2020 at 8:28 AM, vinnyMS said: both source and target text file should be 100% identical when finished is the encoding of the file when saving in notepad. Source files, as one example, saved in Scite may be encoded UTF-8 with BOM. Which is not the default in Notepad. pseakins 1 Code hard, but don’t hard code...
vinnyMS Posted November 16, 2020 Author Posted November 16, 2020 thanks a lot for some reason the "+" sign cannot be typed
pseakins Posted November 16, 2020 Posted November 16, 2020 1 hour ago, vinnyMS said: for some reason the "+" sign cannot be typed My bad. Try again with this. $iDelay = 10 ; number of milliseconds to pause between characters $iLineDelay = 100 ; number of milliseconds to pause between lines MsgBox(0, "", "Click ok when ready") Run("notepad.exe") WinWaitActive("Untitled - Notepad") Sleep(5000) ; allow operator time to start the capturing process $hFile = FileOpen(@ScriptDir & "\" & @ScriptName) $x = FileReadLine($hFile) While Not @error For $i = 1 To StringLen($x) Send(StringMid($x, $i, 1), 1) Sleep($iDelay) Next Send(@CR) Sleep($iLineDelay) $x = FileReadLine($hFile) WEnd FileClose($hFile) WinClose("Untitled - Notepad") Phil Seakins
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now