Page 8 of 12
Re: [Script] WhiteSpaceCtxMenu
Posted: 12 Jul 2015 23:13
by highend
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).
Re: [Script] WhiteSpaceCtxMenu
Posted: 12 Jul 2015 23:16
by CookieMonster
highend wrote:
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.
Re: [Script] WhiteSpaceCtxMenu
Posted: 12 Jul 2015 23:19
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.
Re: [Script] WhiteSpaceCtxMenu
Posted: 13 Jul 2015 04:34
by highend
Try to remove all leading spaces in the $txt = <<<DOC line.
Re: [Script] WhiteSpaceCtxMenu
Posted: 13 Jul 2015 05:06
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.
Re: [Script] WhiteSpaceCtxMenu
Posted: 13 Jul 2015 06:57
by highend
Post screenshots for both scenarios. <- Offline for the next hours.
Re: [Script] WhiteSpaceCtxMenu
Posted: 13 Jul 2015 07:21
by CookieMonster
When I select a JPEG,PSD,ZIP or TEXT file and right click on white, I get the same menu this;
Re: [Script] WhiteSpaceCtxMenu
Posted: 13 Jul 2015 11:16
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

Re: [Script] WhiteSpaceCtxMenu
Posted: 13 Jul 2015 11:55
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.
Re: [Script] WhiteSpaceCtxMenu
Posted: 13 Jul 2015 13:01
by klownboy
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.
Re: [Script] WhiteSpaceCtxMenu
Posted: 13 Jul 2015 23:41
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.
Re: [Script] WhiteSpaceCtxMenu
Posted: 14 Jul 2015 00:02
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.
Re: [Script] WhiteSpaceCtxMenu
Posted: 14 Jul 2015 00:21
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.
Re: [Script] WhiteSpaceCtxMenu
Posted: 14 Jul 2015 00:36
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

in one strike.
MCaret_typing.gif
Re: [Script] WhiteSpaceCtxMenu
Posted: 15 Jul 2015 02:33
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.