Book a Demo

Author Topic: RunHTMLReport invalid arguments  (Read 6954 times)

timconinx

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
RunHTMLReport invalid arguments
« on: July 25, 2018, 05:46:28 pm »
Hello

When I try to script the RunHTMLReport method, like thus
Code: [Select]
Repository.GetProjectInterface().RunHTMLReport("{89CC255F-72C3-486f-90C4-20D45E5AD61E}", "H:\\_Projecten\\EA\\Sparx\\htmlexports\\applicaties", "png", "<default>", "html") I always get the error "invalid arguments" (even though the documentation specifies five string arguments)

When I try to script the RunReport method as a test, everything works perfectly
Code: [Select]
Repository.GetProjectInterface().RunReport("{89CC255F-72C3-486f-90C4-20D45E5AD61E}", "Diagram Report", "H:\\_Projecten\\EA\\Sparx\\htmlexports\\applicaties\\test.pdf")
I'm using EA 12.1... are there any known problems or things I'm missing?

Thanks!
Tim

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: RunHTMLReport invalid arguments
« Reply #1 on: July 25, 2018, 06:29:02 pm »
No  idea since I never used it. Try adding a backslash at the end of the path name.

q.

timconinx

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: RunHTMLReport invalid arguments
« Reply #2 on: July 25, 2018, 06:45:05 pm »
Same problem, also when changing "png" to ".png" or "html" to ".htm" or leaving the last three arguments empty strings ==> "invalid arguments"

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RunHTMLReport invalid arguments
« Reply #3 on: July 25, 2018, 06:58:19 pm »
Tim,

Which language are you using?

Here's an example in VBScript that works: https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/e6c1949ed678c9976c1e6e1294e4331d02aa0138/Framework/Publish/ExportHTML.vbs

If you are using VBScript you should not escape backslashes.

But I think I know what is going wrong. You should use the XMLGUID format for this operation:

Code: [Select]
packageGUID = projectInterface.GUIDtoXML(rootPackage.PackageGUID)
projectInterface.RunHTMLReport packageGUID, exportPath, ".png", "<default>" , ".html"

Geert

timconinx

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: RunHTMLReport invalid arguments
« Reply #4 on: July 25, 2018, 07:38:14 pm »
Hello Geert

I was using JScript, but I tried your example with the XMLGUID instead of the normal GUID in VBScript

Unfortunately, it halts on the exact line where we call RunHTMLReport, this time without a clear error ('Error' at line 42)


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RunHTMLReport invalid arguments
« Reply #5 on: July 25, 2018, 07:56:16 pm »
Tim,

Can you post the updated code?
I suspect you have some kind of syntax error.

Geert

timconinx

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: RunHTMLReport invalid arguments
« Reply #6 on: July 25, 2018, 08:52:53 pm »
This is the (adapted) code based on your example

I am within my project so the openFile wasn't necessary;
The msgBox line returns the expected data.

Code: [Select]
'[path=\Framework\Publish]
'[group=Publish]
option explicit

'
' Script Name: ExportHTML
' Author: Geert Bellekens
' Purpose: Export the model HTML format. This script is suitable to be executed as a scheduled task in order to export the model
' to HTML and publish it on a webserver or sharepoint site.
' Date: 09/06/2016
'
sub main
dim repository
dim projectInterface
set repository = CreateObject("EA.Repository")

'the path to put the inital export to
dim exportPath
exportPath = "H:\_Projecten\EA\Sparx\htmlexports\applicaties"

' the path where the exported model should be copied to (sharepoint location, or webserver)
' in case of a sharepoint location make sure to use the UNC path (\\sharepoint-site\location\)
' and make sure that section of sharepoint not version controlled (no check-in/checkout)
dim publishPath
publishPath = "http://sharepoint/sites/documentendatabank/EnterpriseArchitecture/SparxExports"

'the path to the eap file
'dim eapPath
'eapPath = "C:\temp\TMF SQL Server shortcut.EAP"

'open the model
'repository.OpenFile eapPath

'get project interface
set projectInterface = repository.GetProjectInterface()

