 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Dannymet
Joined: 18 Jul 2008 Posts: 28
|
Posted: Sun Mar 01, 2009 4:40 pm Post subject: Write the current active window name to text file |
|
|
The following script writes the current active window name to Windows.txt
| Code: | #NoEnv
SendMode Input
DetectHiddenWindows, On
Goto, Title
;------------------------------------------------------------------------------------------------------
GetTitle:
Loop
{
WinGetActiveTitle, Title1
If (Title = Title1)
Goto, GetTitle
else
Goto, Title
}
;------------------------------------------------------------------------------------------------------
Title:
WinGetActiveTitle, Title
FormatTime, FormatDate,, MM-dd-yyyy HH:mm:ss
FileAppend, `n-------- %Title% - %FormatDate% --------`n, Windows.txt
Goto, GetTitle
;------------------------------------------------------------------------------------------------------ |
But theres a bug that I cant seem to fix.
It will log the current window, then when it sees another window it will log it blank then log it agian with the window name:
| Code: | -------- New Folder (3) - 03-01-2009 16:37:47 --------
-------- - 03-01-2009 16:37:49 --------
-------- New Folder (2) - 03-01-2009 16:37:49 --------
-------- - 03-01-2009 16:37:50 --------
-------- New Folder (3) - 03-01-2009 16:37:50 --------
-------- - 03-01-2009 16:37:51 --------
|
Is there any way around this? so it just looks like this:
| Code: | -------- New Folder (3) - 03-01-2009 16:37:47 --------
-------- New Folder (2) - 03-01-2009 16:37:49 --------
-------- New Folder (3) - 03-01-2009 16:37:50 -------- |
edit:
Fixed it with a simple if command:
| Code: | #NoEnv
SendMode Input
DetectHiddenWindows, On
Goto, Title
;------------------------------------------------------------------------------------------------------
GetTitle:
Loop
{
WinGetActiveTitle, Title1
If (Title = Title1)
Goto, GetTitle
else
Goto, Title
}
;------------------------------------------------------------------------------------------------------
Title:
WinGetActiveTitle, Title
FormatTime, FormatDate,, MM-dd-yyyy HH:mm:ss
if (Title = "")
Goto, GetTitle
Else
{
FileAppend, `n-------- %Title% - %FormatDate% --------`n, Windows.txt
Goto, GetTitle
}
;------------------------------------------------------------------------------------------------------ |
[Title edited. Please write descriptive titles for your topics. ~jaco0646] |
|
| Back to top |
|
 |
evan
Joined: 19 Feb 2009 Posts: 125
|
Posted: Sun Mar 01, 2009 5:15 pm Post subject: |
|
|
u are just killing ur computer with constant checking
u should try using WinWaitNotActive |
|
| Back to top |
|
 |
Dannymet
Joined: 18 Jul 2008 Posts: 28
|
Posted: Sun Mar 01, 2009 5:26 pm Post subject: |
|
|
Ive just realised its using all my CPU
where would i put winwaitnotactivate in my script? |
|
| Back to top |
|
 |
Wouther
Joined: 01 May 2007 Posts: 83 Location: The Netherlands
|
Posted: Mon Mar 02, 2009 9:49 am Post subject: |
|
|
I can't test it right now, but my guess is something like:
| Code: | | WinWaitNotActive, A |
...followed by FormatTime, FileAppend, etc.
In a loop, of course!  _________________ Printing css/html-formatted text |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|