Where is the error?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Hardware_Tester
Pro Scripter
Posts: 58
Joined: Mon Jun 27, 2005 7:03 am
Location: Switzerland

Where is the error?

Post by Hardware_Tester » Fri Jun 09, 2006 1:52 pm

I'm getting sometimes Errors executing this function. The code section, which is affected, is listed at the end of the post. The error happens directly after the CTRL+A, which is checkable on the screen. There were some popups which appeared, but i didn't noted them down, their meaning was something with the complex functions.

One of the errors was:
i does not appropriate


Code: Select all

 Let>HMIsearch=successfully downloaded
 SetFocus>Mozilla*
 //copy text to clipboard
 Press CTRL
 Send>a
 Wait>0.1
 Send>c
 Release CTRL
 //get the text from clipboard
 GetClipBoard>HMIwindow
 //Lower the string to prevent failures
 Let>HMIwindow={Lower(%HMIwindow%)}
 //Return the absolute position of the start of a substring in a string
 //position>KEYWORD,%STRING%,START_POSITION,RESULT_VARIABLE,XY
 //XY=FALSE=ABSOLUTE_RESULT XY=TRUE=RELATIVE TO START_POSITION
 //This is used to find a pattern to match, as a conversion from
 //the string to a value which can be used for an if-condition
 position>%HMIsearch%,%HMIwindow%,1,HMIstate,FALSE
 //Check if the keyword has not been found, then generate popup with failure report
 If>HMIstate=0,HMIerror

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

Post by Marcus Tettmar » Fri Jun 09, 2006 1:59 pm

Hi,

The error is with the lower function. It will produce an error if the string contains a double quote mark (") as this identifies the end of a string. To avoid this you need to replace occurences of " with "" (double quote) so that it knows the quote should be part of the string, rather than indicating the end of a string.

So all you need to do is add this line just before the call to Lower:

StringReplace>HMIwindow,","",HMIwindow
Let>HMIwindow={Lower(%HMIwindow%)}
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Hardware_Tester
Pro Scripter
Posts: 58
Joined: Mon Jun 27, 2005 7:03 am
Location: Switzerland

Post by Hardware_Tester » Fri Jun 09, 2006 2:13 pm

Thanks for the help. I will test the script over weekend and report, if it helped. The problem of the debugging is the runtime: 1hour and up per run...

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

Post by Marcus Tettmar » Fri Jun 09, 2006 2:17 pm

You can debug that section of code quickly, and I was able to replicate the problem when on a web page that contained " marks. So I'm pretty sure that is it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Hardware_Tester
Pro Scripter
Posts: 58
Joined: Mon Jun 27, 2005 7:03 am
Location: Switzerland

Post by Hardware_Tester » Fri Jun 09, 2006 5:41 pm

The problem is, I did not find any quotation marks in the pages. But anyway, at monday I can look at the results and if it worked, i'm happy :-)

Twelfe runs were successfully, but the next one crashed again:
incorrectly formed parameters
i not appropriate

The source of the page displayed by mozilla 1.5 (not firefox) is:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Welcome to HMI570</TITLE>
<META content="text/html; charset=ISO-8859-1">

<link rel="stylesheet" href="abb.css" type="text/css">

<BODY bgcolor="white">
    <center>
    <br>
    <table border="0" width="500" style="table-layout:fixed">
        <tr><td><hr noshade size="2" width="490" color="black" width="500"></td>
        </tr>
        <tr>
            <td align="center">
                <img src="images/abblogo.gif" width="102" height="53" >
            </td>
        </tr>
        <tr>
            <td align="center" >
                <img src="images/nsd570logo.gif" width="200" height="46"> <br> <br>
            </td>
        </tr>
        <tr><td align="center"><h2>The ABB Teleprotection Equipment </h2></td></tr>
        <tr><td><hr noshade size="2" width="490" color="black" width="500"></td></tr>
    </table>
    <br>
    <br>

    <table border="0" width="500" style="table-layout:fixed">
        <tr>
            <td align="center">
                <a href="http://localhost:10570/hmi570/mainLayout.jsp?action=welcome&menu=mainMenu" style="font-size:14px">HMI570 ( Human Machine Interface )</a>
                <br> <br>
            </td>
        </tr>
        <tr>
            <td align="center">
                <a href="http://localhost:10570/hmi570/InstructionManual/1KHW000890-EN-NSD570.pdf"
                    target="_blank" style="font-size:14px">NSD570 Instruction Manual</a>
                <br> <br>
            </td>
        </tr>
        <!-- tr><td height="20"></td></tr -->
        <tr><td align="center">
        <a href="http://www.abb.com/utilitycommunications" target="_blank" style="font-size:14px">ABB Utility Communications</a>
        </td></tr>
    </table>

    </center>


</BODY>
</HTML>
I know, there is no timing problem, because the ctrl+a marks only the stuff which is there, and everything was marked.

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