Results 1 to 3 of 3

Thread: Error: Access violation

  1. #1
    Join Date
    Mar 2015
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Question Error: Access violation

    I have installed Java 8 but I'm not sure that Java creates a problem in my code.

    Here is a piece of code that I think that creates a problem.

    Simba Code:
    program new;

    var
     i,s : integer;
     b,t : string;
    begin
     i := 1;


     WHILE i <=19999 DO
        begin

     ClickMouse ( 390, 329, mouse_left );   //
     ClickMouse ( 390, 329, mouse_left );   //  This code taken string
     ClickMouse ( 390, 329, mouse_left );   //  in CHAT on Firefox.
     ClickMouse ( 390, 329, mouse_right );  //  Sets the ClipBoard
         wait (391);                        //  with the option Copy
     MoveMouse ( 458, 344);                 //  (right_click,
     ClickMouse ( 458,344, mouse_left );    //  then left_click Copy)

             s := Length(getClipBoard());
             b := getClipBoard();

             if s <= 3 then s := 4;
             
             
          t :=   b[s-2];
           
     i := i + 1;
       end;

    end.
    loop works well (10 min - 1 hour) and then report error
    Error: Access violation at line
    Simba Code:
    t :=   b[s-2];

    Most common ERROR is displayed when the s = 0.
    That's why I put a line:
    Simba Code:
    if s <= 3 then s := 4;

    but error(Access violation) is still sometimes displayed.
    Last edited by Andrmolja; 04-17-2015 at 01:42 PM.

  2. #2
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    The index b[s-2] does not exist, in other words the array is either empty or does not reach that high. You should add a length check before you do t := b[s-2]

    if (length(b)) = 0) then
    dosomething

  3. #3
    Join Date
    Mar 2015
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Thank you. I tested code 2 hours and no error. Thank you very much RJ.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •