Jump to content
Sign in to follow this  
furby

Exiting a program

Recommended Posts

Hi,

I am tinkering and trying to get my head around a few concepts. The issue that is bugging me is how to close Audacity after opening it. I used auto reveal and Autoit wininfo to get information with concerns to Audacity when it was opened (no file loaded) it just had a reference to the window as Audacity. So I presumed that winClose ("Audacity","") would close the Audacity program. It didn't. I then did the following. With Know luck can anyone help.

For $i = Asc('a') to Asc('z')

If FileExists(Chr($i) & ":\Program Files\audacity\") Then Run(Chr($i) & ":\Program Files\audacity\audacity.exe")

Next

Exit

Send("!f")

Send("!x")

Share this post


Link to post
Share on other sites

maybe

ProcessClose("audacity.exe") assuming that is the name of the process

Works, but I prefer to use PID:

Opt("WinTitleMatchMode", 4)

$sAudacity = "C:\Program Files\Audacity\audacity.exe"

If Not WinExists("[CLASS:wxWindowClass]") Then
    Run($sAudacity)
    WinWait("[CLASS:wxWindowClass]")
EndIf

$hAudacity = WinGetHandle("[CLASS:wxWindowClass]")
$pidAudacity = WinGetProcess($hAudacity)
ConsoleWrite("Debug: $pidAudacity = " & $pidAudacity & @LF)

Sleep(2000)

ProcessClose($pidAudacity)

And I love Audacity!

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

×
×
  • Create New...