Search found 61 matches

by bkromer
Tue Sep 29, 2020 10:09 am
Forum: LEGACY scripting
Topic: Switch Webhooks
Replies: 13
Views: 766

Re: Switch Webhooks

Okay, I have the Webserver up and running with the following javascript. function getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i<vars.length;i++) { var pair = vars[i].split("="); if(pair[0] == variable){return pair[1];} } ret...
by bkromer
Mon Sep 28, 2020 4:20 pm
Forum: LEGACY scripting
Topic: Switch Webhooks
Replies: 13
Views: 766

Re: Switch Webhooks

Your URL needs to include the data like what is suggested before. https://yoururl?jobnumber=123456&filename=GES.pdf&numberOfCopies=150 That will then be picked up on the webserver and from there you can send it to Switch. So you QR-code should include the URL with variables. There is a lot of info ...
by bkromer
Mon Sep 28, 2020 1:54 pm
Forum: LEGACY scripting
Topic: Switch Webhooks
Replies: 13
Views: 766

Re: Switch Webhooks

In Switch you need a webhook element with this Path property: /Switch/ReleaseJob (or anything else of course if you edit the code) If the php file is hosted on the Switch server, the url in the code is "http://localhost:51080/Switch/ReleaseJob", otherwise replace "localhost" with IP address. An yes...
by bkromer
Mon Sep 28, 2020 1:39 pm
Forum: LEGACY scripting
Topic: Switch Webhooks
Replies: 13
Views: 766

Re: Switch Webhooks

Where is the QR-code? Is it on printed paper. How are they scanning it? Phone or scanner attached to computer? In any case the scanning software is the one who sends the POST, right? Yes its printed on paper. And to scan it could be really any device within our IP-Range but we use IPads scanning wi...
by bkromer
Mon Sep 28, 2020 12:12 pm
Forum: LEGACY scripting
Topic: Switch Webhooks
Replies: 13
Views: 766

Re: Switch Webhooks

I want a QR-Code that triggers the webhook. When I create a Webhook in Integromat this works. And it loads a website where it spits out the Status code. I want the people in the production to scan the QR-Code when they finished the job.
by bkromer
Mon Sep 28, 2020 11:40 am
Forum: LEGACY scripting
Topic: Switch Webhooks
Replies: 13
Views: 766

Re: Switch Webhooks

Okay and since there is no way to listen for a GET request in Switch it does not work. Maybe there is a way to pack stuff in a URL do make the browser do a post on this webhook?!
by bkromer
Fri Sep 25, 2020 1:59 pm
Forum: LEGACY scripting
Topic: Switch Webhooks
Replies: 13
Views: 766

Switch Webhooks

Hey everyone, I am reading the documentation trying to figure out how WebHooks work in Switch. The HTTP-Listener is activated and the configured port is open and points to the switch server. When I create a flow with a WebHook Flow Element with protocol HTTP and Method POST and sending a JSON to the...
by bkromer
Fri Sep 11, 2020 4:44 pm
Forum: LEGACY scripting
Topic: XML-path to string
Replies: 14
Views: 1732

Re: XML-path to string

Well in the for..loop it seems to work now. But I have a similar issue now with an object. I have this object: { prokom_id: '', liefergrund: '', eintragsversion: { bundesweit: '', stichwort: '', tb: '', vab: '', lieferanten_id: '', gueltig_von: '', gueltig_bis: '', widerspruch: '', nutzung: { auskun...
by bkromer
Wed Sep 09, 2020 8:46 am
Forum: LEGACY scripting
Topic: XML-path to string
Replies: 14
Views: 1732

Re: XML-path to string

I am nearly finished with my script. There is only one last issue I am facing. When I eval a node like var eintrag_anlegen = xml.evalToNodes("//lieferung/eintragsaenderungen/eintrag_anlegen"); And there is no "eintrag_anlegen" in this particular xml-file, I made a check like if ( eintrag_anlegen.len...
by bkromer
Fri Aug 28, 2020 10:17 am
Forum: LEGACY scripting
Topic: XML-path to string
Replies: 14
Views: 1732

Re: XML-path to string

function jobArrived( s : Switch, job : Job ) { var xml = new Document( job.getPath() ); var eintragPflegenNodes = xml.evalToNodes("//eintragsaenderungen/eintrag_pflegen"); for (var j=0; j<eintragPflegenNodes.length; j++) { job.log( 1,eintragPflegenNodes.at( j ).getBaseName() ); var attrList= eintra...
by bkromer
Fri Aug 28, 2020 8:19 am
Forum: LEGACY scripting
Topic: XML-path to string
Replies: 14
Views: 1732

Re: XML-path to string

If you have to iterate over the nodes because you have to use if then to select the correct one, then you have to use the Document class. var xml = new Document(pathToXMLFile); var eintragNodes = xml.evalToNodes("//eintragsaenderungen/eintrag_anlegen"); for (var i=0; i<eintragNodes.length; i++) { j...
by bkromer
Fri Aug 21, 2020 11:44 am
Forum: LEGACY scripting
Topic: XML-path to string
Replies: 14
Views: 1732

Re: XML-path to string

Bildschirmfoto 2020-08-21 um 10.24.45.png Your screenshot shows that \Lieverung\ has an attribute and a subnode, but no simple string content. I guess that is why the variable doesn't return anything. Which return do you want to get? You are right. When I go down to some sub-nodes and select a valu...
by bkromer
Fri Aug 21, 2020 10:46 am
Forum: LEGACY scripting
Topic: XML-path to string
Replies: 14
Views: 1732

Re: XML-path to string

Escape your " with \ like this var xml = job.getVariableAsString("[Metadata.Text:Path=\"/lieferung/\",Dataset=\"Xml\",Model=\"XML\"]"); Flow is not starting then. Also I think I dont need to escape the double quotes because I wrapped them into single quotes... i guess. var xml = job.getVariableAsSt...
by bkromer
Fri Aug 21, 2020 10:30 am
Forum: LEGACY scripting
Topic: XML-path to string
Replies: 14
Views: 1732

Re: XML-path to string

gosh something is weird with the pics in this forum... :-/
Bildschirmfoto 2020-08-21 um 10.06.11.png
Bildschirmfoto 2020-08-21 um 10.06.11.png (69.79 KiB) Viewed 1730 times
Bildschirmfoto 2020-08-21 um 10.24.45.png
Bildschirmfoto 2020-08-21 um 10.24.45.png (218.24 KiB) Viewed 1729 times
by bkromer
Fri Aug 21, 2020 10:30 am
Forum: LEGACY scripting
Topic: XML-path to string
Replies: 14
Views: 1732

XML-path to string

Hey there, I use "job.getVariableAsString(' ')" to get a XML-Path as string in my script. But i only get undefined. Also when I try to select that node directly it says that this node is not available altough I can select it. See the pics Bildschirmfoto 2020-08-21 um 10.24.45.png Bildschirmfoto 2020...