Can't run Change Type scripts anymore (Premium)

Started by JoCriSem, October 28, 2020, 14:51:18 PM

Previous topic - Next topic

JoCriSem

When running a change type script I am getting this error message:  Script Error: com.archimatetool.script.ArchiScriptException: Could not create element of type: business role
Anyone any idea of what could be wrong?
The 'examples' scripts just run fine.

I am using v4.7.1 on MacOS and the plugin version is com.archimatetool.script_0.8.0.202006231201.archiplugin

Thanks.

Phil Beauvoir

October 28, 2020, 14:54:05 PM #1 Last Edit: October 28, 2020, 14:55:52 PM by Phil Beauvoir
What script is it that you are running?

Can you post part of the script.

Note that it should be "business-role".
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

JoCriSem

Phil, this error was the result of running the Change Type - Business Role script (see attachement).
This has worked just fine, till now.
This is the entire script:

load(__DIR__+"/../ConvertConcept.lib.js");

convert(selection, getTypeFromFilename());

function getTypeFromFilename() {
  return __FILE__.replace(/^.*\//, '').replace(/\.ajs$/, '').replace(/%20/, '-').toLowerCase();
}



Phil Beauvoir

Try and debug it and see what values are returned from the function calls.
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

bigyin

Phil, issues seems more fundamental.. all scripts are not running now. However if I try on another Archi instance (in VM) no issue. Wonder if good ol MS have patched something and broken the stack.

Phil Beauvoir

October 29, 2020, 10:46:36 AM #5 Last Edit: October 29, 2020, 11:01:56 AM by Phil Beauvoir
@JoCriSem - I had to do some detective work to figure out what was going on. Please, next time, could you provide more information to make this easier? A link to the source script would have helped. Thanks.

The script in question came from here:

https://gist.github.com/jbsarrodie/45a312cff559d23cf55ed102422e8af7

It seems that Mac uses " " and Windows uses "%20" characters in file paths.

See this comment for a fix:

https://gist.github.com/jbsarrodie/45a312cff559d23cf55ed102422e8af7#gistcomment-3508647
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

Phil Beauvoir

Quote from: bigyin on October 29, 2020, 10:06:43 AM
Phil, issues seems more fundamental.. all scripts are not running now. However if I try on another Archi instance (in VM) no issue. Wonder if good ol MS have patched something and broken the stack.

Tested on Windows (and Mac) and all my test scripts are running.
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

JoCriSem

@Phil, apologies.  Didn't know what you needed as info when reporting the issue.

Thanks for the answer.  It seems to work now.  Still doesn't explain why it has worked on my Mac before.

I'll update all scripts accordingly.

Thanks again.