Info from PC¶
Operate system
app.msgbox(app.OS)
Current user
app.msgbox(app.USER)
Name PC
app.msgbox(app.PC)
Name desktop, only GNU/Linux
app.msgbox(app.DESKTOP)
Language
app.msgbox(app.LANG)
Language with variant
app.msgbox(app.LANGUAGE)
Application name
app.msgbox(app.NAME)
Application version
app.msgbox(app.VERSION)
In Windows
app.msgbox(app.IS_WIN)
Message box¶
app.msgbox(app.IS_WIN, 'My Macro')
Show warning¶
message = 'Caution, this action is dangerous'
title = 'My App'
app.warning(message, title)
Show error box¶
message = 'ERROR: Contact technical support'
title = 'My App'
app.errorbox(message, title)
Make question¶
message = 'Is easy Python?'
title = 'My App'
result = app.question(message, title)
app.msgbox(result)
InputBox¶
Normal data
message = 'Type your name'
default = ''
title = 'My App'
result = app.inputbox(message, default, title)
app.msgbox(result)
Private data
message = 'Type your password'
default = ''
title = 'My App'
echochar = "*"
result = app.inputbox(message, default, title, echochar)
app.msgbox(result)
Create instances¶
Instances without context
toolkit = app.create_instance("com.sun.star.awt.Toolkit")
Instances with context
service = 'com.sun.star.awt.DialogProvider2'
dialog = app.create_instance(service, True)
Paths and files¶
Get info path
path = '/home/mau/myfile.ods'
p = app.paths(path)
app.debug(p.path)
app.debug(p.file_name)
app.debug(p.name)
app.debug(p.ext)
app.debug(p.url)
Or get information in a tuple
path = '/home/mau/myfile.ods'
p = app.paths(path)
app.debug(p.info)
Get path home
path = app.paths.home
app.debug(path)
Get path documents
path = app.paths.documents
app.debug(path)
Get path temp
path = app.paths.temp_dir
app.debug(path)