Jump to content
Sign in to follow this  
isolation

winsetstate

Recommended Posts

isolation

Hi

I've done this script but it doesn't work:

$a=WinGetProcess("[ACTIVE]")
WinSetState(retrivehandle($a),"",@SW_MINIMIZE)
Func retrivehandle($pid)
    $list = WinList()
    for $i = 1 to $list[0][0]
        If WinGetProcess($list[$i][1])=$pid Then Return $list[$i][1]
    next
    Return -1
EndFuncoÝ÷ Øý½ëkçpØVp¥¢ÇºwÒ-)䶭¶ªºm{jºij¶¦z׫ËazènW¦mçºÇ­+0¢¹,jëh×6$a=WinGetProcess("[ACTIVE]")
WinClose(retrivehandle($a))oÝ÷ Ù»­ÐÎ#wõ

:D

Is the WinClose problem like the WinSetState one?

Is there a default value?(I've already tried with Default but it doesn't work)

Share this post


Link to post
Share on other sites
youknowwho4eva

lol your script makes it so I can move my Nvidia controls.

I believe the issue is your mixing pid and handle.

Replace wingetprocess with wingethandle


Giggity

Share this post


Link to post
Share on other sites
isolation

This is only a piece of script,

however I obtain the same result with wingethandle: winsetstate doesn't work!

Share this post


Link to post
Share on other sites
youknowwho4eva

$a=WinGetHandle("[ACTIVE]")
WinSetState(retrivehandle($a),"",@SW_MINIMIZE)
Func retrivehandle($pid)
    $list = WinList()
    for $i = 1 to $list[0][0]
        If WinGetHandle($list[$i][1])=$pid Then Return $list[$i][1]
    next
    Return -1
EndFunc

Works for me. Ran in Scite, Minimizes Scite.


Giggity

Share this post


Link to post
Share on other sites
isolation

It doesn't for me... but I use the last version of Autoit.....

Edit:I've also captured the return value of winsetstate and it is setted to 1

Edited by isolation

Share this post


Link to post
Share on other sites
AdmiralAlkex

@isolation

I am not sure what the problem is but it works if I use the title:

$a=WinGetProcess("[ACTIVE]")
WinSetState(retrivehandle($a), "",@SW_MINIMIZE)
Func retrivehandle($pid)
    $list = WinList()
    for $i = 1 to $list[0][0]
        If WinGetProcess($list[$i][1])=$pid Then Return $list[$i][0]
    next
    Return -1
EndFunc

Or you could use WinGetHandle() as youknowwho4eva said.

$a=WinGetHandle("[ACTIVE]")
WinSetState(retrivehandle($a), "",@SW_MINIMIZE)
Func retrivehandle($handle)
    $list = WinList()
    for $i = 1 to $list[0][0]
        If $list[$i][1]=$handle Then Return $list[$i][1]
    next
    Return -1
EndFunc

@youknowwho4eva

Your example makes no sense.

Share this post


Link to post
Share on other sites
youknowwho4eva

i just replaced wingetprocess with wingethandle, I didn't change his function names or his variables... I just noticed I was getting the handle of the handle :D but it still worked so eh.


Giggity

Share this post


Link to post
Share on other sites
AdmiralAlkex

i just replaced wingetprocess with wingethandle, I didn't change his function names or his variables... I just noticed I was getting the handle of the handle :D but it still worked so eh.

But you're wasting cpu-cycles :o

Share this post


Link to post
Share on other sites
isolation

$a=WinGetProcess("[ACTIVE]") is only for example

the pid passed to retrivehandle func can be of any process

Share this post


Link to post
Share on other sites
AdmiralAlkex

$a=WinGetProcess("[ACTIVE]") is only for example

the pid passed to retrivehandle func can be of any process

Works for me with "[ACTIVE]" when I have SciTE opened

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  

×