Page 1 of 1

[Solved] Getting rid of the main window

Posted: Sat Dec 09, 2017 9:04 pm
by mihmih
Hi,

i have a base-file connected to mysql. Mysql is installed on the server on a different computer. And i have a lot of macros. I also have a start screen that starts with the base.

In this case is it possible to get rid of the main base window?

Re: getting rid of the main window

Posted: Sat Dec 09, 2017 9:36 pm
by Villeroy
Embedded form documents can be saved as stand-alone documents. Unfortunately, this will disconnect the logical forms. My macro suite "FreeHSQLDB" has a little extra which takes care of this. Simply install the package and run the FreeForms macro. It will prompt you for a target folder. Any hierarchy of embedded form folders will be reflected in the target directory. The stand-alone form documents can be hyperlinked to each other and desktop links will work as usual.

Re: getting rid of the main window

Posted: Sat Dec 09, 2017 9:48 pm
by Villeroy
Stand-alone Writer reports: viewtopic.php?f=29&t=81229 (simple tables, very slow, not suitable for thousands of records).
Personally, I prefer Calc as reporting engine. Most flexible with a lot of extra features and good enough "pretty printing" capabilities.

Re: Getting rid of the main window

Posted: Mon Dec 11, 2017 4:27 pm
by Nocton
I use this bit of vbs script to get rid of the main window:

Code: Select all

Dim sFileName, sTitle

sFileName = "MyFile.odb"
sTitle = "ERROR"

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")

If Not oFSO.FileExists(sFileName) Then
	oShell.Popup sFileName & "  - file not found", 10, sTitle, vbCritical + vbSystemModal
	Wscript.Quit 1
End If

' run the file with quotes added 1/0 to toggle Base window visible or not
iRC = oShell.Run("""" & sFileName & """", 0, True)

' Return file error level when exiting script
Wscript.Quit iRC

Re: Getting rid of the main window

Posted: Wed Dec 13, 2017 7:24 pm
by mihmih
Thank you for your answers

Villeroy - where can i find this macro suite?
Does it also solve the problem of macros unrelated to transitions between forms and those that generate relevant reports?

Nocton - vbs in openoffice? I dont understand. Can you say more about your code?

Re: Getting rid of the main window

Posted: Wed Dec 13, 2017 7:57 pm
by Nocton
Nocton - vbs in openoffice? I dont understand. Can you say more about your code?
The vbs script runs in Windows to open your application:
1. Copy the code into Notepad and change MyFile.odb to the Base filename you wish to pen.
2. Save with extension .vbs in the folder where your Base file is, e.g. START_myfile.vbs.
3. Now just double-click on START_myfile.vbs to run the script and your application will open with or without the main window according to the setting of 1 or 0 where indicated.

Re: Getting rid of the main window

Posted: Wed Dec 13, 2017 11:47 pm
by mihmih
thanks for the explanation, but I think I'm too stupid :)

I did what you wrote, but the main window and the start screen are opening to me all the time.

Do I need to change something in the following line?

Code: Select all

iRC = oShell.Run("""" & sFileName & """", 0, True)
should I add next zeros between quotes?

Re: Getting rid of the main window

Posted: Thu Dec 14, 2017 10:32 am
by Nocton
Nothing should be changed. This script has worked OK on several PCs and running different versions of window.

Maybe I have misunderstood what you mean by the 'main window'. I thought you meant the Base window that gives access to the Tables, Forms, etc.
When I run the script only the window/form opens that I have set as my 'Main Menu' in the 'Open Document' event of the Base application. If that is indeed what you mean, then I have no idea why the script does not work on your system. If not, then please explain further what you would like to happen.

By the way, when opening like this then the user must finish use Ctrl+Q or File/Exit - just closing the window will leave OO still running.

Re: Getting rid of the main window

Posted: Thu Dec 14, 2017 4:57 pm
by mihmih
I mean exactly what you wrote - the Base window that gives access to the Tables, Forms, etc.

on another computer (where I wanted to apply it) works, thanks a lot!

I have a button to close all, with macro:

Code: Select all

Sub close

Dim oDesktop As Object, oDocs As Object
  Dim oDoc As Object, oComponents As Object
  
  oComponents = StarDesktop.getComponents()
  oDocs = oComponents.createEnumeration()
  Do While oDocs.hasMoreElements()
    oDoc = oDocs.nextElement()
    oDoc.dispose()
  Loop
Wait 1000           

Shell("c:\windows\system32\taskkill.exe",2,"/F /iM soffice.bin")
end sub 

Re: [solved]Getting rid of the main window

Posted: Thu Dec 14, 2017 6:33 pm
by Nocton
Pleased you have got it to work.
And your code to close OO down is a useful addition to this thread.

Re: [Solved] Getting rid of the main window

Posted: Sat Dec 16, 2017 11:32 am
by mihmih
one more thing...i have a warning, when i open this vbs file:

"dont know who created this file, are you sure you want to open it?"

Can I get rid of this?

Re: [Solved] Getting rid of the main window

Posted: Sun Dec 17, 2017 11:51 am
by Nocton
There is a lot on the web about this problem. I have never had it, so cannot comment. Am also now using Windows 10.

Re: [Solved] Getting rid of the main window

Posted: Sat Dec 15, 2018 11:32 am
by mihmih
one year later....

Code: Select all

Dim sFileName, sTitle

sFileName = "MyFile.odb"
sTitle = "ERROR"

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")

If Not oFSO.FileExists(sFileName) Then
   oShell.Popup sFileName & "  - file not found", 10, sTitle, vbCritical + vbSystemModal
   Wscript.Quit 1
End If

' run the file with quotes added 1/0 to toggle Base window visible or not
iRC = oShell.Run("""" & sFileName & """", 0, True)

' Return file error level when exiting script
Wscript.Quit iRC
this script worked very well for wndows7, now I have windows10 and it has stopped working, the main window opens as before. Can anyone know why this code does not work for windows10?

Re: [Solved] Getting rid of the main window

Posted: Sat Dec 15, 2018 7:07 pm
by mihmih
meybe it is because i have windows10 x64 and LibreOffice x84.

Is somewhere to download LibreOffice 4.4.X x64?

Re: [Solved] Getting rid of the main window

Posted: Sat Dec 15, 2018 7:18 pm
by Villeroy
LibreOffice for Windows 64 started with version 5

Re: [Solved] Getting rid of the main window

Posted: Sat Dec 15, 2018 7:20 pm
by Zizi64
Here are all of older versions of the LibreOffice:

https://downloadarchive.documentfoundat ... ffice/old/

Re: [Solved] Getting rid of the main window

Posted: Sun Dec 16, 2018 5:21 pm
by Villeroy
Stand-alone forms work without any Base window

Re: [Solved] Getting rid of the main window

Posted: Tue Dec 18, 2018 3:43 pm
by Nocton
It works OK for Windows 10 on my PC.