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. Use QAxScriptManager
Qt 6.11 is out! See what's new in the release blog

Use QAxScriptManager

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.9k Views 1 Watching
  • 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.
  • L Offline
    L Offline
    lucky
    wrote on last edited by
    #1

    Hello. I want to use QtScript in MS Word. I never did it and wrote an example:
    @QAxObject *WordApplication = new QAxObject("Word.Application", this);
    WordApplication->setProperty("Visible", true);
    QAxScriptManager *scriptManager = new QAxScriptManager(this);
    scriptManager->addObject(WordApplication);
    scriptManager->load("Documents.Add.TypeText("Hello :)")", "myscript", "JavaScript");@
    but it does not work. Please help me with errors and if there is - to give a piece of working code.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      Hi,

      I never tried this, but one thing came into my mind:

      what is Document in line 5? You try to use VBScript from MS word inside Qt?
      Is there somewhere stated, that "QAxScriptManager":http://doc.qt.nokia.com/latest/qaxscriptmanager.html executes scripts inside the active X objects? I didn't find it.

      Additionally, to execute the script, you have to call: QAxScriptManager::call(...)

      As far as I understood, QAxScriptManager executes windows scripts, not application scripts...

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lucky
        wrote on last edited by
        #3

        Thank you for having responded to my question. I wanted to use ECMAScript in MS Word. I have never enjoyed QAxScriptManager class and did not find examples with him even in the developer blog Qt.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          I think, it's not possible to access the word scripting this way. perhaps you can query QAxObject("Word.Application", this); for the scripting instance and start the scriptsv there, but not via QAxScriptManager.

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lucky
            wrote on last edited by
            #5

            I will do so:
            @
            QAxObject(“Word.Application”, this);
            @

            Thank you very much for your help:).

            Edit: fixed code layout; Andre

            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