Start Macro from Hidden writer document

Creating a macro - Writing a Script - Using the API

Start Macro from Hidden writer document

Postby Touf2638 » Thu Aug 22, 2019 4:28 pm

Hello,
I launch a macro from .net application in a writer document to generate a QRCode. My problem is I need to launch document hidden and when document is hidden, macro seems unreach document.
When I start with hidden=false it works fine.

Is there a way to refer thiscomponent to an hidden document ?
Thanks
OpenOffice 6.2 on Windows 10
Touf2638
 
Posts: 14
Joined: Tue Aug 20, 2019 4:21 pm

Re: Start Macro from Hidden writer document

Postby JeJe » Thu Aug 22, 2019 7:27 pm

Have you tried hiding it by positioning it off screen (by setting the window x value to minus the width for example) instead of not visible?

Edit: another alternative would be to hide it behind another open window... perhaps by making it minimum size and the other open window a topmost window. You may be able to use Api calls to change the window style so it doesn't appear in the Windows taskbar.
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 629
Joined: Wed Mar 09, 2016 2:40 pm

Re: Start Macro from Hidden writer document

Postby Touf2638 » Thu Aug 22, 2019 8:56 pm

It's a good idea. I will look how change position of writer application if it is possible.
OpenOffice 6.2 on Windows 10
Touf2638
 
Posts: 14
Joined: Tue Aug 20, 2019 4:21 pm

Re: Start Macro from Hidden writer document

Postby Touf2638 » Mon Aug 26, 2019 10:07 am

I have try to change position but I need to open document before change. So I see application then I see my change...
So I need to find and other way. Any idea ?

Cod eto change position if somebody need

Code: Select all   Expand viewCollapse view
                Dim vFrame As Object, intXPos As Integer, intYPos As Integer, intHeight As Integer, intWidth As Integer
                vFrame = Document.getCurrentController.getFrame()
                vWindow = vFrame.getContainerWindow()
                intXPos = 6000
                intYPos = 6000
                intHeight = 1
                intWidth = 1
                vWindow.setPosSize(intXPos, intYPos, intWidth, intHeight, unoidl.com.sun.star.awt.PosSize.POSSIZE)
OpenOffice 6.2 on Windows 10
Touf2638
 
Posts: 14
Joined: Tue Aug 20, 2019 4:21 pm

Re: Start Macro from Hidden writer document

Postby Touf2638 » Mon Aug 26, 2019 10:13 am

If it's possible to show and hidden document, it can works but I don't know how show a document open with hidden property
OpenOffice 6.2 on Windows 10
Touf2638
 
Posts: 14
Joined: Tue Aug 20, 2019 4:21 pm

Re: Start Macro from Hidden writer document

Postby Touf2638 » Mon Aug 26, 2019 10:37 am

Ok i find Document.currentController.Frame.ContainerWindow.setVisible(True)
So I open document hidden, I change position out of screen then I set visible to true.
It works.
At the end I do reverse because if you let with parameters out of screen, when you launch manually open office it keep this parameters.
Thanks
OpenOffice 6.2 on Windows 10
Touf2638
 
Posts: 14
Joined: Tue Aug 20, 2019 4:21 pm

Re: Start Macro from Hidden writer document

Postby RoryOF » Mon Aug 26, 2019 10:41 am

If the visible/hiding of the document is too obtrusive, you might experiment with making it visible but minimised.
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29921
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 4 guests