sciter-sdk / go-sciter

Golang bindings of Sciter: the Embeddable HTML/CSS/script engine for modern UI development
https://sciter.com
2.57k stars 269 forks source link

stdout.println() doesn't work #243

Open WinXaito opened 3 years ago

WinXaito commented 3 years ago

Hello,

I'm coming to you because I can't display logs in the console, stdout.println("..."); doesn't work in Tiscript.

I added "ALLOW_SYSINFO", "SW_ENABLE_DEBUG", but it still doesn't work.

Try it with:

Here's a simple example that doesn't work:

main.go

package main

import (
    "fmt"
    "github.com/sciter-sdk/go-sciter"
    "github.com/sciter-sdk/go-sciter/window"
    "path/filepath"
)

func main() {
    sciter.SetOption(sciter.SCITER_SET_SCRIPT_RUNTIME_FEATURES, sciter.ALLOW_SYSINFO|sciter.ALLOW_EVAL|sciter.ALLOW_FILE_IO|sciter.ALLOW_SOCKET_IO)

    w, err := window.New(sciter.SW_TITLEBAR|sciter.SW_RESIZEABLE|sciter.SW_CONTROLS|sciter.SW_MAIN|sciter.SW_ENABLE_DEBUG, nil)
    if err != nil {
        fmt.Println(err)
    }

    ok := w.SetOption(sciter.SCITER_SET_DEBUG_MODE, 1)
    if !ok {
        fmt.Println(err)
    }

    fullpath, err := filepath.Abs("./gui/simple.htm")
    if err != nil {
        fmt.Println(err)
    }

    err = w.LoadFile(fullpath)
    if err != nil {
        fmt.Println(err)
    }

    w.Show()
    w.Run()
}

simple.htm

<html>
    <head>
        <meta charset="UTF-8">
        <title>Test</title>
        <script rel="text/tiscript">
            stdout.println("This text doesn't appear in console");
        </script>
    </head>
    <body>
        <h1>Test</h1>
    </body>
</html>

When I run the program with Goland, I've got nothing in the output:

image

Same with terminal:

image

pravic commented 3 years ago

SciterSetupDebugOutput is supposed to print the output. I'll check it.

bloeys commented 3 years ago

Any updates on this? This is also happening on Sciter.JS on Windows 10.