Jump to content
Sign in to follow this  
kevev

background cmd hangs window

Recommended Posts

kevev

Hello all! Been a while since I used autoit. I am trying to run openvpn when a button is clicked. Openvpn starts, but none of the buttons in my script work until I kill the openvpn service. I would like my stop button and exit button to work. Is there an easy way to do this? I was thinking of creating another autoit script to start openvpn and have my main script just call it. But I am afraid I will have the same issue. Thank You in advance. :D

Here is my loop.

While 1
        $msg = GUIGetMsg()


        Select
            Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
                ExitLoop

            Case $msg = $exititem
                ExitLoop

            Case $msg = $Connect
                _RunDOS($openvpn)

            Case $msg = $aboutitem
                MsgBox(0, "About", "info")
        EndSelect
    WEnd

Share this post


Link to post
Share on other sites
Authenticity

_RunDOS() calls internally RunWait() AutoIt function so you may want to use Run(@ComSpec & "\Something.exe") in hidden mode.

Share this post


Link to post
Share on other sites
kevev

_RunDOS() calls internally RunWait() AutoIt function so you may want to use Run(@ComSpec & "\Something.exe") in hidden mode.

Yeay! That got it. Took me a while to get the syntax right. Example code below.

$openvpn = "openvpn --config " & $ProgramPath & "\settings.ovpn"
Run($openvpn, "", @SW_HIDE)

One more question. How do I track the openvpn pid and kill it with my disconnect button?

Share this post


Link to post
Share on other sites
kevev

Yeay! That got it. Took me a while to get the syntax right. Example code below.

$openvpn = "openvpn --config " & $ProgramPath & "\settings.ovpn"
Run($openvpn, "", @SW_HIDE)

One more question. How do I track the openvpn pid and kill it with my disconnect button?

Nevermind. I got it.

Now I need to make sure a command called by a button completes, then show a popup with the status. Anyone know how to do that cleanly?

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.