CarstenThorsen Posted October 4, 2019 Posted October 4, 2019 Hi. First: I am not a "script guy" but i think we can get great use of a script i have found. The script auto closes a program if it is unsued for x seconds. I have 2 challenges: 1: Is there a way to hide the counter in the upper left corner ? 2: I want to use the script on our Navision.If the user have levt NAV while they have clicked deep into something, NAV says that you have to close whatever you have clicked into - and not close NAV. That is fine for me.But the script keeps running, and every second a window will appear telling that something is open and working.I just want that message to appear 1 time, and not every second.Every second leaves thousands of messages i.e. if the user is in a meeting The script as it is at the moment is: Opt("WinTitleMatchMode", 2) ;2 = any substring Opt("TrayIconDebug", 1) $S_running = "check-4-app" ;name the script If WinExists($S_running) Then Exit AutoItWinSetTitle($S_running) $title = "Dansk Auto logik Drift - Microsoft Dynamics NAV Classic" $count = 0 While 1 $state = WinGetState($title) $count += 1 If $state = 15 Or $state = 47 Or $state = 0 Then $count = 0 If $count > 10 Then WinClose($title) ToolTip("count = " & $count, 0, 0, "state = " & $state) Sleep(1000) WEnd
BrewManNH Posted October 4, 2019 Posted October 4, 2019 First things first, you shouldn't run any script unless you're pretty sure what each of the commands in it do. You appear to have limited to no knowledge of AutoIt, so I'll help you out. The tool tip function is what's creating the display of the count in the corner. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
Nine Posted October 4, 2019 Posted October 4, 2019 As for your second issue, you could introduce a boolean that check if the WinClose as been attempted. Try to write it down, and let us know how it goes... “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
CarstenThorsen Posted October 4, 2019 Author Posted October 4, 2019 Thank you BrewManNH and Nine for your answers. You are correct BrewManNH - my programming skills are closer to "none" than to "limited" 🙂 If i shoud take a wild guess of how the script should sound for the functions i request to work, it would be something like: ToolTip("count = " & $count, 0, 0, "state = " & $state,hide) And my wild guess for the script to stop counting if the stop window is there would be: If $count = 10 Then WinClose($title) I changed the > sign to = I guess if the count is 11 or higher then it will not try to close - only at 10
Nine Posted October 4, 2019 Posted October 4, 2019 Or you could simply remove the line ToolTip And you idea of changing > to = is perfect, good job... “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
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