Remember: There really is a variable <pfaitem> and you may need it.

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Dustydog
Posts: 321
Joined: 13 Jun 2016 04:19

Remember: There really is a variable <pfaitem> and you may need it.

Post by Dustydog »

I'm surprised by the resilience that XY shows in just how interchangeably one can get away with using various variable types: For example, <cc_item> works where you think it might not. <curitem> does too.

One area where one must be careful, however, is if using the feature where you long press on a folder, see a drop-down list, then select one for immediate default access via Custom File Associations (if you have it enabled to check for those first).

You can (always?) get away with using practically any even semi-appropriate variable if the end result is a file that's going to be called to act upon that variable, i.e. a script or an external program. However, if you're using a short entirely PFA script, you must use <pfaitem> instead of <curitem> unless you want to get an access denied error (or, I assume, accidentally act upon the parent folder).

I recently turned a script that called either of two actions based upon criteria into two different PFA one-liners. I didn't update <curitem>, which worked fine if I simply accessed it from the PFA menu or double-clicked, but which gave me that access denied error using indirect access via folder long-press, and it took me a little while to recall that there even was a variable <pfaitem>, as I'd been pretty happily getting by using <curitem> without throwing errors.

Of course, there are other subtleties in using not quite the right variable. This was just one.

So, just a reminder that took me a little head scratching. (And thanks again highend and Don for the long-press on a folder that shows a drop down contents list - whatever that's called again.)

[Another recent head scratcher was with Don's dynamically typed variables. They work beautifully. Unless you accidentally leave a line break on the end of a number - in my case as a runret result from MediaInfo for a non-XY supported audio type. In most situations you won't see it, and the results you'll get with your math will pretty much be "0" as it's interpreted as an alpha string. Remove the line break and you'll be back doing math as expected.]

Post Reply