Creating a line graph from script created data

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
alanimal
Junior Coder
Posts: 40
Joined: Thu Jun 09, 2005 11:57 pm

Creating a line graph from script created data

Post by alanimal » Tue Sep 18, 2012 8:38 pm

Hi Guys,

I have a script that I run every x minutes that does three things:

1. Send an Alert if files received are not being processed
2. Send an Alert if no files received for x amount of time
3. Display statistical data onto a basic website (http://www.itslonline.com/DropStats.html)

I have it all working, but I was wandering if someone could tell me whether there is an easy way to turn my data into a line graph showing the last 24 hours of data history??

Code: Select all

//Count the Files in the drop directory

Label>Start
CountFiles>v:\*.txt,txtcount,1
Wait>3

//Check the result of files that are backlog

Let>A=%txtcount%
Let>B=1000
Let>C=4999
Let>D=20000
GetDate>date
GetTime>time

IF>{%A%>%B%}

			IF>{%A%>%D%}
	 	 				Message>SEVERE BACKLOG!!%CRLF%There are more than %D% files in the NZ/AU drop Directory.%CRLF%Currently %A% files are waiting to be processed.%CRLF%Please check the server ASAP!!!!
		 				Let>SENDMAIL_STATUS=1
		 				Let>subject=ITSWEB is Experiencing a Severe BACKLOG (NZ/AU)!!!
		 				Let>me=ezicom
						Let>myname=EziComAutoAlert
		 				Let>recipients=EziComAlerts
		 				Let>body=SEVERE BACKLOG!!%CRLF%%A% Files are in the drop directory.%CRLF%This is above the %D% file threshold.%CRLF%Please check the server ASAP!!!%CRLF%%CRLF%...%CRLF%%CRLF%Notify concerned parties that we are experiencing a backlog.
						SMTPSendMail>recipients,serveragent,me,myname,subject,body,
						GoTo>END1

			ELSE>
				 		Message>There are more than %B% emails in the NZ/AU drop Directory.%CRLF%Currently %A% files are waiting to be processed.%CRLF%Please check the server ASAP!!!!
		 				Let>SENDMAIL_STATUS=1
		 		 		Let>subject=Experiencing a BACKLOG NZ/AU!!!
		 		 		Let>me=ezicom
						Let>myname=EziComAutoAlert
		 				Let>recipients=EziComAlerts
		 		 		Let>body SERVER ITS %crlf%There are more than %B% files in the NZ/AU drop Directory.%CRLF%Currently %A% files are waiting to be processed.%CRLF%Please check the server ASAP!!!!%CRLF% %CRLF%This check is done every 8 minutes so please ignore if you have read already.%CRLF% Check message forwarding is ok or allow time for backlog to clear %CRLF%%CRLF%Click here for the history http://www.itslonline.com/DropStats.html %CRLF%This is an automated email, please do not reply.
		 		 		SMTPSendMail>recipients,agent,me,myname,subject,body,
						GoTo>END1
			ENDIF>
ELSE>
	 	 Message>There are less than %B% files in the NZ/AU drop Directory so things are OK.%CRLF%Currently %A% files are waiting to be processed.

//Mail Drop Directory Inspecter

		 Let>Looptimes=100
		 Let>Counter=0

		 Label>StartLoop
		    CountFiles>V:\*.txt,txt_count,1
			   Wait>1
			      Let>X=%txt_count%
				     Let>Z=0
   		  IF>{%X%=%Z%}
		     Add>Counter,1
			 Message>Scanning NZ/AU Drop Directory%CRLF%There are %txt_count% files in the folder%CRLF%Scan Number:%counter%%CRLF%!!System NOT OK!!%CRLF%There are no Emails %CRLF%coming through to WEB from DPS
		  ELSE
		  	 Message>Scanning NZ/AU Drop Directory%CRLF%There are %txt_count% files in  folder%CRLF%Scan Number:%counter%%CRLF%System IS OK!%CRLF%Emails are coming through to WEB
		     GoTo>END1
   		  EndIF


   If>Counter=Looptimes,End
GoTo>StartLoop

Label>End
		 Message>CHECK WITH DPS - No mail for last 100 seconds
		 Let>SENDMAIL_STATUS=1
		 Let>subject=Datacom ITSWEBServer is NOT RECEIVING DATA FROM DPS for NZ/AU!!!
		 Let>me=ezicom
		 Let>myname=EziComAutoAlert
		 Let>recipients=EziComAlerts		 Let>body=SERVER ITS WEB crlf%NO Data has been forwarded to EziCom for 100 seconds from DIPS%CRLF%Please check for delays and if necessary contact DIPS %CRLF% %CRLF%This is an automated email, please do not reply.
		 SMTPSendMail>recipients,itsagentserver,me,myname,subject,body,

ENDIF>
Wait>4

Label>END1

[b]WriteLn>S:\WEBStats.html,result,%date%,%time%,Filecount = %A%,[/b]
Wait>2
[b]WriteLn>C:\Documents and Settings\Administrator\My Documents\Macro Scheduler\Logs\WEBStats.txt,result,%date%,%time%,%A%,[/b]
As you can see I am logging data into WEBStats.html and showing it online - so it would be awesome if someone can show me how to present this as a line graph?

http://www.itslonline.com/DropStats.html

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue Sep 18, 2012 10:42 pm

Use this drawline subroutine. Convert your data to pixels at whatever ratio makes sense and send the coordinates to the drawline subroutine.

Search for "drawline" to find examples posted.

Code: Select all

//DrawLine Usage:
//GoSub>DrawLine,WindowHandle,PenSize,PenColor,XStart,YStart,XEnd,YEnd

SRT>DrawLine
  LibFunc>user32,GetDC,HDC,%DrawLine_var_1%
  LibFunc>gdi32,CreatePen,Penres,0,%DrawLine_var_2%,%DrawLine_var_3%
  LibFunc>gdi32,SelectObject,SOPres,hdc,Penres
  Libfunc>gdi32,MoveToEx,mtres,HDC,%DrawLine_var_4%,%DrawLine_var_5%,0
  LibFunc>gdi32,LineTo,ltres,hdc,%DrawLine_var_6%,%DrawLine_var_7%
  LibFunc>gdi32,DeleteObject,DOres,Penres
  LibFunc>user32,ReleaseDC,RDCres,HDC_1,HDC
END>DrawLine

alanimal
Junior Coder
Posts: 40
Joined: Thu Jun 09, 2005 11:57 pm

Post by alanimal » Tue Sep 18, 2012 10:52 pm

Thanks JRL,

I had a look at the samples and delivered a headache!!!

So I have a file - webstat.txt

inside it I have the following data:

Code: Select all


Date, Time, FileCount
19/09/2012,9:46:03 a.m., 32, 
19/09/2012,9:54:03 a.m., 15, 
19/09/2012,10:02:03 a.m., 28, 
19/09/2012,10:10:03 a.m., 22, 
19/09/2012,10:18:03 a.m., 13, 

how do I get the drawline to render this data from this txt file which is updated every 8 mins?

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Sep 19, 2012 5:16 am

Here's one possibility. Woking out of a file named %temp_dir%webstat.txt

On re-reading your original post I'm wondering if you want to present the graph on-line via html. If so sorry... I have no idea. If I find time I'll try to figure that out but html or java script and the like are all things I've never needed to do, so I haven't.

Code: Select all

OnEvent>Key_down,VK27,0,Quit

Dialog>Dialog1
object Dialog1: TForm
  Left = 529
  Top = 350
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Chart'
  ClientHeight = 270
  ClientWidth = 350
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poScreenCenter
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object ProgressBar1: TProgressBar
    Left = 50
    Top = 50
    Width = 3
    Height = 150
    TabOrder = 9
  end
  object ProgressBar2: TProgressBar
    Left = 50
    Top = 200
    Width = 230
    Height = 5
    TabOrder = 8
  end
  object Label1: TLabel
    Left = 25
    Top = 50
    Width = 32
    Height = 13
    Caption = '150'
  end
  object Label2: TLabel
    Left = 35
    Top = 190
    Width = 32
    Height = 13
    Caption = '0'
  end
  object Label3: TLabel
    Left = 50
    Top = 220
    Width = 32
    Height = 13
    Caption = '0'
  end
  object Label4: TLabel
    Left = 70
    Top = 220
    Width = 32
    Height = 13
    Caption = '8'
  end
  object Label5: TLabel
    Left = 90
    Top = 220
    Width = 32
    Height = 13
    Caption = '16'
  end
  object Label6: TLabel
    Left = 110
    Top = 220
    Width = 32
    Height = 13
    Caption = '24'
  end
  object Label7: TLabel
    Left = 130
    Top = 220
    Width = 32
    Height = 13
    Caption = '32'
  end
  object Label8: TLabel
    Left = 150
    Top = 220
    Width = 32
    Height = 13
    Caption = '40'
  end
  object Label9: TLabel
    Left = 170
    Top = 220
    Width = 32
    Height = 13
    Caption = '48'
  end
  object Label10: TLabel
    Left = 190
    Top = 220
    Width = 32
    Height = 13
    Caption = '56'
  end
  object Label11: TLabel
    Left = 210
    Top = 220
    Width = 32
    Height = 13
    Caption = '64'
  end
  object Label12: TLabel
    Left = 230
    Top = 220
    Width = 32
    Height = 13
    Caption = '72'
  end
  object Label13: TLabel
    Left = 250
    Top = 220
    Width = 32
    Height = 13
    Caption = '80'
  end
  object Label14: TLabel
    Left = 270
    Top = 220
    Width = 32
    Height = 13
    Caption = '88'
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,,OnClose,Quit

Show>Dialog1

Let>Xpos=50
Let>Ypos=200
Let>Ybaseline=200
Let>comma=,
Let>kk=1
Repeat>kk
  Let>NextX={%Xpos%+20}
  Add>kk,1
  ReadLn>%temp_dir%webstat.txt ,kk,line
  If>line=##EOF##
    Wait>1
    Sub>kk,1
    Goto>EndOfData
  EndIf
  Separate>line,comma,item
  Let>NextY=%Ybaseline%-%item_3%
  GoSub>DrawLine,Dialog1.Handle,2,111111,Xpos,Ypos,NextX,NextY
  Let>Xpos=NextX
  Let>Ypos=NextY
  Label>EndOfData
Until>kk=0

Label>Loop
  Wait>0.01
Goto>Loop

SRT>Quit
  Exit>0
END>Quit

//DrawLine Usage:
//GoSub>DrawLine,WindowHandle,PenSize,PenColor,XStart,YStart,XEnd,YEnd

SRT>DrawLine
  LibFunc>user32,GetDC,HDC,%DrawLine_var_1%
  LibFunc>gdi32,CreatePen,Penres,0,%DrawLine_var_2%,%DrawLine_var_3%
  LibFunc>gdi32,SelectObject,SOPres,hdc,Penres
  Libfunc>gdi32,MoveToEx,mtres,HDC,%DrawLine_var_4%,%DrawLine_var_5%,0
  LibFunc>gdi32,LineTo,ltres,hdc,%DrawLine_var_6%,%DrawLine_var_7%
  LibFunc>gdi32,DeleteObject,DOres,Penres
  LibFunc>user32,ReleaseDC,RDCres,HDC_1,HDC
END>DrawLine



alanimal
Junior Coder
Posts: 40
Joined: Thu Jun 09, 2005 11:57 pm

Post by alanimal » Tue Sep 25, 2012 1:10 am

Thanks mate,

Yes I do want to output the graph so i can publish on a site.

I just tested your script - and when it gets to line

AddDialogHandler>Dialog1,,OnClose,Quit

I get an error "Invalid Numeric Date or Date format in "Add>Dialog1,,OnClose,Quit".

Any ideas on that?

I click OK and continue debugging and then when it gets to

Show>Dialog1

Another alert appears: "Cannot Show Dialog 30/12/1899". Not Found.

Not sure where this date comes from as it is not in my file??

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Sep 25, 2012 7:02 am

Which version of Macro Scheduler are you using? JRL's code requires v13.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

alanimal
Junior Coder
Posts: 40
Joined: Thu Jun 09, 2005 11:57 pm

Post by alanimal » Tue Sep 25, 2012 11:21 pm

version 9 pro - just paid for 13 but it keeps saying "Your account is currently disabled. We may still be processing your order" when I am trying to download - been like this for a while now. I will try again in a few hours.

You got any ideas on how this can be shown as a graph on an HTML page?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Sep 26, 2012 12:25 am

Do you want the graph to be generated in/by the page, or are you thinking of generating a graphic (e.g. a .gif) on the PC and uploading it to the server, or maybe something else entirely? You have an infinite range of options and it's hard to suggest something without a better idea of what you have in mind.

alanimal
Junior Coder
Posts: 40
Joined: Thu Jun 09, 2005 11:57 pm

Post by alanimal » Wed Sep 26, 2012 12:28 am

I was thinking if I can have an HTML Page, which has say a 60second autorefresh, that would re-generate any new data written to the file into the graph being displayed.

Date, Time, FileCount
19/09/2012,9:46:03 a.m., 32,
19/09/2012,9:54:03 a.m., 15,
19/09/2012,10:02:03 a.m., 28,
19/09/2012,10:10:03 a.m., 22,
19/09/2012,10:18:03 a.m., 13,


The data isnt too complicated - just a date/time and a file count. I have a msched script creating the data and updating the file every 8 minutes, and I just want to display this over a 24hour period so I can monitor the server load.

Hope that makes sense?

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Sep 26, 2012 7:23 am

If you are generating an HTML file then wouldn't it make sense to use HTML to create the chart? I'm sure there are many OCX charting components out there, and there's Google Chart amongst other options:

https://developers.google.com/chart/

You can also do it with Javascript/jQuery. You could create an HTML template where the data is set as Javascript variables. Your macro then simply needs to substitute those for the real data. Or you just have an HTML page with Javascript whch reads the data from a file which the macro outputs.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Sep 26, 2012 2:00 pm

If you want it to be self refreshing then you'll almost certainly have to involve javascript because the old html refresh tag is no longer well supported. Macroscheduler can do a great job (re)formatting and regularly uploading (by FTP) the data to the webserver.

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Sep 26, 2012 2:39 pm

Or you make the chart in a Macro Scheduler dialog, take a screen shot of the dialog client area, then post the resulting Jpg

alanimal
Junior Coder
Posts: 40
Joined: Thu Jun 09, 2005 11:57 pm

Post by alanimal » Sun Sep 30, 2012 10:19 pm

thanks JRL,

Just upgraded, hopefully this software can do what i need it to as thats the only reason I paid for the ug.

Anyone know how to screenshot the graph?

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Oct 01, 2012 4:25 am

Try this:

The GetImage subroutine gets an image of the client area of Dialog1. There was a 0 pixels sized dialog added at position 0,0 in the dialog, Getting the position of that window object tells us the upper left coordinates for the screen capture. Getting the ClientWidth and ClientHeight properties of teh dialog and adding their values to the button object position tells us the lower right coordinates for the screen capture. The script is currently saving a jpg file to the temp directory.

Code: Select all

OnEvent>Key_down,VK27,0,Quit

Dialog>Dialog1
object Dialog1: TForm
  Left = 529
  Top = 350
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Chart'
  ClientHeight = 270
  ClientWidth = 350
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poScreenCenter
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 25
    Top = 50
    Width = 18
    Height = 13
    Caption = '150'
  end
  object Label2: TLabel
    Left = 35
    Top = 190
    Width = 6
    Height = 13
    Caption = '0'
  end
  object Label3: TLabel
    Left = 50
    Top = 220
    Width = 6
    Height = 13
    Caption = '0'
  end
  object Label4: TLabel
    Left = 70
    Top = 220
    Width = 6
    Height = 13
    Caption = '8'
  end
  object Label5: TLabel
    Left = 90
    Top = 220
    Width = 12
    Height = 13
    Caption = '16'
  end
  object Label6: TLabel
    Left = 110
    Top = 220
    Width = 12
    Height = 13
    Caption = '24'
  end
  object Label7: TLabel
    Left = 130
    Top = 220
    Width = 12
    Height = 13
    Caption = '32'
  end
  object Label8: TLabel
    Left = 150
    Top = 220
    Width = 12
    Height = 13
    Caption = '40'
  end
  object Label9: TLabel
    Left = 170
    Top = 220
    Width = 12
    Height = 13
    Caption = '48'
  end
  object Label10: TLabel
    Left = 190
    Top = 220
    Width = 12
    Height = 13
    Caption = '56'
  end
  object Label11: TLabel
    Left = 210
    Top = 220
    Width = 12
    Height = 13
    Caption = '64'
  end
  object Label12: TLabel
    Left = 230
    Top = 220
    Width = 12
    Height = 13
    Caption = '72'
  end
  object Label13: TLabel
    Left = 250
    Top = 220
    Width = 12
    Height = 13
    Caption = '80'
  end
  object Label14: TLabel
    Left = 270
    Top = 220
    Width = 12
    Height = 13
    Caption = '88'
  end
  object ProgressBar1: TProgressBar
    Left = 50
    Top = 50
    Width = 3
    Height = 150
    TabOrder = 0
  end
  object ProgressBar2: TProgressBar
    Left = 50
    Top = 200
    Width = 230
    Height = 5
    TabOrder = 1
  end
  object MSButton1: tMSButton
    Left = 0
    Top = 0
    Width = 0
    Height = 0
    Caption = 'ClientAreaTest'
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,,OnClose,Quit

Show>Dialog1

Let>Xpos=50
Let>Ypos=200
Let>Ybaseline=200
Let>comma=,
Let>kk=1
Repeat>kk
  Let>NextX={%Xpos%+20}
  Add>kk,1
  ReadLn>%temp_dir%data.txt,kk,line
  If>line=##EOF##
    Wait>1
    Sub>kk,1
    GoSub>GetImage
    Goto>EndOfData
  EndIf
  Separate>line,comma,item
  Let>NextY=%Ybaseline%-%item_3%
  GoSub>DrawLine,Dialog1.Handle,2,111111,Xpos,Ypos,NextX,NextY
  Let>Xpos=NextX
  Let>Ypos=NextY
  Label>EndOfData
Until>kk=0

SRT>GetImage
  Let>WIN_USEHANDLE=1
    GetWindowPos>Dialog1.msButton1.handle,ButtonX,ButtonY
  Let>WIN_USEHANDLE=1
  GetDialogProperty>Dialog1,,ClientWidth,Xoffset
  GetDialogProperty>Dialog1,,ClientHeight,Yoffset
  Let>LowerRightX=%ButtonX%+%Xoffset%
  Let>LowerRightY=%ButtonY%+%Yoffset%
  ScreenCapture>ButtonX,ButtonY,LowerRightX,LowerRightY,%temp_dir%Chart.jpg
END>GetImage

SRT>Quit
  Exit>0
END>Quit

//DrawLine Usage:
//GoSub>DrawLine,WindowHandle,PenSize,PenColor,XStart,YStart,XEnd,YEnd

SRT>DrawLine
  LibFunc>user32,GetDC,HDC,%DrawLine_var_1%
  LibFunc>gdi32,CreatePen,Penres,0,%DrawLine_var_2%,%DrawLine_var_3%
  LibFunc>gdi32,SelectObject,SOPres,hdc,Penres
  Libfunc>gdi32,MoveToEx,mtres,HDC,%DrawLine_var_4%,%DrawLine_var_5%,0
  LibFunc>gdi32,LineTo,ltres,hdc,%DrawLine_var_6%,%DrawLine_var_7%
  LibFunc>gdi32,DeleteObject,DOres,Penres
  LibFunc>user32,ReleaseDC,RDCres,HDC_1,HDC
END>DrawLine

nodochau
Pro Scripter
Posts: 132
Joined: Wed Jan 16, 2019 12:59 pm

Re:

Post by nodochau » Mon Mar 09, 2020 12:34 pm

Hi JRL,
This is what I am looking for.
I have an data excel file and data will be within +tolerance and -tolerance. Can you show me how to create a graph in dialog?
My data looks like this:
+TOL=0.005
-TOL=-0.005
data in one column: 1.004, 0.996, 1.003..... So the nominal dimension is 1 and the graph of data will be in the middle of two lines 1.005 and 0.995
I looked at your subroutine of drawing lines then it is out of my head :)
I really appreciate your help.

