Jump to content

Recommended Posts

Posted

I'm trying to make an AutoIt who remembers the title of a focused window and a few moments later (during which I have lost focus on the window) sets focus on that window.

But something doesnt work :D

#Include <WinAPI.au3>

sleep(3000)
$handle = WinGetHandle("WinGetTitle()", "");get the title of the active window
sleep(6000)
WinActivate("$handle");switch to the window with the title I got above

Anyone have an idea about whats wrong?

Posted (edited)

Also you can't use WinActivate with handles

Actually, yes you can.

@illya

The problem wholly lies in your usage of quotes. In your code example, you have:

$handle = WinGetHandle("WinGetTitle()", "");get the title of the active window

Two quotation mark issues:

  • Don't wrap your function name within quotes (RE: "WinGetTitle()")
  • Use empty quotes ("") inside your call to WinGetTitle when trying to get the "active" window's handle
Corrected code involves both changes to that particular line, as follows:

$handle = WinGetHandle(WinGetTitle(""))

Edit: details clarification

Edited by Monamo

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...