Window Checker help needed Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Murkov01

Window Checker help needed

22 Feb 2018, 21:05

I'm tryna make a window checker that detects whenever a new window is opened and then puts it in a text file, but I'm really having trouble, can someone help me out, cheers

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus



thanks I really appreciate your time :)
User avatar
boiler
Posts: 2372
Joined: 21 Dec 2014, 02:44

Re: Window Checker help needed  Topic is solved

23 Feb 2018, 00:03

No reason to have a loop if you're simulating a loop with gotos. Just get rid of the gotos. It's a horrible practice.

You have problems with your syntax. Here it is corrected using legacy syntax, which it looks like you tried to use:

Code: [Select all] [Download] GeSHi © Codebox Plus

loop
{
if new_window = %window_title%
new_window = diff
else
{
WinGetActiveTitle, window_title
fileappend, %window_title%`n, C:\mypaths.txt
new_window = %window_title%
}
}


Here's expression syntax, which is better:

Code: [Select all] [Download] GeSHi © Codebox Plus

loop
{
if (new_window = window_title)
new_window := "diff"
else
{
WinGetActiveTitle, window_title
fileappend, % window_title . "`n", C:\mypaths.txt
new_window := window_title
}
}
Murkov01

Re: Window Checker help needed

23 Feb 2018, 01:21

this is good, except what I am trying to do is make it post a single appendage of the window title, the script you provided me with continuously loops :/
User avatar
boiler
Posts: 2372
Joined: 21 Dec 2014, 02:44

Re: Window Checker help needed

23 Feb 2018, 07:54

I was just fixing the syntax so you could work on the logic. Here's the logic fixed:

Code: [Select all] [Download] GeSHi © Codebox Plus

loop
{
WinGetActiveTitle, window_title
if (new_window != window_title)
{
fileappend, % window_title . "`n", C:\mypaths.txt
new_window := window_title
}
Sleep, 100
}

Return to “Ask For Help”

Who is online

Users browsing this forum: Evil-e, Flory, Xantis52 and 62 guests