Page 1 of 1
[Solved] Open with default text editor
Posted: Tuesday 24th March 2020 1:10pm
by Philippe734
Hello,
In my app, I wish to open a text file with the default text editor of the system. Please, how to do ? I know with bash, but is there a native Gambas command ?
Re: Open with default text editor
Posted: Tuesday 24th March 2020 2:59pm
by stevedee
Philippe734 wrote: ↑Tuesday 24th March 2020 1:10pm
In my app, I wish to open a text file...
As an alternative, take a look at "TextEditor" in the component: gb.form.editor
Re: Open with default text editor
Posted: Tuesday 24th March 2020 3:18pm
by Philippe734
Shell "xdg-open PathToMyFile.txt"
Or
EXEC ["xdg-open", "PathToMyFile.txt"]
Re: [Solved] Open with default text editor
Posted: Tuesday 24th March 2020 6:17pm
by vuott
...but if you are writing a graphic program, you can activate "
gb.desktop" Component and then use "
Desktop" Class:
Public Sub Button1_Click()
Desktop.Open("/path/to/myFile.txt")
End
or by using "
DesktopFile" Class of "
gb.desktop" Component:
https://www.gambas-it.org/wiki/index.ph ... _associato
Re: [Solved] Open with default text editor
Posted: Tuesday 24th March 2020 10:42pm
by Quincunxian
if you want more than just a simple text document, you can also use Libre Office to open documents if you have it installed
Either method works:
EXEC["libreoffice","--writer example.txt"]
Command line applications for the various formats of Libre Office.
LibreOffice is shortened to lo with the addition of the various document type.
EXEC["localc","example.csv"]
Full command line list can be found
here.