[Script] WhiteSpaceCtxMenu

Discuss and share scripts and script files...
highend
Posts: 13311
Joined: 06 Feb 2011 00:33

Re: [Script] WhiteSpaceCtxMenu

Post by highend »

Code: Select all

  $psd = <<<PSD 
You have a trailing space at the end of this line...
Remove that and get an editor that is able to show these things (like Sublime Text or a bunch of others).
One of my scripts helped you out? Please donate via Paypal

CookieMonster

Re: [Script] WhiteSpaceCtxMenu

Post by CookieMonster »

highend wrote:

Code: Select all

  $psd = <<<PSD 
You have a trailing space at the end of this line...
Remove that and get an editor that is able to show these things (like Sublime Text or a bunch of others).
I have begun using Sublime text.

CookieMonster

Re: [Script] WhiteSpaceCtxMenu

Post by CookieMonster »

It works, I knew it was something small lucky for harsh talking highend to point it out.

It works beautifully; except, the heredoc text menu is show as code in the menu ? As well, every file type I select the menu is shown ?

Always the #$%#$% syntax issues that nail me in any language, arghh so frustrating.

highend
Posts: 13311
Joined: 06 Feb 2011 00:33

Re: [Script] WhiteSpaceCtxMenu

Post by highend »

Try to remove all leading spaces in the $txt = <<<DOC line.
One of my scripts helped you out? Please donate via Paypal

CookieMonster

Re: [Script] WhiteSpaceCtxMenu

Post by CookieMonster »

highend wrote:Try to remove all leading spaces in the $txt = <<<DOC line.
That was one of the first things I did, although it didn't solve the problem :( When I strictly select a PSD file, I see a heredoc menu item; when I select any type of file I see the PSD menu item which I shouldn't, it should strictly be shown only when a PSD file is selected.

highend
Posts: 13311
Joined: 06 Feb 2011 00:33

Re: [Script] WhiteSpaceCtxMenu

Post by highend »

Post screenshots for both scenarios. <- Offline for the next hours.
One of my scripts helped you out? Please donate via Paypal

CookieMonster

Re: [Script] WhiteSpaceCtxMenu

Post by CookieMonster »

When I select a JPEG,PSD,ZIP or TEXT file and right click on white, I get the same menu this;
Attachments
psd_selected.jpg
psd_selected.jpg (4.9 KiB) Viewed 3696 times

PeterH
Posts: 2785
Joined: 21 Nov 2005 20:39
Location: Germany

Re: [Script] WhiteSpaceCtxMenu

Post by PeterH »

I had this form of parsing error caused by syntax errors, like illegal form of heredoc, illegal form of labels, or illegal quoting.
The syntax error often was much above the statement showing the error.

Sometimes the results were rather strange :shock:
Win11 Pro 223H2 Gerrman

Stef123

Re: [Script] WhiteSpaceCtxMenu

Post by Stef123 »

PeterH wrote:I had this form of parsing error caused by syntax errors, like illegal form of heredoc, illegal form of labels, or illegal quoting.
Oh yes, I also had my share of these, the screenshot looks very familiar, due to Heredoc syntax mistakes. What highend already pointed out, you have to be aware of trailing (!) blanks as well, not just leading white space. This should be emphasized in the help file. Not somewhere under troubleshooting, but up front, before you get started, in big bold letters.

And also "DO NOT USE THE BUILT-IN Editor." As crazy as that may sound. Sure, you can't avoid it for testing and stepping. But resist the temptaion to edit anything with it. Don't do it, by no means. It will select trailing spaces when dbl-clicking words - at least it does so on my machines. Upon pasting you're doomed, I got really frustrated because of these "mistakes" - and you don't even get to see those vitally important non-printing blanks in XY.

The only way to cope with it, use a dedicated editor, make non-printable chars visible and set it up to NOT select trailing blanks. Then use it for nothing else but XY. Because really, most often you want the trailing spaces selected along with your words, XY is the only exception, at least in my text park.

klownboy
Posts: 4139
Joined: 28 Feb 2012 19:27

Re: [Script] WhiteSpaceCtxMenu

Post by klownboy »

:eh:
highend wrote:You have a trailing space at the end of this line...
2 days ago here http://www.xyplorer.com/xyfc/viewtopic. ... 75#p126058 I said,
When copying/pasting make sure you don't have extra spaces in there as you did after the initial heredoc statement.
Why, because I spotted one. :(

Stef123, good points on using an editor that can display spaces and tabs as well as end of line. Even free ones like NotePad++ can do that. Yo u do have to remember to turn them on. Because I find them a bit annoying, I usually don't turn them on until I start testing a script.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: [Script] WhiteSpaceCtxMenu

Post by SkyFrontier »

SkyFrontier wrote:...would you mind sharing the AHK, then?
<shared>
Thanks, Ken!

Will try that later, when my regular setups become available again.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Stef123

Re: [Script] WhiteSpaceCtxMenu

Post by Stef123 »

klownboy wrote: an editor that can display spaces and tabs as well as end of line. Even free ones like NotePad++ can do that. Yo u do have to remember to turn them on. Because I find them a bit annoying, I usually don't turn them on until I start testing a script.
Me too. But the final scan for unwanted white space is really important.
You're right about end of line - that's another thing that can trip you up, especially with word-wrap ON. Do you know of an editor that allows to restrict NON-space selecting to dedicated file types (xys)? I don't like those missing spaces after copy-pasting in files other than xys.

We need the XY editor for testing, and it's just too tempting to NOT fix something on the fly. But that's exactly what got me into deep trouble every so often. To avoid typos and errors due to mismatched capitalization etc - you dbl-click and copy-paste - et voila, without noticing, it happened once again.

The pros out there will be laughing, but to me the term "scripting" does not imply the same strictness and precision as "programming proper". I am pampered by Office macros and such, which seem like a walk in the park by comparison, with their recording function and syntax highlighting and auto-correction. Downright impossible to skip a space in Word or Excel, it will always get spaced out properly, all by itself, even after copy-paste operations.

klownboy
Posts: 4139
Joined: 28 Feb 2012 19:27

Re: [Script] WhiteSpaceCtxMenu

Post by klownboy »

Hey Stef123, I honestly don't know that much about the differences or capabilities in many of the text editors out there. One feature I wouldn't be without and that I use all the time in NotePad++, is the highlighting of similar words feature. I'm not sure what the actual feature name is, but it's great for writing code/scripts to highlight a word, like a variable and it will then highlight all the other instances of that word in the file. Great for catching typos in variables.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Stef123

Re: [Script] WhiteSpaceCtxMenu

Post by Stef123 »

Thanks Ken,
yes I know what you mean, very useful feature to see all instances highlighted.
Multi-carets are another killer feature I could not live without anymore. You Ctrl or Shift Ctrl click several carets into your text, then manipulate all of them simultanesously. No quicker way to insert characters across dozens of lines - or to remove unwanted space :wink: in one strike.
MCaret_typing.gif
MCaret_typing.gif (170.96 KiB) Viewed 3638 times

CookieMonster

Re: [Script] WhiteSpaceCtxMenu

Post by CookieMonster »

Not sure if I enabled white space for sublime-text, anyone with sublime text experience, what does white space in sublime text look like ? I enabled "draw_white_space": "all" for the xyplorer syntax highlighter.

Post Reply