Response Monitor Help With Part Of Code

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Sun Jul 07, 2013 12:27 pm

CyberCitizen wrote:I originally looked at doing it that way. The problem is the PHP on the site updates regulary and by using the IE Extract tag I can capture only the changes and not the whole page reducing the load on the server as well as the speed. Plus using the IE Extract tag its easier to limit it to only the data I am after & having to do a HTTP request every seconds.
Makes Sense.

I only have MS 13 so I have to use VBScript but you should be able to do it with IECreate>IE[0]. So, what I would do is get the Window Handle right after creating IE. Then use IfWindowOpen to check if the IE handle exist.

I hope this example at least gets you pointed in the right direction.

Code: Select all

VBSTART
Dim IE

Function CreateIE ()
  Set IE = CreateObject("InternetExplorer.Application")
  IE.Visible = 0
  IE.toolbar = 0
  IE.AddressBar = 0
  IE.menubar = 0
  IE.resizable = 0
  IE.statusBar = 0
  IE.top= 0
  IE.Left= 0
  IE.width= 800
  IE.height= 700
End Function

Sub Navigate(URL)
  IE.Navigate URL
  do while IE.Busy
  loop
End Sub

Sub WaitBusy
  do while IE.Busy
  loop
End Sub
VBEND

//Create IE
VBEval>CreateIE,res
VBRun>WaitBusy
GetWindowHandle>Windows Internet Explorer,IEHandle
//Navigate to URL
VBRun>Navigate,http://paging2.sacfs.org/live/
VBRun>WaitBusy


Label>Loop
Wait>0.1
Let>WIN_USEHANDLE=1
IfWindowOpen>%IEHandle%
Else
MDL>IE Closed
Exit>1
ENDIF
Let>WIN_USEHANDLE=0
Goto>Loop

User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Sun Jul 07, 2013 12:31 pm

I think I will be able to do it based on the browsers IE title as it changes when you navigate to the page, then I should be able to pull the handle and monitor that to see if its closed, if it is, we close the app. Thank you for your help.
FIREFIGHTER

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Sun Jul 07, 2013 12:33 pm

CyberCitizen wrote:I think I will be able to do it based on the browsers IE title as it changes when you navigate to the page, then I should be able to pull the handle and monitor that to see if its closed, if it is, we close the app. Thank you for your help.
You're welcome :D

User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Mon Jul 08, 2013 5:20 am

I have tried Window Handle, IfWindowOpen etc, still appears that the IE window is still visible then tries to IE ExtractTag while its still shutting down & causes it to crash. Problem is I can't delay it otherwise its not checking for an updated tag every second. Even pushed it to 10 seconds but as soon as I close the IE window its not happy and crashes.
FIREFIGHTER

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Mon Jul 08, 2013 12:22 pm

What about using "Let>IGNOREERRORS=1"?

User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Mon Jul 08, 2013 2:27 pm

Nah it actually crashes the exe.

I think I will have to leave it as is just with warning message.
FIREFIGHTER

User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Re:

Post by CyberCitizen » Sun Feb 01, 2015 4:07 am

Marcus Tettmar wrote:Try this:

(?=.*\bSouth\b)(?=.*\bAldinga\b).*
Hi Marcus,

Thank you for this code, this helped alot, I have now tried to make a change to capture some additional information and it appears not to work now.

Are you able to assist?

Below are an example of the alert strings. As you can see in the picture I provided it didn't pick up on the entry I was looking for, have I missed something else?

Code: Select all

(?=.*\PR2\b)(?=.*\bWHITES\b)(?=.*\bVALLEY\b)(?=.*\bTraffic\b).*
(?=.*\PR2\b)(?=.*\bWILLUNGA\b)(?=.*\bOTHER\b)(?=.*\bEMERG\b).*
(?=.*\PR2\b)(?=.*\bWILLUNGA\b)(?=.*\bTraffic\b).*
(?=.*\PR2\b)(?=.*\bSEAFORD\b)(?=.*\bChest\b).*
Image

Code: Select all

SRT>SuburbCheck
  IfFileExists>%SCRIPT_DIR%\CFS Response Monitor Keywords.txt
    Let>k=1
    ReadLn>%SCRIPT_DIR%\CFS Response Monitor Keywords.txt,1,CurrentSub
    While>CurrentSub<>##EOF##
      IEExtractTag>%IE[0]%,,TD,1,0,TD1,ie_res
      IEExtractTag>%IE[0]%,,TD,3,0,TD3,ie_res
      IEExtractTag>%IE[0]%,,TD,5,0,TD5,ie_res
      IEExtractTag>%IE[0]%,,TD,7,0,TD7,ie_res
      StringReplace>%TD1%,PR: 1,PR1,TD1
      StringReplace>%TD1%,PR: 2,PR2,TD1
      StringReplace>%TD3%,PR: 1,PR1,TD3
      StringReplace>%TD3%,PR: 2,PR2,TD3
      StringReplace>%TD5%,PR: 1,PR1,TD5
      StringReplace>%TD5%,PR: 2,PR2,TD5
      StringReplace>%TD7%,PR: 1,PR1,TD7
      StringReplace>%TD7%,PR: 2,PR2,TD7
      ReadLn>%SCRIPT_DIR%\CFS Response Monitor Keywords.txt,k,CurrentSub
      If>CurrentSub<>##EOF##
        Let>Suburb=CurrentSub
        RegEx>Suburb,TD1,0,matches,Snum1,0
        RegEx>Suburb,TD3,0,matches,Snum3,0
        RegEx>Suburb,TD5,0,matches,Snum5,0
        RegEx>Suburb,TD7,0,matches,Snum7,0
        If>%Snum7%>0
          If>%LastResponseMSG%=%TD7%
          Else
            If>ResponseMSG=
              Let>ResponseMSG=%TD7%
            Else
              Let>ResponseMSG=%TD7%%CRLF%%CRLF%%ResponseMSG%
            EndIf
          EndIF
        EndIf
FIREFIGHTER

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

Re: Response Monitor Help With Part Of Code

Post by Marcus Tettmar » Tue Feb 03, 2015 1:38 pm

RegEx isn't matching I guess. There'll be a good reason.

As I can't copy text from an image can you send me the following:

1. The RegEx pattern that isn't working for you (expanded to the full regex string - no variables)
2. The source string you are searching for (again - raw text - no variables).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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