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

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
armsys
Posts: 557
Joined: 10 Mar 2012 12:40
Location: Hong Kong

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

Post 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;

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

syntactical difference between different coding style?

Post 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.


.

armsys
Posts: 557
Joined: 10 Mar 2012 12:40
Location: Hong Kong

Re: syntactical difference between different coding style?

Post 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!

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: syntactical difference between different coding style?

Post 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)



.

armsys
Posts: 557
Joined: 10 Mar 2012 12:40
Location: Hong Kong

Re: syntactical difference between different coding style?

Post 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:

Post Reply