Jump to content

Custom Function Headache


Recommended Posts

here's the section of code that's causing my headache. The Custom Function in question is the Inelg("400").

....<snip>....

If $lock = "15939" Then
   PayLock()
   Send("{F4}{numpadenter}01{numpadenter}")
   While EndOfLines() = 0
      $test = Inelg("400"); <---- THIS LINE HERE!!!!
      If $test = 1 Then
         $inelg = 1
         ExitLoop
      EndIf
      Send("{F8}")
   WEnd
   If $inelg = 1 Then
      Msgbox(48,"DING","Ineligible code 400 found" & @LF & "Please consult the guidelines", 20)
      CPT($lock)
      WinClose($rhelp)
      WinActivate($e)
      WinSetState($e,"",@SW_RESTORE)
   Else
      WinClose($rhelp)
      WinActivate($a)
      Send("{F5}")
      MsgBox(0,"A-OK!","No Inelgible 400 found."
      CloseFAF("No Inelgible 400 Found")
   EndIf
EndIf

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This function is for finding the ineligible reason codes on the GDSV
; The function [B]should[/B] return a 1 if it finds $icode and a 0 if it doesn't
; Format is Inelg("code") Example: Inelg("T42")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func Inelg($icode)
   GetScreen ($a);
   Local $inel = "NotAvailalble"
   $inel = StringLeft(StringTrimLeft(StringMid(StringStripWS(ClipGet(), 8), StringInStr(StringStripWS(ClipGet(), 8), "INELRSNS:"), 30), 9), 9)
   If StringRight($inel, 3) = $icode Or StringLeft($inel, 3) = $icode Or StringTrimLeft(StringLeft($inel, 6), 3) = $icode Then
      Return 1
   Else
      Return 0
   EndIf
EndFunc  ;==>Inelg

GetScreen() returns the screenshot, EndOfLines() works fine, the $inel is a section of the screen that I'm interested in, there will be a 3 character string that will be returned from that variable....

Problem is, Inelg() is returning a 1, even if the $icode isn't in the screen section I'm looking at.

I only want a return of 1 if the pattern contained in $icode is found. :idiot:

Where's the banana peel that I tripped on? :lol::D

What did I do wrong?

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to post
Share on other sites
  • 2 weeks later...

Ok, vacation happened inbetween the last reply and I've now had a chance to test it.

It works as advertised. It seems the program was getting overworked and needed to sleep. ;) Too many clipget()'s in rapid succession. :idiot: I guess I'm not a good slave driver :D Oh well. Learn and let learn. :lol:

Thanks again Larry.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...