Thanks
JRL wrote:
Wed Sep 19, 2012 5:16 am
Here's one possibility. Woking out of a file named %temp_dir%webstat.txt

On re-reading your original post I'm wondering if you want to present the graph on-line via html. If so sorry... I have no idea. If I find time I'll try to figure that out but html or java script and the like are all things I've never needed to do, so I haven't.

Code: Select all

OnEvent>Key_down,VK27,0,Quit

Dialog>Dialog1
object Dialog1: TForm
  Left = 529
  Top = 350
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Chart'
  ClientHeight = 270
  ClientWidth = 350
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poScreenCenter
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object ProgressBar1: TProgressBar
    Left = 50
    Top = 50
    Width = 3
    Height = 150
    TabOrder = 9
  end
  object ProgressBar2: TProgressBar
    Left = 50
    Top = 200
    Width = 230
    Height = 5
    TabOrder = 8
  end
  object Label1: TLabel
    Left = 25
    Top = 50
    Width = 32
    Height = 13
    Caption = '150'
  end
  object Label2: TLabel
    Left = 35
    Top = 190
    Width = 32
    Height = 13
    Caption = '0'
  end
  object Label3: TLabel
    Left = 50
    Top = 220
    Width = 32
    Height = 13
    Caption = '0'
  end
  object Label4: TLabel
    Left = 70
    Top = 220
    Width = 32
    Height = 13
    Caption = '8'
  end
  object Label5: TLabel
    Left = 90
    Top = 220
    Width = 32
    Height = 13
    Caption = '16'
  end
  object Label6: TLabel
    Left = 110
    Top = 220
    Width = 32
    Height = 13
    Caption = '24'
  end
  object Label7: TLabel
    Left = 130
    Top = 220
    Width = 32
    Height = 13
    Caption = '32'
  end
  object Label8: TLabel
    Left = 150
    Top = 220
    Width = 32
    Height = 13
    Caption = '40'
  end
  object Label9: TLabel
    Left = 170
    Top = 220
    Width = 32
    Height = 13
    Caption = '48'
  end
  object Label10: TLabel
    Left = 190
    Top = 220
    Width = 32
    Height = 13
    Caption = '56'
  end
  object Label11: TLabel
    Left = 210
    Top = 220
    Width = 32
    Height = 13
    Caption = '64'
  end
  object Label12: TLabel
    Left = 230
    Top = 220
    Width = 32
    Height = 13
    Caption = '72'
  end
  object Label13: TLabel
    Left = 250
    Top = 220
    Width = 32
    Height = 13
    Caption = '80'
  end
  object Label14: TLabel
    Left = 270
    Top = 220
    Width = 32
    Height = 13
    Caption = '88'
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,,OnClose,Quit

