Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QAxScriptManager and QAxScript problem when used inside a QThread's run() function

    General and Desktop
    2
    5
    1037
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      amahta last edited by

      I've a simple VBScript code which I'm executing using QAxScriptManager and QAxScript in Windows.
      The same exact VBScript returns an error complaining there is no such function in my VBScript file when I'm trying to execute it inside the thread's run() function.
      Note that the script works when it is called from outside run() function, for example in thread's constructor.
      Any idea why this happens?

      Thou shalt programme
      http://www.amin-ahmadi.com

      1 Reply Last reply Reply Quote 0
      • A
        amahta last edited by

        I noticed that the cause of the problem is here, but still can't see why this is happening.
        @
        QAxScriptManager *scrMgr = new QAxScriptManager(this);
        QAxScript *scrpt = scrMgr->load(":/Scr/SomeScr.vbs", "MyScr");
        if(!scrpt)
        // QAxScriptManager failed to load the script!
        @

        QAxScriptManager::load() function returns 0 :(

        Thou shalt programme
        http://www.amin-ahmadi.com

        1 Reply Last reply Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi,

          Maybe "this":http://www.qtcentre.org/threads/54679-QAxScriptManager-not-returning-a-QAxScript*-for-VBScript will help

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply Reply Quote 0
          • A
            amahta last edited by

            Unfortunately not. He mentions the following code solved his problem.
            @
            QWidget *widget = new QWidget();
            QAxScriptManager *m_manager = new QAxScriptManager(widget);
            @
            But I'm not allowed to create a widget inside a non-gui thread. Creating a QObject also didn't help!

            Thou shalt programme
            http://www.amin-ahmadi.com

            1 Reply Last reply Reply Quote 0
            • A
              amahta last edited by

              I'm changing to QTimer for the time being, cause it also solves my problem but it wouldn't be a threaded application design the way I want it :(

              Thou shalt programme
              http://www.amin-ahmadi.com

              1 Reply Last reply Reply Quote 0
              • First post
                Last post