dim packageGUID
dim rootPackage
rootPackage = "{89CC255F-72C3-486f-90C4-20D45E5AD61E}"
packageGUID = projectInterface.GUIDtoXML(rootPackage)
msgBox(packageGUID + exportPath)
projectInterface.RunHTMLReport packageGUID, exportPath, ".png", "<default>" , ".html"

'copy the export to sharepoint or webserver location
dim fileSystemObject
set fileSystemObject = CreateObject( "Scripting.FileSystemObject" )
fileSystemObject.CopyFolder exportPath, publishPath
end sub

main

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RunHTMLReport invalid arguments
« Reply #7 on: July 25, 2018, 09:38:18 pm »
Tim,

This works for me to create html export from within EA. (make sure the export path exists)
It still fails on the copy statement because of the invalid sharepoint url.
You have to use an UNC format to get it to copy to sharepoint.

Code: [Select]
'[path=\Framework\Publish]
'[group=Publish]
option explicit

'
' Script Name: ExportHTML
' Author: Geert Bellekens
' Purpose: Export the model HTML format. This script is suitable to be executed as a scheduled task in order to export the model
' to HTML and publish it on a webserver or sharepoint site.
' Date: 09/06/2016
'
sub main
'dim repository
dim projectInterface
'set repository = CreateObject("EA.Repository")

'the path to put the inital export to
dim exportPath
exportPath = "C:\Temp\EA\html"

' the path where the exported model should be copied to (sharepoint location, or webserver)
' in case of a sharepoint location make sure to use the UNC path (\\sharepoint-site\location\)
' and make sure that section of sharepoint not version controlled (no check-in/checkout)
dim publishPath
publishPath = "http://sharepoint/sites/documentendatabank/EnterpriseArchitecture/SparxExports"


'get project interface
set projectInterface = repository.GetProjectInterface()

dim packageGUID
dim rootPackage
rootPackage = "{A5CA6155-C51A-4486-99F2-4A6F97D3C8B3}"
packageGUID = projectInterface.GUIDtoXML(rootPackage)
projectInterface.RunHTMLReport packageGUID, exportPath, ".png", "<default>" , ".html"

'copy the export to sharepoint or webserver location
dim fileSystemObject
set fileSystemObject = CreateObject( "Scripting.FileSystemObject" )
fileSystemObject.CopyFolder exportPath, publishPath
end sub

main

Geert

timconinx

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: RunHTMLReport invalid arguments
« Reply #8 on: July 25, 2018, 09:56:27 pm »
Hi Geert

Removing the first 'repository' lines at least gives me back the original error, I also tried to create a new export path in C: but to no avail.
I also removed the publishing part of the script, just to be sure.

But at the RunHTMLReport line the script stops with the error "Invalid procedure call or argument". To be sure I copy/pasted the line from your code.

It leads me to believe there is something wrong with our installation (although it's weird that html reporting through the UI just works, and scripting RunReport also works). EA 12.1 is installed on a citrix server which we access through our laptops on which we have very few rights. There is also an EA 14.0 in UAT, but on that I'm not even able to run scripts (grayed out buttons), although the license seems okay (corporate edition)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RunHTMLReport invalid arguments
« Reply #9 on: July 25, 2018, 10:02:50 pm »
Tim,

Weird. I can't reproduce the error. On my machine it either works (if the export path exists) or it fails silently (if the path doesn't exist)

Maybe try sparx support. They might have encountered a similar issue.

Geert

timconinx

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: RunHTMLReport invalid arguments
« Reply #10 on: July 25, 2018, 10:34:05 pm »
OMG I found it... the solution was actually in my last answer.

I used the htmlreporting UI from EA 14, but as I said I was unable to script in 14 I ran the script in EA 12. The error I got was EA 12 complaining about unknown internally saved options from my last manual run, which were set by EA 14.

So I did the reporting manually from EA 12, and then ran the script in the same EA, and BOOM: html report

Sorry for wasting your time, Geert  :-X

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RunHTMLReport invalid arguments
« Reply #11 on: July 25, 2018, 11:33:04 pm »
Sorry for wasting your time, Geert  :-X
No time was wasted. Next time I see a similar error I will remember this thread and know where to look :)

Geert