newbieauuser Posted April 30, 2019 Share Posted April 30, 2019 Hi all! Im newbie and get some problem with my code. I need to send text to the program. Tried to send using "send" and "controlsend", but they do not work in it. It was possible to send only with "DllCall", but it was not without problems. The problem is that the text is sent incorrectly. Here is my test code: #include <Array.au3> $StringToSplit = "AZ _TEX UNV-T" $Split = StringSplit($StringToSplit, "", 2) Run("notepad.exe") Sleep(1000) Global Const $KEYEVENTF_EXTENDEDKEY = 0x0001 Global Const $KEYEVENTF_KEYUP = 0x0002 For $i = 0 To UBound($Split) -1 Sleep(100) DllCall('user32.dll', 'Int', 'keybd_event', 'byte', StringToBinary(StringUpper($Split[$i])), 'dword', '0x45' , 'dword', 0x0, 'int', 0) Sleep(100) DllCall('user32.dll', 'Int', 'keybd_event', 'byte', StringToBinary(StringUpper($Split[$i])), 'dword', '0x45' , 'dword', $KEYEVENTF_KEYUP, 'int', 0) Next What i want to get: AZ _TEX UNV-T What i get: az tex unvt Link to comment Share on other sites More sharing options...
ajag Posted April 30, 2019 Share Posted April 30, 2019 Why "Send" did not Work for you? This does what you want: #include <Array.au3> Local $StringToSplit = "AZ _TEX UNV-T" Local $Split = StringSplit($StringToSplit, "", 2) Run("notepad.exe") Sleep(1000) For $i = 0 To UBound($Split) -1 Send($Split[$i]) Next Starts notepad and writes "AZ _TEX UNV-T" Or do I miss something? Rule #1: Always do a backup Rule #2: Always do a backup (backup of rule #1) Link to comment Share on other sites More sharing options...
Nine Posted April 30, 2019 Share Posted April 30, 2019 46 minutes ago, newbieauuser said: What i want to get: AZ _TEX UNV-T What i get: az tex unvt It is normal that you get that because you are sending Vitual-Key Codes not characters. Look at this list you will understand what is your problem... “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
newbieauuser Posted April 30, 2019 Author Share Posted April 30, 2019 27 minutes ago, Nine said: It is normal that you get that because you are sending Vitual-Key Codes not characters. Look at this list you will understand what is your problem... Thank! Can you please advise an alternative to "DllCall"? The program for which I am writing code is not a notebook. In a notebook, I'm just testing. Link to comment Share on other sites More sharing options...
Nine Posted April 30, 2019 Share Posted April 30, 2019 3 minutes ago, newbieauuser said: Can you please advise an alternative to "DllCall"? Depends on the program you want to send text to, on what kind of controls there is, etc...Sorry but crystal ball is at repair shop. “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
newbieauuser Posted April 30, 2019 Author Share Posted April 30, 2019 51 minutes ago, Nine said: Depends on the program you want to send text to, on what kind of controls there is, etc...Sorry but crystal ball is at repair shop. The program for the office, specific and private. "send" and "controlsend" work in it incorrectly. The only thing that worked in it is "DllCall", but also such a problem ... I will try now to explain the problem associated with the "send" and "controlsend". When I try to send text with them, it just turns on and off "CapsLock". In the code there is no manipulation with "CapsLock", the text is simply not sent. I tried the trick with "space", it did not help either. Link to comment Share on other sites More sharing options...
Nine Posted April 30, 2019 Share Posted April 30, 2019 23 minutes ago, newbieauuser said: The program for the office, specific and private. Ask the software company (or the programmers), they should know... “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
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