Jump to content

Store Word Document in Autoit Gui


 Share

Recommended Posts

Hello

 

Is there anyway to store word documents in Autoit GUI? For example I have a instruction sheet that I want to bundle up with the exe.

So a user simply clicks the icon and the stored document will launch  (Something like how you can add objects like excel sheets in word documents )

(I Know we can launch word files from script directory)

 

Link to comment
Share on other sites

FileInstall

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

As BrewMan mentions, FileInstall if you want to simply include the Word Doc with your script. If you meant actually embedding it in your GUI for reading, I used to use something like this:

#include <GUIConstants.au3>

$file = @DesktopDir & "\Test.doc"
$oWordDoc = ObjGet($file)

If IsObj($oWordDoc) then
    GUICreate ( "Embedded Object Test", 800, 300)
    $GUI_ActiveX = GUICtrlCreateObj($oWordDoc, 10, 10, 780 , 280 )
    GUISetState ()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
    Wend

    GUIDelete ()
EndIf

Be forewarned the ribbon plays havoc with viewing if the GUI is too small

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

17 hours ago, BrewManNH said:

FileInstall

Thanks !
As I understand it this will install soem specific files to a location specified (something like a setup)

My aim is to embed the file in the tool itself and open it up on user click. (it should not be stored as a seperate file in the script directory)

Link to comment
Share on other sites

22 hours ago, JLogan3o13 said:

As BrewMan mentions, FileInstall if you want to simply include the Word Doc with your script. If you meant actually embedding it in your GUI for reading, I used to use something like this:

#include <GUIConstants.au3>

$file = @DesktopDir & "\Test.doc"
$oWordDoc = ObjGet($file)

If IsObj($oWordDoc) then
    GUICreate ( "Embedded Object Test", 800, 300)
    $GUI_ActiveX = GUICtrlCreateObj($oWordDoc, 10, 10, 780 , 280 )
    GUISetState ()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
    Wend

    GUIDelete ()
EndIf

Be forewarned the ribbon plays havoc with viewing if the GUI is too small

Thanks But this uses a file stored in a location right? As I understand this code, it basically launches test.doc from desktop when user click in gui

Is there any way that you can embed the file in the GUI itself.

Link to comment
Share on other sites

  • Moderators

You can with a combination: Use FileInstall to include the file with your executable, then embed it.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

13 hours ago, JLogan3o13 said:

You can with a combination: Use FileInstall to include the file with your executable, then embed it.

Ok so you suggest everytime the script launches, Fileinstall adds the  word file to script location, the user can then click and launch it from the  script location using the GUI.

IF the GUI closes the the file then gets deleted too

Something like that?

Link to comment
Share on other sites

7 hours ago, Neonovaz said:

IF the GUI closes the the file then gets deleted too

nope, FileInstall("source", "dest" [, flag = 0]) will dump/write/copy the file to a destination.
If you wanna remove it, you'll have to write a line of code to do so.

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...