Page 1 of 1

What's the syntactical difference betw. this coding styles?

Posted: 08 Nov 2013 10:35
by armsys
Referring to http://www.xyplorer.com/xyfc/viewtopic.php?p=35775
What's the syntactical difference between :oops:

Code: Select all

"Extract Here" Set($cf,<curfolder>);
 OpenWith("""C:\program files\winrar\winrar.exe"" e -ad -- <curitem> * $cf", "s");
And...

Code: Select all

"Extract here"
  openwith """WinRAR"" x -- <items>", m;

syntactical difference between different coding style?

Posted: 08 Nov 2013 12:57
by Stefan
armsys wrote:What's the syntactical difference between
- different personal predilections in coding style
- XY commands are (often) case sensitive
- XY command parameters "should" be put into quotes to be future proof
- using () parenthesis is only cosmetic nature (IMHO), but shows better what belongs together.



But XYplorer Help > "Advanced Topics > Scripting" should be your reference.
If something is not clear there, please report, so we can try to adjust that wording.


.

Re: syntactical difference between different coding style?

Posted: 08 Nov 2013 13:47
by armsys
Stefan wrote:- different personal predilections in coding style
- XY commands are (often) case sensitive
- XY command parameters "should" be put into quotes to be future proof
- using () parenthesis is only cosmetic nature (IMHO), but shows better what belongs together..
Thanks for highlighting points I should pay attend to when scripting XY.
Referring to my originating post, I'm more intrigued by zer0's code:

Code: Select all

"Extract Here" Set($cf,<curfolder>);
 OpenWith("""C:\program files\winrar\winrar.exe"" e -ad -- <curitem> * $cf", "s");
Question:
1. Is the following code valid:

Code: Select all

"Extract Here" 
 OpenWith("""C:\program files\winrar\winrar.exe"" e -ad -- <curitem> * <curfolder>", "s");
2. If not, why not? :roll:
3. Why does zer0's code fail? :oops:
Please enlighten me.
Danke schön!

Re: syntactical difference between different coding style?

Posted: 08 Nov 2013 14:43
by Stefan
armsys wrote: 1. Is the following code valid:
2. If not, why not? :roll:
3. Why does zer0's code fail? :oops:
*I* can't tell. I didn't had an closer look at this.
But probably because he use different parameters of that called application?

See, only the blue once are XY varables (plus $cf to add the path), the other are parameters of that app:

"Extract Here" Set($cf,<curfolder>);
OpenWith("""C:\program files\winrar\winrar.exe"" e -ad -- <curitem> * $cf", "s");


"Extract here"
openwith """WinRAR"" x -- <items>", m;





Another pool of mistakes is often the not correct use of surrounding quotes (not saying that is the case here)



.

Re: syntactical difference between different coding style?

Posted: 08 Nov 2013 15:10
by armsys
Stefan wrote: *I* can't tell. I didn't had an closer look at this.
But probably because he use different parameters of that called application?
See, only the blue once are XY varables (plus $cf to add the path), the other are parameters of that app:
"Extract Here" Set($cf,<curfolder>);
OpenWith("""C:\program files\winrar\winrar.exe"" e -ad -- <curitem> * $cf", "s");
"Extract here"
openwith """WinRAR"" x -- <items>", m;.
Thanks for your comment. :appl:
I use Jack's code extensively. It saves hours to unRAR archives.
Thanks Stefan and Jacky. :cup: :cup: :cup: