Jump to content

Problem with StringInStr()


Recommended Posts

Hello all...

I have a sporadic bug in the code below. Sometimes the StringInStr() does not find the "</TABLE>" even though it is there. I have checked the contents of the clipboard on the occasions where this does fail and clipboard does contain the correct string. Any ideas??

Thanks,

JPC :lmao:

ClipPut($HTML)
Send("^v")
Sleep(200);added this delay in case things were happening too quickly for the system
Send("+{HOME}^c{RIGHT}");copy the last pasted line into the clipboard
$Teststring = ClipGet()
If StringInStr($TestString, "</TABLE>") Then
   $Passed = 1
Else
   $Passed = 0
EndIf
If $Passed = 0 Then
   MsgBox(0, "Error", "There may be a problem with this description.  Please preview this item before posting!")
EndIf
Link to comment
Share on other sites

Hello all...

I have a sporadic bug in the code below.  Sometimes the StringInStr() does not find the "</TABLE>" even though it is there.  I have checked the contents of the clipboard on the occasions where this does fail and clipboard does contain the correct string.  Any ideas??

Thanks,

JPC  :lmao:

ClipPut($HTML)
Send("^v")
Sleep(200);added this delay in case things were happening too quickly for the system
Send("+{HOME}^c{RIGHT}");copy the last pasted line into the clipboard
$Teststring = ClipGet()
If StringInStr($TestString, "</TABLE>") Then
   $Passed = 1
Else
   $Passed = 0
EndIf
If $Passed = 0 Then
   MsgBox(0, "Error", "There may be a problem with this description.  Please preview this item before posting!")
EndIf

<{POST_SNAPBACK}>

Maybe another Sleep() after the ^c and before your call to ClipGet() ? Are you re-checking the clipboard on the failed occasions or the contents of $TestString?

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

$html = '11</TABLE>11'

ClipPut($HTML)
;~ Send("^v")
Sleep(200);added this delay in case things were happening too quickly for the system
;~ Send("+</TABLE>{HOME}^c{RIGHT}");copy the last pasted line into the clipboard
$Teststring = ClipGet()
$Passed = StringInStr($TestString, "</TABLE>")
If @error Then MsgBox(0, '', 'error')
If $Passed >= 1 Then
   MsgBox(0, "Success", "Passed! " & $Passed)
EndIf
If $Passed = 0 Then
   MsgBox(0, "Error", "There may be a problem with this description.  Please preview this item before posting!")
EndIf

Try this instead. Notice I have the $Passed infront of StringInStr. And I check the @error macro. I commented the sends for easy checking.

Link to comment
Share on other sites

$html = '11</TABLE>11'

ClipPut($HTML)
;~ Send("^v")
Sleep(200);added this delay in case things were happening too quickly for the system
;~ Send("+</TABLE>{HOME}^c{RIGHT}");copy the last pasted line into the clipboard
$Teststring = ClipGet()
$Passed = StringInStr($TestString, "</TABLE>")
If @error Then MsgBox(0, '', 'error')
If $Passed >= 1 Then
   MsgBox(0, "Success", "Passed! " & $Passed)
EndIf
If $Passed = 0 Then
   MsgBox(0, "Error", "There may be a problem with this description.  Please preview this item before posting!")
EndIf

Try this instead. Notice I have the $Passed infront of StringInStr. And I check the @error macro. I commented the sends for easy checking.

<{POST_SNAPBACK}>

Hi Mhz and DaveF,

Thank you both for your replies...

I tried Mhz's fix first, mainly because after reviewing it I found it to be cleaner code than mine, but also because I didn't want to believe that this bug could have been as simple as adding another Sleep().

Alas, the cleaner code did not solve the problem. However, the Sleep() did...

Thanks again guys...

JPC :lmao:

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...