Jump to content

Macros/ScriptForge/PythonInputBoxQuickwin

From The Document Foundation Wiki


These are short snippets for easy insertion in user's code of powerful functions.

  • The loading of the ScriptForge Basic library is presumed done elsewhere.
  • All used variables are declared explicitly.
  • The concerned code is presented inside a BASIC function and/or a Python def. They may contain alternative syntaxes or options.
  • Copy/paste what is useful to you.

How to run an inputbox (Python-only)

Authored 5 days ago by Jean-Pierre Ledure.

###	How to run an input box dialog
###	Minimal required version: LibreOffice 7.6
### 	Used service(s)	Basic
def inputbox():
	basic = CreateScriptService('Basic')
	return basic.InputBox(prompt = 'Enter an input string or press Cancel',
						  title = 'Python input box',
						  default = 'Something relevant')

See also