Ask Your Question
0

How to open a file with http authentication with a macro (conveniently) [closed]

asked 2013-12-04 21:27:15 +0200

Shane gravatar image

I have written a macro to open an xml file which is protected by http authentication in calc -

dim sURL as string 
dim oArgs(0) As New com.sun.star.beans.PropertyValue
dim oDocStatus as object
dim oihandler 
oihandler = createUnoService("com.sun.star.task.InteractionHandler")
sURL = "http://127.0.0.1:8080/requests/status.xml"
oArgs(0).Name = "InteractionHandler"
oArgs(0).Value = oihandler
oDocStatus = StarDesktop.loadComponentFromURL(sURL, "_default", 0, oArgs)

This works fine except that each time I run it -

  1. I have to key in my user name / password in an Authentication Required window
  2. I have to click OK on the subsequent "Text Import" window.

How could I improve this macro to avoid repetitively doing these actions? (removing http authentication from the xml page is not possible)

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-11-16 14:21:32.229155

1 Answer

Sort by » oldest newest most voted
0

answered 2013-12-09 04:49:46 +0200

Waraqa gravatar image

If it's a standard http authentication, you can try to add it to the url this way: http://USERNAME:PASSWORD@127.0.0.1:8080/requests/status.xml

edit flag offensive delete link more

Comments

I tried that and recieved an error - BASIC runtime error. An exception occurred Type: com.sun.star.lang.IllegalArgumentException Message: Unsupported URL http://user:pass@127.0.0.1:8080/requests/status.xml.

In case anyone has the same question, I have moved the topic to - https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=66160

Shane gravatar imageShane ( 2013-12-11 05:24:00 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2013-12-04 21:27:15 +0200

Seen: 696 times

Last updated: Dec 09 '13