Jump to content


Read updating .log-file and show Gui with picture and info


  • Please log in to reply
6 replies to this topic

#1 burton666

burton666
  • Guests

Posted 24 May 2012 - 04:46 PM

Ok, the topic is probably not crystal-clear but I will try to explain what I want to achieve.

At work we use a simple Telnet-prompt for picking orders witch looks like this: Posted Image
The problem is that the Item-number that is printed on the boxes are not the same as the Item-number in the Telnet-prompt.

If logging is enabled in telnet, is it possible to scan that file and make a gui with some info and picture pop up depending on what the last item-number is in the file?

The log looks like this:
Item      :30105901
UOM       :TH
Qty       :14
From Sub  :DJ
From Loc  :DJ.34..
To LPN    >STO222135008
To Sub    :UTLAST
To Loc    :UTLAST...
 
<Drop>
<Discrepancy>
<Skip Task>
<Cancel>
 
Item      :30112608
UOM       :TH
Qty       :2
From Sub  :DJ
From Loc  :DJ.38..
To LPN    >
To Sub    :UTLAST
To Loc    :UTLAST...
<Drop/Next>
<Drop>
<Discrepancy>
<Skip Task>
<Cancel>

The only thing that is interesting is the last 13 lines of that file. I do not want anything to show if it does not match and I want to be able to add different pictures+info for each item-number. The last 5 rows in that example is the only thing that does not change.

Is that possible and could someone point me in the right direction?

#2 engunneer

engunneer
  • Fellows
  • 9162 posts

Posted 24 May 2012 - 05:13 PM

i can't write a nice example, but TF_Tail (hugoV's TF library) and Regex should get all the data you want from the log file.

#3 burton666

burton666
  • Guests

Posted 24 May 2012 - 06:47 PM

Ok, I am trying baby-steps here. Why does this not work when trying it on the logfile?

FileRead, File_String, C:\telnet.txt
StringRight, Last_15, File_String, 15
if InStr(Last_15, "Item") != 0
   MsgBox True
else
   MsgBox False

I am trying to get the script to read the 15 last rows and check for the word "Item"

#4 Guests

  • Guests

Posted 24 May 2012 - 07:23 PM

15 is 15 characters not 15 lines as you think it does in your code above.
<!-- m -->http://www.autohotke... ... rsandfiles<!-- m --> see the two tail links. Search the forum for tail and you'll find 15 or so more tail functions ;-)

#5 burton666

burton666
  • Guests

Posted 24 May 2012 - 09:57 PM

Damn, it feels like this could take years to understand how it works. There should be an marketplace in the forum for beginners like me to buy complete solutions :)

#6 just me

just me
  • Members
  • 1175 posts

Posted 25 May 2012 - 05:22 AM

If you are using AHK_L you may "buy" my FileTail() function. :wink:

#7 burton666

burton666
  • Guests

Posted 08 June 2012 - 12:48 PM

Can anyone give me some examples or explain how to firstly make the script identify this sequence:
Item      :30112608
UOM       :TH
Qty       :2
From Sub  :DJ
From Loc  :DJ.38..
To LPN    >
To Sub    :UTLAST
To Loc    :UTLAST...
<Drop/Next>
<Drop>
<Discrepancy>
<Skip Task>
<Cancel>

It is always 13 lines and starts with "Item" and ends with "" and make it so it only looks for it in the bottom of the text-file as it updates constantly.