Search found 12 matches

by MTswitch
Fri Oct 09, 2020 1:06 pm
Forum: Node.js scripting
Topic: SetTimeOut
Replies: 0
Views: 7486

SetTimeOut

Hi, i wolud like to ask, how can i use setTimeout i wrote a for loop and setTimeout must be performed at the loop and every one second a msg log comes in log for (var i = 0; i < 3; i++) { (function (index) { setTimeout(function () { await job.log(LogLevel.Info,index); }, index * 5000); })(i); } i ge...
by MTswitch
Mon Oct 05, 2020 2:11 pm
Forum: Node.js scripting
Topic: NodeJS debugging
Replies: 11
Views: 11234

Re: NodeJS debugging

only way we've found around it is to do a Restart Switch Server from File menu before reactivating the flow. Luckily we have a develop server so we can do that quite freely when developing scripts, but of course it would be nice to have lighter solution... Thanks yes, i do it now but i thought that...
by MTswitch
Mon Oct 05, 2020 1:48 pm
Forum: Node.js scripting
Topic: NodeJS debugging
Replies: 11
Views: 11234

Re: NodeJS debugging

Hi,

i have another problem and I get the error when I stop the flow manually through the task manager
this is an error " the debugging can be enabled for only one script at a time "
i have tried to change port but it didnt work too
anyone knows where is the problem ?
by MTswitch
Fri Aug 21, 2020 5:34 pm
Forum: Node.js scripting
Topic: NodeJS debugging
Replies: 11
Views: 11234

Re: NodeJS debugging

Sunnyland wrote: Fri Aug 21, 2020 7:07 am Make sure you have the document / file in the folder proceeding the script before starting in debug mode.
and start the debugger in attach.
Hi,
Tnaks for your response, yes that was the reason
one file must be in flow
by MTswitch
Thu Aug 20, 2020 3:54 pm
Forum: Node.js scripting
Topic: NodeJS debugging
Replies: 11
Views: 11234

Re: NodeJS debugging

These message show-up when VsCode didn't get a return from switch. There is three main cause : - Switch flow element is not set-up in debug mode - Switch flow is not running - You already done a debug and did'nt restart your switch flow between. But i agree on that, the documentation is a bit uncle...
by MTswitch
Thu Aug 20, 2020 1:20 pm
Forum: Node.js scripting
Topic: NodeJS debugging
Replies: 11
Views: 11234

NodeJS debugging

Hi, i want to know how can i strat debugging a flow in vscode or better to say how can i debug one script flow in vscode i set debug mode yes and port 9229 and by vscode in launch.json this setting set.PNG i active the flow and press F5 for debugging, but occurred this error : debugError.PNG could a...
by MTswitch
Thu Sep 19, 2019 10:17 am
Forum: LEGACY scripting
Topic: send request to get API Token
Replies: 3
Views: 5285

Re: send request to get API Token

i solved the problem and i explain what did i do. first of all when u use basic authentication method, u dont need to write theHTTP.authorization just put username in theHTTP.user and password in theHTTP.password and theHTTP.authScheme is HTTP.BasicAuth in this form username and password are encoded...
by MTswitch
Mon Sep 16, 2019 11:09 am
Forum: LEGACY scripting
Topic: send request to get API Token
Replies: 3
Views: 5285

Re: send request to get API Token

There are many things that could be wrong: is the endpoint correct, do not you have to add the authorization string to a special header, does not the content-type have to be application/json, ...? Without the documentation of the API it is impossible to help. Hi The endpoint is correct i checked it...
by MTswitch
Thu Sep 12, 2019 12:32 pm
Forum: LEGACY scripting
Topic: send request to get API Token
Replies: 3
Views: 5285

send request to get API Token

Hi, i want to send post to request to Api to catch a Token this is my script and i dont know why i received invalid request from the Api. i guss i wrote something wrong in authoriziation but i am not sure var myPostData = {}; // Add Values myPostData['key1'] = "value1"; myPostData['key2'] ...
by MTswitch
Tue Aug 27, 2019 8:01 pm
Forum: LEGACY scripting
Topic: define script expression
Replies: 4
Views: 6157

Re: define script expression

Hi Jan,

but isn't my string result fine?
I deliberately change the date value to a string.
the script result is than 2019_08_23 and the proper job name ist also 2019_08_23
both are strings.
Now, when i compare these two values, the result should be true.
or am I wrong?
by MTswitch
Mon Aug 26, 2019 7:19 pm
Forum: LEGACY scripting
Topic: define script expression
Replies: 4
Views: 6157

Re: define script expression

Hi Jan, thanks for your answer! That helped!!! Where I would have liked to know why the script didn't work or how the correct settings would have been. The Proper Job Name and the script expression string should have the same value (=2019_08_23). But why is the comparsion not true...? greetings. marc.
by MTswitch
Fri Aug 23, 2019 3:59 pm
Forum: LEGACY scripting
Topic: define script expression
Replies: 4
Views: 6157

define script expression

Hi! maybe someone can help me write the script expression in switch on a condition with variables. I would like to compare the Proper Job Name (it is: "2019_08_23") with the scripted comparison value like this: var pubdate = new Date(); var pubdateday = pubdate.getDate()+""; var ...