Jump to content

winsetstate


Recommended Posts

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)

Link to comment
Share on other sites

$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

Link to comment
Share on other sites

@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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

$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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...