Robert9

Closing window?

8 posts in this topic

#1 ·  Posted (edited)

I recently installed Autoit, and tried to make couple of macros. In some occasion I managed to make simple macros, but in this I couldn't find solution.

I have newest version of Autoit, using Windows 10 x64.

I tried to make macro to close the window/application "Tor browser"
It activates the window if it is not active but doesn't close it:

WinActivate("About Tor - Tor Browser")
WinClose("About Tor - Tor Browser")

It doesnt report an error, it executes the macro, but window is not closed.

I also tried Winkill, and to record strokes alt+F4, alt+X... but no luck
Help will be appreciated.

Edited by Robert9

Share this post


Link to post
Share on other sites



It would be better if you could post your code.   Otherwise, it is hard to say what is happening.  WinClose should return either a 0 or 1.  When you say you get no error are you getting a 1?  That would mean success and no error. You can double check it this way:

$result=WinClose("About Tor - Tor Browser")

msgbox(0,"Result","This is the result: "&$result)

 


Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites

Thank you for reply.
That is all code.

I put above and I got:
This is the result:1

But the window is not closed.

Share this post


Link to post
Share on other sites

I would try again but use WinKill.  What is the result for that?  I would hope it would be blank.  It should only return a 1 if it worked.  Also, have you confirmed you only have one instance of this window / app running?  Check your task manager to confirm.


Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites

Same result with WinKill. You can check if you install this program Tor Browser.
It is only one instance.

Is there a command to close a program by location on disk? like "C:\Tor Browser\Browser\firefox.exe"

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Update: now I compiled the script and run it as admin, it works.

Dont know why it doesnt work as a script, but it works as .exe. But it is important it works. :)
 

Edited by Robert9

Share this post


Link to post
Share on other sites

Thanks!

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