emendelson Posted November 8, 2019 Posted November 8, 2019 (edited) This question has come up in various ways before, but I can't find a solution, and I'm not sure there is one. I'm trying to use ControlSend to enter a file path in a Windows File/Save dialog box. The plain Send command works perfectly to enter the file path, but I want to hide the application window that I'm sending the file path to, and I think that only ControlSend will work in that situation - as well as being generally more reliable. What happens is that a path like F:\path\to\myfile gets entered as something like F;\path|tO\myfiLe - with some of the characters that I want to paste replaced with the opposite-case character on the keyboard. For example, the colon becomes a semi-colon and the backslash becomes a vertical. (This is effectively the same thing that was described in an earlier post about Czech letters appearing instead of the intended characters.) I've tried turning on the raw-characters option; that doesn't help. I've tried putting the path in the Clipboard and then, in ControlSend, using ClipGet() instead of the variable that contains the string. The clipboard method seems to improve things a bit, but I still end up with a semi-colon and not a colon after the drive letter. Is there any reliable way to get around this problem? I'm running Windows 10 and trying to enter text in the File/Save box in Softmaker's free TextMaker word-processor. Thanks for any help. Edited November 8, 2019 by emendelson Clarification.
Nine Posted November 8, 2019 Posted November 8, 2019 (edited) I have seen that before, it seems that if you are using keyboard or mouse while script is running, ControlSend can get mixed up. The solution that was suggested is to use my UDF, before and after the ControlSend to block all input before and re-enable input after. and @BigDaddyO also made a secure control send... Edited November 8, 2019 by Nine “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
emendelson Posted November 8, 2019 Author Posted November 8, 2019 Thank you for this - but, but unfortunately, your UDF and @BiggDaddyO's _ControlSendSecure don't seem to solve the problem. In each case, I get this: I know I'm not using the mouse or keyboard while the script runs. I wonder if there's something else going on that's getting in the way?
Nine Posted November 8, 2019 Posted November 8, 2019 Is it always the same chars that are converted, or is it randomly distributed ? “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
emendelson Posted November 8, 2019 Author Posted November 8, 2019 (edited) I think the only characters that get converted are the colon (converted to a semi-colon) and the backslash (converted to a vertical). But as you see from the image, this only happens randomly. Sometimes the colon doesn't get converted; only one or two backslashes get converted. Might it be possible to parse the file string and replace the colon and backslashes with specific ASCII characters? (If so, I don't know the best way to do that.) I can live with changes to the case of the ASCII characters, though of course I would prefer not to. Maybe the best thing would be to convert the whole string into a series of Chr(##) codes? Edited November 8, 2019 by emendelson
seadoggie01 Posted November 8, 2019 Posted November 8, 2019 If this is just a Save as window, you could use ControlSetText instead, right? I don't think that actually simulates typing with the keyboard emendelson and Musashi 2 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
emendelson Posted November 8, 2019 Author Posted November 8, 2019 4 minutes ago, seadoggie01 said: If this is just a Save as window, you could use ControlSetText instead, right? I don't think that actually simulates typing with the keyboard Brilliant! This is a pure case of user-ignorance on my part. That works perfectly, and I should have realized that it would work... seadoggie01 1
seadoggie01 Posted November 8, 2019 Posted November 8, 2019 You still probably want to look into what is causing those random capitalizations, but at least you can move past this for now All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
Stilgar Posted November 9, 2019 Posted November 9, 2019 Hi,you can take a look at my UDF for Planmaker: PlanMaker-UDF I think you can rebuild something for TextMaker. e.g. _PlanMaker_BookAttach _PlanMaker_BookSaveAs greetings Stilgar jEdit4AutoIt PlanMaker_UDF
emendelson Posted November 9, 2019 Author Posted November 9, 2019 Stilgar, This is really, really impressive. I will see if I can start by building a reduced version for TextMaker that performs only SaveAs. Thank you.
emendelson Posted November 9, 2019 Author Posted November 9, 2019 (edited) Post deleted. I partly figured out the answer... Edited November 10, 2019 by emendelson
jchd Posted November 10, 2019 Posted November 10, 2019 17 hours ago, emendelson said: I figured out the answer... Which is? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
emendelson Posted November 10, 2019 Author Posted November 10, 2019 51 minutes ago, jchd said: Which is? I should have said I partly figured out a solution - I've modified some of Stilgar's UDF simply by replacing the Open and SaveAs commands by equivalents from the TextMaker language, but I can't get the SaveAs to save consistently in the correct format and I can't get it actually to save the file instead of opening the File/Save dialog with the filename and (sometimes) the correct format. I'll continue to work on this and post any solution that seems to work.
emendelson Posted November 10, 2019 Author Posted November 10, 2019 (edited) I figured out the question I should ask to solve this problem, which is how to get TextMaker to save changes without prompting. I've asked the question as an issue on Stilgar's Github page. Edited November 10, 2019 by emendelson
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