Sign in to follow this  
Followers 0
Alexxander

if , else problem

9 posts in this topic

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 ?


Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Shouldn't it be

If WinGetState("Windows Live Messenger") = ...
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by Alexxander

Share this post


Link to post
Share on other sites

#5 ·  Posted (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  :bye:

Maybe you'd also want to do an WinActivate to bring it to front.

Edited by Inverted
1 person likes this

Share this post


Link to post
Share on other sites
$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  :bye:

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 ?


Share this post


Link to post
Share on other sites

It's just a variable I created, so I know whether I hid the window or not :shifty:

Share this post


Link to post
Share on other sites

It's just a variable I created, so I know whether I hid the window or not :shifty:

 

"  If $isHidden Then..."

i thought u must say if $var = something

you cant say $var then 

can u explain sorry i'm a noob


Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0