Web search macro using POST method

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
paul1149
Posts: 29
Joined: Mon Jun 27, 2016 12:56 am

Web search macro using POST method

Post by paul1149 »

Hello,

I have a series of macros that search the Web for the current selected text. Here's an example:

Code: Select all

Sub Brave_Lookup : site = "https://search.brave.com/search?q=" : Web_Lookup (site, token) : End Sub 

	Function Web_Lookup (site, token)
	 	oVC = ThisComponent.CurrentController.getViewCursor
		oTC = oVC.getText().createTextCursorByRange(oVC)
		oSel = oTC.string ' get selected text
		Dim SysShell As Object
   	        SysShell = createUNOService("com.sun.star.system.SystemShellExecute")
                SysShell.execute("/usr/bin/vivaldi-snapshot", site & oSel & token, 0) 'vivaldi-snapshot
	End Function
I've simplified that and hopefully have not removed anything necessary. It does work perfectly.

What I want to do now is have a macro that invokes a POST web search. Here's what I'm trying to do:

Code: Select all

https://www.blueletterbible.org/search/preSearch.cfm{POSTARGS}Criteria=%s&t=NASB95&csr=0&csrf=0&csrt=0&cscs={POSTENCODING}UTF-8
I suspect it's simple, but I don't know how to break this down and pass the extra arguments to the Web_Lookup function.

Am I going about this the right way? Thanks!
LibreOffice 7.6.4.1
Post Reply