Page 1 of 1

Escape

Posted: Fri Jun 22, 2012 10:32 am
by lohbrand
Hello,



we have tis Script:



var _testString = "Test&Test Test+Test=Test-Test";

_testString = escape(_testString);



and this one:



var _testString = "Test&Test Test+Test=Test-Test";

_testString = _testString.replace("+", "%2B");



the log say something like this:



Test/var/folders/ff/ffKQdrvpHF4CpidNJmasOU+++TY/-Tmp-/FixtureTest14/inFolder26Test/var/folders/ff/ffKQdrvpHF4CpidNJmasOU+++TY/-Tmp-/FixtureTest14/inFolder20Test+TestDTest-Test



Who need the Folder? Has anybody a tip?



Thanks Lohbrandt

Escape

Posted: Fri Jun 22, 2012 3:15 pm
by lohbrand
Is there anybody from Enfocus, who can answer questions?

Escape

Posted: Fri Jun 22, 2012 4:06 pm
by dkelly
I'm a little confused. Your JS snippet doesn't involve a path at all. Did you append _testString variable to another value like job.getPath()? Did you mean to add a directory separator character, eg. '/', between inFolder and _testString?

Escape

Posted: Mon Jun 25, 2012 9:00 am
by lohbrand
thank for your post dkelly.

the script is what i post.

there is nothing else.



i dont understand the path in the log message, because there is no job.getPath() command.

Escape

Posted: Mon Jun 25, 2012 1:19 pm
by rzacherl
Hello lohbrand,



based on the path I would state that you're using the Fixture (debugging) capabilities of SwitchScripter to test your script outside Switch.



Regards,



Robert

Escape

Posted: Mon Jun 25, 2012 2:12 pm
by lohbrand
Hello,



the same answer in the log (PowerSwitch11).

Escape

Posted: Mon Jun 25, 2012 3:40 pm
by dkelly
Is this script being used in a script expression or a scripted element?

Escape

Posted: Mon Jun 25, 2012 3:43 pm
by lohbrand
in a script-element

Escape

Posted: Mon Jun 25, 2012 8:34 pm
by dkelly
I guess I don't understand your question because a scripted element would need more code that that. A jobArrived() or timerFired() function at least.

Escape

Posted: Tue Jun 26, 2012 9:41 am
by lohbrand
function jobArrived( s : Switch, job : Job )

{

var _testString = "Test&Test Test+Test=Test-Test";

_testString = escape(_testString);



job.log(1,_testString);

}



what happend whit your engine?

Escape

Posted: Tue Jun 26, 2012 12:17 pm
by lohbrand
Oke, we have a answer.

The commands log and fail will never display the char %.



Thanks.

Escape

Posted: Tue Oct 02, 2012 4:58 am
by marbledaemon
It's true.



The 's.log' and other text-related functions will treat %[number] as a wildcard parameter. As you can see here, your %2B falls in that category as %2 is treated as the job folder.



You might want to write that text to a binary file to read it.