Alexxander Posted January 24, 2014 Share Posted January 24, 2014 hi all im trying to make a script that if it finds msn it hide it and if did not find it it show it i tried this If WinSetState("Windows Live Messenger", "",@SW_SHOW) Then WinSetState("Windows Live Messenger", "",@SW_HIDE ) Else WinSetState("Windows Live Messenger", "",@SW_SHOW ) EndIf when the msn is showed then i run the script it hide it and after it hide it if i re start the script it will not show it any ideas ? Link to comment Share on other sites More sharing options...
water Posted January 24, 2014 Share Posted January 24, 2014 (edited) Shouldn't it beIf WinGetState("Windows Live Messenger") = ... Edited January 24, 2014 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
JohnOne Posted January 24, 2014 Share Posted January 24, 2014 You'll have to store it's last state somewhere, that could be wherever you like. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Alexxander Posted January 24, 2014 Author Share Posted January 24, 2014 (edited) thanks for replay guys i tried this HotKeySet("!x", "msn") Func msn() If WinGetState("Windows Live Messenger", "") = 15 Then WinSetState("Windows Live Messenger", "",@SW_HIDE) If WinGetState("Windows Live Messenger", "") = 5 Then WinSetState("Windows Live Messenger", "",@SW_SHOW) EndFunc While 1 Sleep(1000) WEnd it is working only when i press alt x when msn is active how can i make it hide msn even if i'am using another program ? Edited January 24, 2014 by Alexxander Link to comment Share on other sites More sharing options...
Solution Inverted Posted January 24, 2014 Solution Share Posted January 24, 2014 (edited) $isHidden = False HotKeySet("!x", "msn") Func msn() If $isHidden Then $isHidden = False WinSetState("Calculator", "",@SW_SHOW) Else $isHidden = True WinSetState("Calculator", "",@SW_HIDE) EndIf EndFunc While 1 Sleep(1000) WEnd I tested that with Calculator and it works Maybe you'd also want to do an WinActivate to bring it to front. Edited January 24, 2014 by Inverted Alexxander 1 Link to comment Share on other sites More sharing options...
Alexxander Posted January 24, 2014 Author Share Posted January 24, 2014 $isHidden = False HotKeySet("!x", "msn") Func msn() If $isHidden Then $isHidden = False WinSetState("Calculator", "",@SW_SHOW) Else $isHidden = True WinSetState("Calculator", "",@SW_HIDE) EndIf EndFunc While 1 Sleep(1000) WEnd I tested that with Calculator and it works Maybe you'd also want to do an WinActivate to bring it to front. interesting ... what is $isHidden i searched for it in the help doc i couldn't find it may u explain ? Link to comment Share on other sites More sharing options...
Inverted Posted January 24, 2014 Share Posted January 24, 2014 It's just a variable I created, so I know whether I hid the window or not Link to comment Share on other sites More sharing options...
Alexxander Posted January 24, 2014 Author Share Posted January 24, 2014 It's just a variable I created, so I know whether I hid the window or not " If $isHidden Then..." i thought u must say if $var = something you cant say $var then can u explain sorry i'm a noob Link to comment Share on other sites More sharing options...
JohnOne Posted January 24, 2014 Share Posted January 24, 2014 If the variable has a value of 0 or == 0 then it is false, if it has any other value it is true. It's the same as... If True Then... You don't need if True = True Then... Alexxander 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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