Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-21-2018, 08:06 AM
swissAlisha swissAlisha is offline
Registered User
 
Join Date: Aug 2018
Posts: 2
if then else Problems

Hi to all,

I see my problem not, if the value witch i get back is 200703 then it's okay but if it's a other result then my script hang and will not do my else condition. Can you please help me what i do wrong?

Quote:
Sub main

Dim shelfslot

shelfslot = crt.Dialog.Prompt("Shelf Slot")

' Check GCC Status

crt.Screen.Send "cd /pureNeApp/EC" & chr(13)
crt.Screen.Send "./dbgCut" & chr(13)
crt.Screen.WaitForString "dbgCut> "
crt.Screen.Send "!dbgCutThru (flts 0 otumach " & shelfslot & ") " & chr(34) & "dltcl peek32 0x6101c008" & chr(34) & chr(13)
if Crt.Screen.WaitForString ("RV_SUCCESS 200703") = True then

else crt.Screen.Send "!dbgCutThru (flts 0 otumach " & shelfslot & ") " & chr(34) & "dltcl poke32 0x6101c008 0x30fff" & chr(34) & chr(13)

end if
crt.Screen.Send "exit" & chr(13)
crt.Screen.Send "cd /" & chr(13)
crt.Screen.Send "logout" & chr(13)

End Sub
Best regards

Alisha Manuela
Reply With Quote
  #2  
Old 08-21-2018, 08:47 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 526
Hi swissAlisha,

It looks like you may need to configure a timeout on the WaitForString. Currently the WaitForString is waiting forever to see "RV_SUCCESS 200703".

The below example demonstrates using a WiatForString with a 10 second timeout.

Code:
If crt.screen.WaitForString("ogin:", 10) <> True Then
    MsgBox "Failed to detect login!"
    Exit Sub
End If
Does adding a timeout to your WaitForString give you the desired behavior?
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 08-23-2018, 01:12 AM
swissAlisha swissAlisha is offline
Registered User
 
Join Date: Aug 2018
Posts: 2
Hi Eric,

Maybe i use the other words, this was clear for me with the wait. But my Problem is that if the replay String "RV_SUCCESS 200703" from Crt.Screen.WaitForString is not matching then it need to do the else Command.

Still i try to see my problem why it's not working.

Best regards

Alisha Manuela Stutz
Reply With Quote
  #4  
Old 08-23-2018, 08:14 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 526
swissAlisha,

With the way your Crt.Screen.WaitForString is configured right now it will wait forever until it sees "RV_SUCCESS 200703". There is no way for it to get to the else because it will just keep waiting until "RV_SUCCESS 200703" appears. You will need to set a time limit for it to wait. For example, you might configure it to wait 5 seconds. If "RV_SUCCESS 200703" appears in 5 seconds do something, else (if it does not appear in 5 seconds) do something different.

You would accomplish this by configuring WaitForString with a timeout. This may look something like:

Code:
If Crt.Screen.WaitForString ("RV_SUCCESS 200703", 5) = True Then
Does modifying the code in this way provide the needed behavior?
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 07:49 AM.