Jump to content

Recommended Posts

Posted

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)

Posted

$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

Posted (edited)

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
Posted

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

Posted

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

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
×
×
  • Create New...