Jump to content

Problem controlling a hidden window


Recommended Posts

I'm having a heck of a time trying to control this program called CenterCutGUI but do it invisibly. Everything works fine until I try to hide it.

I've tried @SW_HIDE which would be my first choice but the program won't respond. I reluctantly tried WinSetTrans because I knew it would flash and even made a last ditch effort to pop up a GUI to hide the darned thing. I really don't want it to appear at all

Am I barking up the wrong tree or if not, would anyone be able to point me in the right direction?

Here's a link to the CenterCutGUI program as well and if you want to test, just put any stereo wav file in the ScriptDir and name it stereo.wav

Thanks in advance!

Opt("GUICloseOnESC", 1);1 = ESC  closes script, 0 = ESC won't close.
Opt("WinTitleMatchMode", 4)
Opt('MustDeclareVars', 1)
Global Const $CC = @ScriptDir & "\CenterCutGUI.exe"
Global $CCfile = @ScriptDir & "\stereo.wav"
Global $wHandle1, $wHandle2

;Global $GUI = GUICreate("Hide CenterCutGUI",650,500,-1,-1) <-- THIS DOESN'T WORK
;GUISetState(@SW_SHOW)
;WinSetOnTop($GUI,"",1)

_MakeCenter($CCFile)
Exit

;Function to automate using CenterCutGUI.exe to create a mono file consisting of the center of a stereo file
Func _MakeCenter($CCFile)
    ;Run($CC,@ScriptDir,@SW_HIDE); <-- THIS DOESN'T WORK
    Run($CC,@ScriptDir)
    WinWait("Center Cut GUI")
    $wHandle1 = WinGetHandle("Center Cut GUI")
    ;WinSetTrans($wHandle1,"",0) <-- THIS DOESN'T WORK
    WinActivate($wHandle1)
    ControlFocus($wHandle1,"","[NAME:rbCenter]")
    ControlCommand($wHandle1,"","[NAME:rbCenter]","Check", "")
    ControlFocus($wHandle1,"","[TEXT:Add...]")
    ControlClick($wHandle1,"","[TEXT:Add...]","primary")
    WinWait("Input Audio")
    $wHandle2 = WinGetHandle("Input Audio")
    ;WinSetTrans($wHandle2,"",0) <-- THIS DOESN'T WORK
    WinActivate($wHandle2)
    Do
        ControlFocus($wHandle2,"","[CLASS:Edit; INSTANCE:1]")
        ControlSetText($wHandle2,"","[CLASS:Edit; INSTANCE:1]",$CCFile)
    Until ControlGetText($wHandle2,"","[CLASS:Edit; INSTANCE:1]") = $CCFile
    ControlFocus($wHandle2,"","[CLASS:Button; INSTANCE:2]")
    ControlClick($wHandle2,"","[CLASS:Button; INSTANCE:2]")
    WinWaitClose($wHandle2)
    WinActivate($wHandle1)
    ControlFocus($wHandle1,"","[NAME:btnRun]")
    ControlClick($wHandle1,"","[NAME:btnRun]")
    Do
        ControlFocus($wHandle1,"","[NAME:btnRun]")
        Sleep(1)
    Until ControlGetText($wHandle1,"","[NAME:btnRun]") = "Stop"
    Do
        ControlFocus($wHandle1,"","[NAME:btnRun]")
        Sleep(1)
    Until ControlGetText($wHandle1,"","[NAME:btnRun]") = "Run"  ;WinClose("Center Cut GUI")
    WinKill($wHandle1)
EndFunc
Edited by a440hz

Are you experienced?

Link to comment
Share on other sites

ControlSend is your friend :idea:

WinWait("Center Cut GUI")
$wHandle1 = WinGetHandle("Center Cut GUI")
WinSetTrans($wHandle1,"",0)
ControlSend($wHandle1,"","[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:13]","{SPACE}")
WinWait("Input Audio")
$wHandle2 = WinGetHandle("Input Audio")
WinActivate($wHandle2)

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

ControlSend is your friend :idea:

WinWait("Center Cut GUI")
$wHandle1 = WinGetHandle("Center Cut GUI")
WinSetTrans($wHandle1,"",0)
ControlSend($wHandle1,"","[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:13]","{SPACE}")
WinWait("Input Audio")
$wHandle2 = WinGetHandle("Input Audio")
WinActivate($wHandle2)

Thank you very much BogQ, works perfectly!

Are you experienced?

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