Burgaud Posted August 31, 2020 Share Posted August 31, 2020 I have this code: if WinExists("[Title:notes.csv - Notepad]") then . . . sleep(1000) ;ProcessClose( "notepad.exe" ) WinClose("[Title:notes.csv - Notepad]") WinKill("[Title:notes.csv - Notepad]") endif Why WinClose, WinKill not reliable in closing the specified notepad? Only ProcessClose was reliable in closing notepad all the time? I dont want to use ProcessClose because, it will close "other" notepads. I only want to close the notepad that had the notes.csv file opened.. Link to comment Share on other sites More sharing options...
TheXman Posted August 31, 2020 Share Posted August 31, 2020 (edited) What OS are you running this on? If it is Win10, one possible reason that particular method of identifying the window might fail, is that the title in Notepad will include an asterisk (*) when the file is modified. This doesn't happen on Win7. One way to be able to have it work regardless of the OS, is to use RegExpTitle to look for a partial match or use "Opt('WinTitleMatchMode', -2)", which will look for a case-insensitive substring match. Look at the help file to see how each is implemented. If you opened notepad in your script, then the most reliable way of identifying the window is to use its handle. Edited August 31, 2020 by TheXman Earthshine 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Burgaud Posted September 3, 2020 Author Share Posted September 3, 2020 I added #RequireAdmin and everything worked... Does it mean WinKill, WinClose requires Admin, but ProcessClose does not? Link to comment Share on other sites More sharing options...
Nine Posted September 3, 2020 Share Posted September 3, 2020 Is it really Notepad ? Because, it shouldn't be necessary to use #RequireAdmin with it unless Notepad is launch with different credentials. “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