Jump to content
Sign in to follow this  
Glyph

Save last window name to a txt file?

Recommended Posts

Glyph

#Include <process.au3>
Dim $window = ""


HotKeySet("q","Quit")


while 1
sleep (10)
WEnd


func _check()
    $title = WinGetTitle("", "")
    if $title = "" Then
        Return
        EndIf
    if $title  <>"" Then
        $window = $window& "test"
        EndIf
EndFunc


func Quit()
    Exit
endfunc


Func OnAutoItExit()

$file = FileOpen("test.txt", 1)
FileWrite($file, $window)
FileClose($file)
EndFunc


#cs
;other file Is

while 1
$READ = Fileread("test.txt",1)
filedelete($read)
    sleep (10000)
WinSetTrans($READ,"",56)
WEnd
#ce

I want it to write the last window name to a file, so that it will change the windows i open to transparent. But it's not logging them, It's giving me a blank file...

Edited by backstabbed

tolle indicium

Share this post


Link to post
Share on other sites
PsaltyDS

This seems to be what you are trying to do (modified to not write to disk for demo):

#Include <date.au3>

Global $AllWindows = "", $LastWindow = ""

HotKeySet("q", "Quit")

While 1
    _check()
    Sleep(100)
WEnd

Func _check()
    Local $title = WinGetTitle("", "")
    If $title <> $LastWindow Then
        $LastWindow = $title
        $AllWindows &= _Now() & @TAB & $title & @CRLF
    EndIf
EndFunc   ;==>_check

Func Quit()
    Exit
EndFunc   ;==>Quit

Func OnAutoItExit()
    MsgBox(64, "Results", $AllWindows)
EndFunc   ;==>OnAutoItExit

:)


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
Glyph

Yes, that's exactly what i was looking for.

Thank you PsaltyDS!


tolle indicium

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.