Show>Dialog1

Let>Xpos=50
Let>Ypos=200
Let>Ybaseline=200
Let>comma=,
Let>kk=1
Repeat>kk
  Let>NextX={%Xpos%+20}
  Add>kk,1
  ReadLn>%temp_dir%webstat.txt ,kk,line
  If>line=##EOF##
    Wait>1
    Sub>kk,1
    Goto>EndOfData
  EndIf
  Separate>line,comma,item
  Let>NextY=%Ybaseline%-%item_3%
  GoSub>DrawLine,Dialog1.Handle,2,111111,Xpos,Ypos,NextX,NextY
  Let>Xpos=NextX
  Let>Ypos=NextY
  Label>EndOfData
Until>kk=0

Label>Loop
  Wait>0.01
Goto>Loop

SRT>Quit
  Exit>0
END>Quit

//DrawLine Usage:
//GoSub>DrawLine,WindowHandle,PenSize,PenColor,XStart,YStart,XEnd,YEnd

SRT>DrawLine
  LibFunc>user32,GetDC,HDC,%DrawLine_var_1%
  LibFunc>gdi32,CreatePen,Penres,0,%DrawLine_var_2%,%DrawLine_var_3%
  LibFunc>gdi32,SelectObject,SOPres,hdc,Penres
  Libfunc>gdi32,MoveToEx,mtres,HDC,%DrawLine_var_4%,%DrawLine_var_5%,0
  LibFunc>gdi32,LineTo,ltres,hdc,%DrawLine_var_6%,%DrawLine_var_7%
  LibFunc>gdi32,DeleteObject,DOres,Penres
  LibFunc>user32,ReleaseDC,RDCres,HDC_1,HDC
END>DrawLine



Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts