Scorpys Posted January 7, 2020 Posted January 7, 2020 I have an AutoIT script, here it is: expandcollapse popup$SEARCH_TERM = 'Pinterest'; $DELAY = 1000; in ms, delay between searches for Pinterest. It can be reduced, but best to not overdo it. $prevWins = WinList("[CLASS:MozillaWindowClass]"); While (True) search(); Sleep($DELAY); WEnd Func getPreviousTitleFromHandle($hnd) For $i=1 To $prevWins[0][0] $title = $prevWins[$i][0]; $handle = $prevWins[$i][1]; If ($handle == $hnd) Then Return $title; EndIf Next Return ""; EndFunc Func search() $wins = WinList("[CLASS:MozillaWindowClass]"); For $i=1 To $wins[0][0] ; get window title $title = $wins[$i][0]; If (StringInStr($title, $SEARCH_TERM) <> 0) Then $handle = $wins[$i][1]; ; found pinterest mozilla window ;ConsoleWrite('FOUND! ' & $title & @CRLF); $prevTitle = getPreviousTitleFromHandle($handle); If (StringInStr($prevTitle, $SEARCH_TERM) == 0) Then ; previous title doesn't have Pinterest - means navigation took place WinActivate($handle); $prevWins = $wins; Return; EndIf EndIf Next $prevWins = $wins; EndFunc So I use this script for something, and I also have an AutoHotKey script for something else. And when the Autohotkey script executes it does the following: - Closes AutoIT script - Does some actions - Opens AutoIT script The problem I have is that every time this takes place (over 24 times per day) the AutoIT icon in the taskbar doesn't disappear. See photo - https://i.imgur.com/YaRfe5X.jpg To make the icons go away all I have to do is hover with my mouse on top of them, and they will all go away except the 1 for the script that is currently active. The person that created me the Autohotkey script told me that I have to edit my AutoIT script and make it not leave an icon in the taskbar if it's closed/opened by a different program. But I don't know how to do that. Can anyone help? Thanks
Danyfirex Posted January 7, 2020 Posted January 7, 2020 Hello, Add #NoTrayIcon on top of your script. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Scorpys Posted January 7, 2020 Author Posted January 7, 2020 Hey Danyfirex, thanks for responding. I tried it, but I don't want an icon to not appear in the tray at all. I still want the icon there, so that I can pause it and close it when I have to. I just don't want the icon to keep doubling up and piling up there (like in the screenshot I shared in my original post) every time the script is closed and opened by my other autohotkeyscript.
alienclone Posted January 8, 2020 Posted January 8, 2020 there are scripts for refreshing the tool tray to remove orphaned icons, i have used some in the past that worked but dont remember which one i used. here is a post containing what you need, i dont know if this one will work for you but it can steer you in the right direction of what to search for. https://www.autoitscript.com/forum/topic/94447-_refreshtrayicons-_refreshnotificationareaicons-udf-tray-icons-refresh-redux/ If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version
Scorpys Posted January 8, 2020 Author Posted January 8, 2020 Hey Alienclone, thanks for answering. Oh that all looks quite complicated. I'm not a programmer really, so I'm not really good with all the code stuff. What I'm actually looking to do is implement something either in my existing AutoIT script or my existing AutoHotKey script. I'd rather not have to use a 3rd script only for this. I wait either for AutoIT to force remove inactive tray icons, or for Autohotkey to shut down the AutoIT script in such a way to where it removes the inactive tray icon. You think that's possible?
argumentum Posted January 8, 2020 Posted January 8, 2020 18 hours ago, Scorpys said: So I use this script for something, and I also have an AutoHotKey script for something else. And when the Autohotkey script executes it does the following: - Closes AutoIT script You should do it all within AutoIt. The hotkey killing the PIDs is creating those "left overs". Do not kill PIDs, exit as you should. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Nine Posted January 8, 2020 Posted January 8, 2020 (edited) Here one way to achieve it without outside tool : #NoTrayIcon Opt("MustDeclareVars", 1) Global Const $AUTO_OFF = 10 ; auto hide tray icon in secs Global $hTimer, $bShow = False HotKeySet ("!0", ToggleShowTray) While True Sleep (100) If $bShow And TimerDiff ($hTimer) > $AUTO_OFF*1000 Then ToggleShowTray () WEnd Func ToggleShowTray () $bShow = Not $bShow If $bShow Then Opt("TrayIconHide", 0) $hTimer = TimerInit () Else Opt("TrayIconHide", 1) $hTimer = 0 EndIf EndFunc The hot key toggle the tray icon. I also included an auto hide timer, in case user forgets to hide it. When shown, you can exit normally... Edited January 8, 2020 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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Scorpys Posted January 8, 2020 Author Posted January 8, 2020 Guys thank you so much for your replies, I really appreciate it It just so happens I asked the guy that created me the Autohotkey script if he can do something about it, and he did a different way of restarting the AutoIT script, and now the problem is no more. Of course, I'm still testing, so if the problem persists I'll be back to try out the solution mentioned - Nine. Thanks again
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