Automation of a procedure

Here is my question about the automation of a procedure. Can Base perform this kind of automation via a button, for example?

The objective is to enter a Wikipedia internet address in a field provided for this purpose in the Base database.

The steps would be as follows:

1 - Retrieves the name of an actor in the ‘Actor’ field of the DB.
2 - Format the name for Wikipedia search, say Tom Cruise would be (Tom_Cruise)
3 - Open the internet browser, say Firefox.
4 - Run a search in the Wikipedia database
(https://en.wikipedia.org/wiki/Tom_Cruise)
5 - Retrieves the internet address of the Wiki page found
6 - Enter this address in the Wiki field of the database provided for this purpose.

Is It possible and how to do that?

Hello,
.
Some of this is possible but makes little sense in ways.
.
You can have a macro to search using any browser but based upon your question, the search is always using `https://en.wikipedia.org/wiki/`` with the actor name. Then you want to store that? Seems like nothing but a waste of space.
.
Then there is the probability of incorrectly spelled names. That will generate basically a similar page for every incorrect spelling. See → https://en.wikipedia.org/wiki/Tom_Crusie
.
Again, see no need to save this URL.
.
The lookup only takes a couple of lines of basic:

sPhrase = "https://en.wikipedia.org/wiki/Tom_Cruise"
oShell = createUNOService("com.sun.star.system.SystemShellExecute")
oShell.execute(sPhrase, "", 1)

Just need to use a variable instead of Ton_Cruise
.
This is code used and tested with LO v7.4.3.2 on Ubuntu 20.04.5

You are quite right Ratslinger. I did some other tests with other sites of this type and the possible inaccuracies are too numerous, therefore ultimately useless.

Thank you for taking your time to respond to this request.

Ratslinger,

I would like to go back to step 5 and 6 of the previously mentioned routine.

Let’s say that I have an open and active web page and that I want to extract the URL or http address and then insert this extraction into a field of a form provided for this purpose. What would be the routine to use? Can you help me please.

.
Copy & Paste

FYI been doing this for years with thousands of URL’s

Well, I understand… I was already doing that. Unfortunately I’m not a programmer and I didn’t really realize that we weren’t there yet. I just believed that this kind of action could be easily automated in the computer world and that a simple click of a button could perform this kind of task. This is not the case, so I will follow your recommendation. Thank you for your time.

Hmmmm. Did not say or suggest any of that. Only stated what routine I used and thought was best. Seems a few clicks isn’t tough. If dealing in an automated process you will reduce the number of clicks a bit. But you also need the time and effort to get some code working. And then there or other situations possibly like various browsers and multiple tabs and even multiple occurrences of the same browser open. Then what?
.
Copy & Paste is sounding better.
.
Did find a possibility by using python → get active url on chrome and firefox using python - Stack Overflow
.
Will attempt to take a little deeper look when time permits. This may be tougher for you to implement.
.
Personally not sure of the benefit(s).

https://forum.openoffice.org/en/forum/viewtopic.php?t=92331&p=438435#p438435
The substitution of space with underscore can be done with SQL.

SELECT 'https://en.wikipedia.org/wiki/' || REPLACE("Actor Name", ' ', '_') AS "URL", other_fields FROM "table name"

Then assign the URL-button to the “URL” column.

OK, but now the request is to save into the DB the URL currently in the browser - whatever that might be.

Not made easier as a lot of people have 10 tabs open at the same time, and sometimes even a second browser.
.
On first sight I’ve thought on using a web-scraping library like Selenium, but the better way would be to work with a data-API, if available.

I very much appreciate the time you are taking to find a solution to this query. Ratslinger enlightened me a lot about the sequence and its relevance.
.
I’ll summarize what I take away from this, considering that this sequence could be run from a button.
.
Step 1 - Retrieves the name of an actor in the ‘Actor’ field of the DB.
.
This step in itself is not complex to perform. A few lines of code are enough to check if the Actor field is empty or not, and to retrieve the name to place it in an ActorName variable for subsequent manipulations.
.
Step 2 - Format the name for Wikipedia search, say Tom Cruise would be (Tom_Cruise)
Step 3 - Open the internet browser, say Firefox.
Step 4 - Run a search in the Wikipedia database (Tom Cruise - Wikipedia)
.
This is where things can get problematic and unnecessary. Consider that the http header or the URL of a Database like Wikipedia always has the same format to access the actor’s web page, like "https://en.wikipedia.org/wiki/" & ActorName; then you just have to format the name put in the variable so that it matches the general conventions found on Wikipedia. There, Ratslinger is absolutely right in mentioning that a single spelling error, an unexpected upper or lower case letter and the accessibility of the web page is compromised.
.
If however it works and the web page opens as desired, there is no need to go further in the procedure because the internet address thus created during step 1 and 2 can simply be inserted in the field provided for this purpose in the form.
.
However, it remains uncertain how to do it, because the slightest change in the Wikipedia http header and a different way of formatting the name of the actor makes it useless. Just consider that it might work half the time; so, I just avoided some copy/pasting. But it’s not good to do things by halves.
.
Step 5 - Retrieves the internet address of the Wiki page found or active
Step 6 - Enter this address in the Wiki field of the database provided for this purpose.
.
Consider that steps 1 to 4 are useless or not usable, so I would like to fall back on steps 5 and 6 to avoid having to do multiple copy/paste from the internet browser to the DB form field provided for this purpose . Why? By simple laziness, why do these manipulations repeatedly if the computer, thanks to a simple click, can do it for us and perhaps more efficiently.
.
I understand that these two steps require greater programming complexity because we are talking about gathering information from a medium that is external to the DB in order to insert it into it. We can simplify the process by mentioning that the web page is already found following a manual search and it is active. Clicking the button in the DB just sets in motion the external gathering process (active Web page of an X browser), in this case the URL and inserts this URL in the field provided for this purpose.
.
However, following the comments of Ratslinger, Villeroy and Wanderer, I realize that it is much more complex than I thought and that it would require a lot of programming time just to avoid this laziness of copying and pasting from the browser to the DB.
.
With the skills I have in the field of programming, it is absolutely impossible to achieve such a thing and I do not believe I have the right to ask someone to do it for me.
.
Thank you all!