Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: OS_Shell - question/issue

  1. #1
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Philippines
    Age
    48
    Posts
    1,235
    Blog Entries
    1
    Rep Power
    135

    OS_Shell - App_ReturnCode-question/issue

    I have one bundled .exe-file that i start from another Script using OS_Shell.
    Help tells, TBMain-Result (of my .exe-file) would get passed somewhere,
    i assumed it would be the OS_Shell-return-value then - but it's in fact the processID that's returned by OS_Shell.
    So where to find return-value of TBMain() /App_ReturnCode after the process has finished?
    - can a bundled .exe-file return something at all besides writing the result into a file?




    Last edited by ReneMiner; 29-08-2015 at 16:12.
    maybe no PC currently but always a head full of ideas

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    51
    Posts
    8,313
    Blog Entries
    2
    Rep Power
    10
    Ciao Renč,

    I need to check the whole process and see if I missed some point where I didn't returned the TBMain return code or APP_SetReturnCode in case no TBMain.
    Maybe the last Bundle version introduced this problem.

    I will let you know.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    51
    Posts
    8,313
    Blog Entries
    2
    Rep Power
    10
    Ciao Renč,

    I've found the problem and fixed.
    By the end of the week I will give you a 1.9.16 version to test.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  4. #4
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Philippines
    Age
    48
    Posts
    1,235
    Blog Entries
    1
    Rep Power
    135
    Which would be the Keyword to retrieve an app-returncode after OS_Shell was called and the process has finished?
    maybe no PC currently but always a head full of ideas

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    51
    Posts
    8,313
    Blog Entries
    2
    Rep Power
    10
    Well, I've fixed the chain of the return code to the operating system.
    In next version, if you will execute a script (both from source or from bundled executable) you will be able to determine a ERRORLEVEL from a .CMD command file like:

    call YourScript.exe
    if errorlevel 1 goto handleerror1orhigher
    if errorlevel 0 echo succuess...
    
    Now I need to understand how to get that return code when SHELLed from inside another application.
    I'm not aware of any way of doing that at the moment.
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  6. #6
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    51
    Posts
    8,313
    Blog Entries
    2
    Rep Power
    10
    I think I've found a way.

    When OS_Shell is executed in async mode, it will return the process id.
    When OS_Shell is executed in sync mode, it will return the executed application exit code.

    I need to change the OS module and make some tests but quite confident I will get it.

    I will let you know.
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  7. #7
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Philippines
    Age
    48
    Posts
    1,235
    Blog Entries
    1
    Rep Power
    135
    sounds good & reasonable.


    is there a way for async-mode to transfer any information back to the application that called
    OS_Shell("otherApplication.exe", %OS_WNDSTYLE_NORMAL, %OS_SHELL_ASYNC)

    while both are still running?
    maybe no PC currently but always a head full of ideas

  8. #8
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    51
    Posts
    8,313
    Blog Entries
    2
    Rep Power
    10
    Well, in async way you can always use the process ID returned by OS_Shell to monitor the process.
    There are a lot of Windows API to use for this purpose.

    Instead, if you mean to let the two process talk each other while running ... in this case there are some ways:
    1. One could be using TCP/UDP on the local server (local machine). Not complex to develop. Some example in \thinBasic\SampleScripts\TCPUDP\
      Check UDP_Notify_Client.tbasic and UDP_Notify_Server.tbasic
      Execute the server and click on "I'm the server"
      Than execute the client and click on "Find server"
      If each other are able to talk, just move the client window and you will see ...
      You can run up to 10 client able to each exchange data with the server.
      Protocol used is very simple, you can invent your own way
    2. another way could be the so called "Interprocess Communications".
      There are many ways in which this can be achieve, some quite complex, some more easy.

    Maybe one day we will develop something in thinBasic in order to let thinBasic scripts to talk each other while running.
    The complex thing is that there are many different ways/data/structures one can invent and making a "general" way is not so easy.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  9. #9
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Philippines
    Age
    48
    Posts
    1,235
    Blog Entries
    1
    Rep Power
    135
    is it possible to share memory-areas between different apps?

    Maybe first script allocates some heap and sends the heap-pointer as a command-parameter on OS_Shell,
    now the second app could set values inside that heap? Or would this lead to some unavoideable access-violation-error?

    Or could it work somehow similar to Oxygen to set a "shared function-pointer" via Declare Function ... At ?
    maybe no PC currently but always a head full of ideas

  10. #10
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    51
    Posts
    8,313
    Blog Entries
    2
    Rep Power
    10
    Unfortunately (or fortunately) memory is by process.

    In general Windows operating system reserve a virtual memory space of 2GB per every process running.
    That virtual memory is by process.

    In old Windows version (mainly 16 bit up to windows 9x) memory was shared between all process and that was one of the reasons why very often a crash in a process was crashing the entire operating system causing the computer to hang. In 32 bit Windows (from W2K) memory cannot be share between process without passing though the OS using some of the techniques I mentioned before.
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

Page 1 of 2 12 LastLast

Similar Threads

  1. OS_Shell("explorer.exe", sPath)?
    By ReneMiner in forum OS
    Replies: 2
    Last Post: 24-02-2015, 08:58
  2. Replies: 2
    Last Post: 20-11-2014, 15:40
  3. Retroaction Issue Two
    By matthew in forum Shout Box Area
    Replies: 3
    Last Post: 12-05-2009, 17:13
  4. PCOPY! Issue #70 now available.
    By MystikShadows in forum PCOPY!
    Replies: 5
    Last Post: 20-06-2008, 20:50

Posting Permissions

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