Jump to content

background cmd hangs window


Recommended Posts

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

_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?

Link to comment
Share on other sites

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?

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