Jump to content
Sign in to follow this  

Window address?

Recommended Posts


Hi, I am trying to retrieve a window's address with autoit (it looks like C:somefoldersomeotherfolder...).

I was thinking of using WinExists, but since I want to make it so that a function will be triggered when a certain folder is opened (for example C:testfolderprivate), I need to read the address of the active window.

I am not entirely sure on how to do this, but I noticed that by using the AutoIt 3 Window Info tool I can read the window address. The point is: how do I incorporate that into my code? How do I get what Window Info reads in my script? 

I'm sorry if this isn't clear, if you need further explanations I'll try my best :D

EDIT: I found a way to do this (using WinGetText and WinGetHandle for who is interested). Sorry mods ! This thread can be closed :)

EDIT 2 : here's the code if anyone is interested!

$auth=False ; don't edit this
$address="insert address here"
$timeout=7 ; time to input your password when requested
$poll=500 ; how long the script waits before another loop (longer = uses less cpu, but means less efficient script because it might trigger the pass request too late, so I'd say this is a good number)
;to set a password you need to make a file "pass.txt" - put your password in there

While 1
    Switch StringInStr($str, $address)
        Case Not 0
            Switch $auth
                Case True
                    ConsoleWrite("auth lost"&@crlf)
                Case False
                    $input=InputBox("Authentication Requested", $timeout&"s Timeout"&@CRLF&"Password", "", "*", "", "", "", "", $timeout)
                    If $input == FileReadLine(FileOpen("pass.txt"), 1) Then
                        WinActivate(Run("explorer.exe " & $address))
Edited by megablox

"The story of a blade is linked in Blood." 



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.