craydox Posted January 23, 2023 Posted January 23, 2023 (edited) Textfile looks like this: --------------------------------------------------------------------- blah blah blah blah blah blah ! ! blah blah blah blah blah blah ! ! blah blah blah blah blah blah ---------------------------------------------------------------------- I read all above from the textfile to a variable when i use the send command it looks like this: ----------------------------------------------------------------------- blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah ------------------------------------------------------------------------------ I guess the send command thinks this is starting of a keycombo like: HotKeySet("+!d", "HotKeyPressed") ; Shift-Alt-d but no letter follows the ! and therefor just sends a blank line.. does anyone know how I can make it send exclamation marks instead of blanks Edited January 23, 2023 by craydox pushed wrong button
ioa747 Posted January 23, 2023 Posted January 23, 2023 If you don't show us the script How can we help? I know that I know nothing
water Posted January 23, 2023 Posted January 23, 2023 Please have a look at the help file for the Send statement. You will see how to send the exclamation mark. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
AutoBert Posted January 23, 2023 Posted January 23, 2023 The title confuses me. But see: FileRead ;for reading file The rest needs more information.
craydox Posted January 23, 2023 Author Posted January 23, 2023 wow this forum is super alive. I felt all alone in the world using autoit nowdays. I'll read more about the Send statement
craydox Posted January 24, 2023 Author Posted January 24, 2023 OK. found out: send($filen,1) <----last flag is for sendraw so now I se the exclamation marks being sent. but Im getting some kind of hidden LF, (I get an extra blank line of everyline it sends I guess I have to check notepad textfile if it puts somekind of extra Linefeed sign in the background wich Fileread picks up. ------------------------------------------------ Switch blah blah blah ! ! Switch blah blah blah ! ! Switch blah blah blah -------------------------------------------------- Becomes this below (with extra linefeed I guess the textfile is made in notepad should be pure ASCI?!? ------------------------------------------------ Switch blah blah blah ! ! Switch blah blah blah ! ! Switch blah blah blah -------------------------------------------------- Anyone encountered the same problem?
Nine Posted January 24, 2023 Posted January 24, 2023 Instead of using Send() function, you could directly set the text into Notepad with ControlSetText(). Please provide a runable example of what you are doing for us to understand your issue (See how to post code). “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 Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
craydox Posted January 24, 2023 Author Posted January 24, 2023 (edited) Im trying to find where to add my my code in this thread. Cant use ControlSetText() thats too fast I think.. I have to make it send with 7-20ms delay between character ok Added the code as attached files and pasted directly in this reply: expandcollapse popup#cs ################################################################################### ;.txt file is the source to be sent goal is to press ALT+1 then it's supposed to send the exact text from the textfile but it keeps doing extra blank lines for every line #ce #################################################################################### hotkeyset("^1", "copy1") hotkeyset("^2", "copy2") hotkeyset("^3", "copy3") hotkeyset("^4", "copy4") hotkeyset("^5", "copy5") hotkeyset("^6", "copy6") hotkeyset("^7", "copy7") hotkeyset("^8", "copy8") hotkeyset("^9", "copy9") hotkeyset("^0", "copy0") HotKeySet("!1", "paste1") HotKeySet("!2", "paste2") HotKeySet("!3", "paste3") HotKeySet("!4", "paste4") HotKeySet("!5", "paste5") HotKeySet("!6", "paste6") HotKeySet("!7", "paste7") HotKeySet("!8", "paste8") HotKeySet("!9", "paste9") HotKeySet("!0", "paste0") HotKeySet("!{esc}", "terminate" ) ;ALT+ESC QUITTAR!!! Global $lagg = 1000 $laggsend = 17 Opt('SendKeyDelay', $laggsend); default 5. higher number = slower ;Global $t[10] $filen = "apan" $hFileOpen = FileOpen(@WorkingDir & "\" & "switchconfig_01.txt", 0) $filen = FileRead($hFileOpen) FileClose($hFileOpen) MsgBox(0,"titel","test: " & $filen) ;---------------------COPY SEKTIONEN-------------------------------------------------------------- ;(Not in use just for testing) func copy1() Send("^c") ;KOPPAR markerad text till clipboard sleep(500) ;för att skiten skall hinna in i clipboard $filen = ClipGet () EndFunc ;----------PASTE sektionen-------------------------------------------------------------------------------- func paste1() ClipPut ($filen) sleep($lagg) ;Send("^v") send($filen,1) ;<---sista flaggen är 1 då är det send RAW vilket get ! rätt men verkar gömma sig en LF som ger extra line-blanks istället EndFunc While 1 wend func terminate() Exit 0 ;stänger ner allt EndFunc switchconfig_01.txt Test_sending_slow_33.au3 Edited January 25, 2023 by craydox put the code in the right place
mikell Posted January 24, 2023 Posted January 24, 2023 Did you even read the 'post code' link @Nine provided ?
Nine Posted January 24, 2023 Posted January 24, 2023 First thing read carefully how to post code correctly. Your problem is that your $filen contains @CRLF which Notepad interprets as 2 {Enter}. You would need to replace all @CRLF with simple @CR (see StringReplace in help file) “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 Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
ioa747 Posted January 24, 2023 Posted January 24, 2023 22 hours ago, ioa747 said: neither mine I know that I know nothing
craydox Posted January 25, 2023 Author Posted January 25, 2023 Yay! Fixed the problem with this line: $filen = StringStripCR ($filenFIX) It paste exactly as the textfile looks. Thank you guys!!!
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