Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QAxScriptManager and QAxScript problem when used inside a QThread's run() function
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.3k Views
  • 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 Offline
    A Offline
    amahta
    wrote on last edited by
    #1

    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
    0
    • A Offline
      A Offline
      amahta
      wrote on last edited by
      #2

      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
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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
        0
        • A Offline
          A Offline
          amahta
          wrote on last edited by
          #4

          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
          0
          • A Offline
            A Offline
            amahta
            wrote on last edited by
            #5

            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
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved