Jump to content

_StringBetween @error


Recommended Posts

hi there,

the folowing line brings an error when $source has no data matching $Stringleft2 and/or $Stringright2

$string2=_StringBetween($source,$Stringleft2,$Stringright2)

how do i use the error to go to the following code, which is at the end of my script?

$a=$a+1
    If $a = 999999 Then 
        MsgBox(0,"Ende","ende")
        ExitLoop
    EndIf
WEnd

thanks for your help

Edited by Maximus1
Link to comment
Share on other sites

You will need to create a function to call when you recieve your error code

$string2=_StringBetween($source,$Stringleft2,$Stringright2)
If @error Then
   _mycode()
EndIf


Func _mycode()
     ;handle error
EndFunc
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

ok but how do i jump back to my while loop after that?

$string2=_StringBetween($source,$Stringleft2,$Stringright2)
If @error Then
   _mycode()
EndIf


Func _mycode()
     $a=$a+1
     If $a = 999999 Then 
        MsgBox(0,"Ende","ende")
        ExitLoop
     EndIf
     "jump to the beginning of the while loop"        <------------how?
EndFunc
Link to comment
Share on other sites

We can't help you with that as there is no while-loop in the example you posted. We are not mind-readers.

no you are not mind-readers, but you are skilled.

when you think about the given information you will see that there is something

- that counts from 1 to 999999

- that writes an reads arrays

where can you write and read arrays up to 999999 times? in a loop?

and sometimes the needed data are not available.

if you don`t want to help me, read this topic but do not use your keyboard.

lame sentences about mind-readers are not so cool as you think.

-----------------

i helped myself

HotKeySet("{PGUP}","start")
.
.
Send("{PGUP}")
Func start()
.
.
.
.
EndFunc
.
.
.
Func _mycode()
    DirRemove($dir& $string[0])
    $a=$a+1
    Tooltip("" & $a,461, 1028)
        If $a = 999999 Then 
            MsgBox(0,"Ende","ende")
            Exit()
        EndIf
        Send("{PGUP}")
EndFunc
Edited by Maximus1
Link to comment
Share on other sites

@Maximus1

Oh my god. Are you really that stupid or are you just pretending?

Our skills is irrelevant, since you gave us NOTHING to work on.

What you asked may as well be, "what is x + y". You didn't tell us what x is. You didn't tell us what y is.

If you give us NO DETAILS about the problem then NOBODY can help you.

And seriously, that code you posted now doesn't make any bloody sense at all. The loop is still missing. _mycode() is never called. And why the hell are you using Send() on a key that's HotKey'ed? That is without doubt one of the worst scripts EVER created, and by making it IMPOSSIBLE for us to help you it will stay that way.

Now the next time you create a thread, you MUST post a reproducer. It must be short and runnable/working. Without it we can't help you, because as I said earlier, WE ARE NOT MIND-READERS. Unless we know EXACTLY what the problem/question is about we CAN'T help you.

You will also notice that the solution for the problem can often be found while writing the reproducer.

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...