AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Keypress based off log file?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Thu Apr 21, 2005 11:38 pm    Post subject: Keypress based off log file? Reply with quote

Hello,

I was wondering if there was a way to execute a keypress based off the last line in an automatically updated log file. I have another macro that is doing all the dirty work for me. All I want to do is have 'r' pressed any time a customer sends me a request..

I tried to do a search on the forums but nothing that quite hits the nail on the head. I am pretty sure I am going to have to use the program 'Tail' (sp?) to parse the log file (then again I dont know anything about it, but it looks like that is what it does).

Sorry if this question has been answered numerous times before; I am by no means a 'good' programmer so ANY help or suggestions would be very much appreciated. THANKS IN ADVANCE!!
Back to top
BoBo
Guest





PostPosted: Fri Apr 22, 2005 6:51 am    Post subject: Reply with quote

Sounds like to decrease a trouble ticket systems response time. Wink
Code:
Loop, Read, My.log
{
   LastLine = %A_LoopReadLine%
}

If LastLine contains Gehaltserhöhung
{
   MsgBox, Schon wieder eine Gehaltserhöhung. Press: Akzeptie[color=red]r[/color]t !
}

Gehaltserhöhung = salary increase
btw: Are you allowed to cut off the log (as the above code reads an increasing inputfile again and again) ?
Back to top
BoBo
Guest





PostPosted: Fri Apr 22, 2005 12:33 pm    Post subject: Reply with quote

Code:
Loop
{
    FileGetTime, CurrModTime, My.log, M
    If CurrModTime = %PrevModTime%
       Continue
    PrevModTime = %CurrModTime%
    MsgBox, File has been manipulated at: %CurrModTime%
}
Back to top
ludachris



Joined: 21 Apr 2005
Posts: 2

PostPosted: Fri Apr 22, 2005 1:36 pm    Post subject: Reply with quote

BoBo wrote:
Sounds like to decrease a trouble ticket systems response time. Wink
Code:
Loop, Read, My.log
{
   LastLine = %A_LoopReadLine%
}

If LastLine contains Gehaltserhöhung
{
   MsgBox, Schon wieder eine Gehaltserhöhung. Press: Akzeptie[color=red]r[/color]t !
}

Gehaltserhöhung = salary increase
btw: Are you allowed to cut off the log (as the above code reads an increasing inputfile again and again) ?


Pardon my ignorance Crying or Very sad - Is there any way you can post this in English? The log file would actually never be cut off, it would just have lines appended to it. Would the above code continue to press 'r' if the last line contains (in your example 'salary increase')?
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Fri Apr 22, 2005 1:58 pm    Post subject: Reply with quote

Code:
Loop, Read, My.log
{
   LastLine = %A_LoopReadLine% ; keep the content of the last line
}

If LastLine contains MyKeyword ; replace "MyKeyword" with your string pattern
{
   Send, r ; sends the charcter "r" to the app/file which has the focus
}
Back to top
ludachris



Joined: 21 Apr 2005
Posts: 2

PostPosted: Fri Apr 22, 2005 3:54 pm    Post subject: Reply with quote

THANK YOU THANK YOU THANK YOU THANK YOU...

THANK YOU!! Very Happy Very Happy

I am going to try this as soon as I can
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group