Results 1 to 3 of 3

Thread: TB Main - automatically be terminated after number of seconds

  1. #1
    Junior Member M30_NXG's Avatar
    Join Date
    Oct 2018
    Location
    Germany
    Posts
    4
    Rep Power
    0

    Question TB Main - automatically be terminated after number of seconds

    Hi there,

    Is there any idea, how to realize an TIMEOUT function
    like demonstrated by the short VBS code below?

    Purpose: detect eventually "hang up" or "endless" code execution.

    VBS Code:
    ----------
    WScript.Timeout = 2
    WScript.Echo "Starting Script"
    WScript.Sleep 5000
    WScript.Echo "Ending Script"
    
    Output:
    -------
    Starting Script
    Script execution time was exceeded on script "C:\test.vbs".
    Script execution was terminated.
    
    See here:
    https://www.devguru.com/content/tech...t-timeout.html

    Tx

    Ben

  2. #2
    Hi Ben,

    the example you provided rely on event,
    you can achieve this with DIALOG SET TIMER.
    for usage, see samples :\thinBasic\SampleScripts\UI\CallBacks\_TBGL\TBGL_Control2_TimerC.tbasic or \thinBasic\SampleScripts\UI\Timer\Timer_Sample.tBasic

    For a console script, you would have to check regularly the elapsed time (i.e. inside a loop)
    Edit: Though, in this case, the 'check' may not catch an endless code execution if not well placed.
    Last edited by DirectuX; 03-03-2020 at 15:00.
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  3. #3
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,525
    Rep Power
    170
    IT has more than just the windows-timer. For example to core built-in Hires-timer that is able to measure fractions of microseconds, or even the common cTimer-class. If that's not enough then there is the ordinary GetTickCount but that's only good above 150ms. Dialog Set Timer is pretty much the same, not very accurate and it can happen the timer will not call back on time.

    And I have also a question about some undocumented module iType ... What does it do? How to access it? I discovered 2 more functions in filemodule - not documented neither Disk_Size("c:\") and Disk_Free("d:")...
    And I found an interesting keyword cLoadOCX but no documentation about it. Is it a class or just a subelement of a built-in UDT? Can it load customizs ActiveX controls? Or is there a way to do so?
    I think there are missing some Forum-sections as beta-testing and support

Similar Threads

  1. thinBasic main web page
    By ErosOlmi in forum Web and Forum
    Replies: 7
    Last Post: 28-08-2016, 09:13
  2. What is the main TBGL Setup ?
    By D.J.Peters in forum TBGL General
    Replies: 10
    Last Post: 18-03-2010, 22:12
  3. New possible idea: TBMain function automatically executed
    By ErosOlmi in forum thinBasic vaporware
    Replies: 12
    Last Post: 31-07-2008, 21:27
  4. How to get all computers/IP's on a lan automatically?
    By Michael Hartlef in forum Tcp/Udp module
    Replies: 2
    Last Post: 20-04-2008, 14:05
  5. ODE Sample #01 - 2 seconds with flying sphere :)
    By Petr Schreiber in forum ODE - Open Dynamics Engine
    Replies: 3
    Last Post: 10-08-2007, 22:46

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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