annoying invisible problems
-
CodeLobster
annoying invisible problems
first post here.
two simple questions and a wish:
1. when writing a script how do I match a pilcrow at the end of a list so i can do what I want with it? it appears as a dot on xy scripting debug, doesnt match crlf and i need to get a clean report using gettoken and crlf as a separator but not at the and of a list
2. why when copying from text window (using the text script command) the copied text keeps the formatting whilst copying from respective variable doesnt?
and my wish is: the script command writefile could have the ability to prepend (?) analog to append. actually i can emulate the same result using readfile/writefile but due to the nature of my script this is not an option as it must produce a log before it reloads itself again
thank you and have a good day!
two simple questions and a wish:
1. when writing a script how do I match a pilcrow at the end of a list so i can do what I want with it? it appears as a dot on xy scripting debug, doesnt match crlf and i need to get a clean report using gettoken and crlf as a separator but not at the and of a list
2. why when copying from text window (using the text script command) the copied text keeps the formatting whilst copying from respective variable doesnt?
and my wish is: the script command writefile could have the ability to prepend (?) analog to append. actually i can emulate the same result using readfile/writefile but due to the nature of my script this is not an option as it must produce a log before it reloads itself again
thank you and have a good day!
-
CodeLobster
Re: annoying invisible problems
i was expecting to see at least an answer here but life goes on.
any way i found a solution for problem nr 1, yet to say whether or not itll fit all situations:
tip 1: chr(13).chr(10) = pilcrow.
replace("$sourceWithPilcrows", chr(13).chr(10), "|"); // ->> or any other separator
tip 2: erasing it:
$wrd = (pilcrow)Word;
$wrd = substr("$wrd", 2, ); // ->> pilcrow is a double-byte char, so substr("$wrd", 1, ); would match the 1st char only
a word on problem 2 is still welcome as whether or not i should expect for the wish come true.
any way i found a solution for problem nr 1, yet to say whether or not itll fit all situations:
tip 1: chr(13).chr(10) = pilcrow.
replace("$sourceWithPilcrows", chr(13).chr(10), "|"); // ->> or any other separator
tip 2: erasing it:
$wrd = (pilcrow)Word;
$wrd = substr("$wrd", 2, ); // ->> pilcrow is a double-byte char, so substr("$wrd", 1, ); would match the 1st char only
a word on problem 2 is still welcome as whether or not i should expect for the wish come true.
-
admin
- Site Admin
- Posts: 66361
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
-
CodeLobster
Re: annoying invisible problems
hello, thanks for answering!admin wrote:Tip: use <crlf> for chr(13).chr(10).
i want to match the pilcrow for a search&replacement and it seems i can't do it correctly unless i use chr(13).chr(10).
to leave some notes i did further tests produce varying results
$test = chr(13).chr(10); echo quote ($test); // ->> ["] . [<crlf>] . ["]
$test = chr(13).chr(10); echo quote $test; // ->> "quote" (written word)
$test = chr(13).chr(10); echo $test; // ->> pilcrow on debug window, "blank" on echo
$test = "chr(13).chr(10)"; echo "test" . "$test" . "test2" . '$test' . "test 3";// ->> testchr(13).chr(10)test2$testtest 3
echo chr(13).chr(10); // ->> pilcrow on debug window, as expected "blank" on echo
echo chr(10).chr(13); // ->> two dots on debug window, as expected "blank" on echo
-
admin
- Site Admin
- Posts: 66361
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: annoying invisible problems
Too abstract. What's your real problem? Post real code.
FAQ | XY News RSS | XY X
-
CodeLobster
Re: annoying invisible problems
for exporting count reports for instance
select a file and execute this
count is 1; then select 2 files in list and the count is 3 instead of 2.
i had many problems in the recent past with this and im trying to locate code i wrote to get more exemples.
an option would be matching the last pilcrow generated by #101 then replacing it by "" but i can't so i have to rely on artificial solutions using substr.
it's so abstract ill try to report later with more accurate samples.
select a file and execute this
Code: Select all
focus; #101; echo gettoken("<clipboard>", "count", "<crlf>");i had many problems in the recent past with this and im trying to locate code i wrote to get more exemples.
an option would be matching the last pilcrow generated by #101 then replacing it by "" but i can't so i have to rely on artificial solutions using substr.
it's so abstract ill try to report later with more accurate samples.
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: annoying invisible problems
You could use RegexReplace:
Code: Select all
RegexReplace("<clipboard>", "<crlf>+$");-
CodeLobster
Re: annoying invisible problems
heres a good one:
Code: Select all
"Test 1"
$str1 = "John";
$str2 = "Doe
"; //forum is detecting and dealing with it as <crlf> so im not sure it will do as a good example
$str3 = "Strange";
$fin = "$str1 $str2 $str3";
step;
$blank = substr("$fin", 8, 1);
//none of the folowing will match the blank char at $str2 "Doe[blank]"
// $pilcrow = chr(13).chr(10);
// $pilcrow = "chr(13).chr(10)";
$pilcrow = ""; //despite NOT matching it continues operation!
// $pilcrow = " ";
// $pilcrow = "<crlf>";
IF ($blank == $pilcrow) { $fin2 = substr("$fin", 8, 1); replace $fin, $fin, "$fin2", ""; //why continued??? }
ELSEIF ($blank != $pilcrow) { $fin2 = $fin; }
echo $fin;
"Test 2"
$str1 = "John";
$str2 = "Doe
"; //forum is detecting and dealing with it as <crlf> so im not sure it will do as a good example
$str3 = "Strange";
$fin = "$str1 $str2 $str3";
step;
$blank = substr("$fin", 8, 1);
//none of the folowing will match the blank char at $str2 "Doe[blank]"
// $pilcrow = chr(13).chr(10);
// $pilcrow = "chr(13).chr(10)";
$pilcrow = "";
// $pilcrow = " ";
// $pilcrow = "<crlf>";
IF ($blank == $pilcrow)
{
$fin2 = substr("$fin", 8, 1); //
replace $fin, $fin, "$fin2", "";
}
ELSEIF ($blank != $pilcrow) { $fin2 = $fin; }
echo $fin;-
CodeLobster
Re: annoying invisible problems
TheQwerty wrote:You could use RegexReplace:Code: Select all
RegexReplace("<clipboard>", "<crlf>+$");
Code: Select all
focus; #101; $step = RegexReplace("<clipboard>", "<crlf>+$"); echo gettoken(" $step", "count", "<crlf>");any word on 2. why when copying from text window (using the text script command) to notepad the copied text keeps the formatting whilst copying from respective variable (using copytext) doesnt?
or
the affix for writefile please?
ps sent mail to support with attached sample file as forum probably screwed my sample interpreting the pilcrow. lets hope they answer. report back if they do.
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
Re: annoying invisible problems
I remember i had my problems with such too a few years ago, but i have no problems recently, maybe i do workarounds automatically?
- - -
Test with 9.90.1012 on XP SP3,
My test code:
Result for one selected file:
---------------------------
XYplorer
---------------------------
E:\d\XYplorer\XYcopy.exe1
---------------------------
OK
---------------------------
Result for two selected files:
which shows in dialog as:
---------------------------
XYplorer
---------------------------
E:\d\XYplorer\XYcopy.exe
E:\d\XYplorer\XYplorer.chm
3
---------------------------
OK
---------------------------
but which adds additional lines if copied to an documents
---------------------------
XYplorer
---------------------------
E:\d\XYplorer\XYcopy.exe
E:\d\XYplorer\XYplorer.chm
3
---------------------------
OK
---------------------------
But i can't explain why.
So can you show an example code where this line break disturbs you?
Do you just want to delete the last line break if any? Or what do you want?
The same for 2.)
Do you have an simple example code to show what you mean?
AND, please don't be shy to open ONE thread for every ONE problem/question (if possible. It's hard sometimes, i know)
(BTW: thanks to JC for needle and thread cribs)
.
- - -
Test with 9.90.1012 on XP SP3,
My test code:
Code: Select all
#101;
msg "<clipboard>" . gettoken("<clipboard>", "count", "<crlf>"); Result for one selected file:
---------------------------
XYplorer
---------------------------
E:\d\XYplorer\XYcopy.exe1
---------------------------
OK
---------------------------
Result for two selected files:
which shows in dialog as:
---------------------------
XYplorer
---------------------------
E:\d\XYplorer\XYcopy.exe
E:\d\XYplorer\XYplorer.chm
3
---------------------------
OK
---------------------------
but which adds additional lines if copied to an documents
---------------------------
XYplorer
---------------------------
E:\d\XYplorer\XYcopy.exe
E:\d\XYplorer\XYplorer.chm
3
---------------------------
OK
---------------------------
But i can't explain why.
So can you show an example code where this line break disturbs you?
Do you just want to delete the last line break if any? Or what do you want?
The same for 2.)
Do you have an simple example code to show what you mean?
AND, please don't be shy to open ONE thread for every ONE problem/question (if possible. It's hard sometimes, i know)
(BTW: thanks to JC for needle and thread cribs)
.
-
admin
- Site Admin
- Posts: 66361
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: annoying invisible problems
Why not first use formatlist with "e" (remove empty items), then count.
FAQ | XY News RSS | XY X
-
CodeLobster
Re: annoying invisible problems
good idea!admin wrote:Why not first use formatlist with "e" (remove empty items), then count.
so that's what empty items stands for? could you provide more examples of what formatlist "e" flags? perhaps such info leads support guys to include it on help file.
stefan: i had such problems too! thats one of those things that always annoyed me.
yes i compiled a small piece of code for my use to document problems like that. in hopes that one day i have more o' them as now and then they occur.
important: greatly depends on source and as i was using these codes on offline phpbb code.
id bet they'll suffice to show my problem.
at least im not the only one buggered by this lol.
saw a user telling about this other day and gave it a try.
it shows a problem i saw sometimes in other script commands when copy-pasting from text box and directly from copytext.
luckily this very forum appears to show the same problem.
Code: Select all
"test 1 - hard way"
//readurl has a hard-on-the-eye way to do it
status "downloading...", BF0000, progress;
$text = readurl("http://www.growlforwindows.com/gfw/help/growlnotify.aspx", , 1);
text "$text";
copytext "$text";
-
"test2 - soft way"
//problem happens on certain sites but not on others!!!
$url = "http://www.xyplorer.com/xyfc/search.php?search_id=active_topics"; //has problem when pasting text from clipboard
// $url = "http://www.growlforwindows.com/gfw/help/growlnotify.aspx"; //has no such problem. why???
status "downloading...", BF0000, progress;
$url2 = readurl ("$url");
$url2 = regexreplace($url2, "<[^<]*>", "");
$url2 = replace($url2,".<crlf><crlf><crlf>"," ");
$url2 = replace($url2,"<crlf>.<crlf><crlf>"," ");
$url2 = replace($url2,"<crlf><crlf>.<crlf>"," ");
$url2 = replace($url2,"<crlf><crlf><crlf>."," ");
$back = regexreplace($url2, "<[^<]*<", "");
copytext "$back";
text "$back";
-
CodeLobster
Re: annoying invisible problems
had this idea so someone smarter may be able to help.
first copy the "doe fin" part to clipboard then execute the script.
i have other sample of invisible char which is reported as "32" by script command asc.
none can be matched for further replacements. please advise. :s
generally i need to match the dot (.) followed or preceded by a pilcrow as in:
".pilcrow"
"pilcrow."
first copy the "doe fin" part to clipboard then execute the script.
i have other sample of invisible char which is reported as "32" by script command asc.
none can be matched for further replacements. please advise. :s
generally i need to match the dot (.) followed or preceded by a pilcrow as in:
".pilcrow"
"pilcrow."
Code: Select all
/*
//samples of char9, 10 and 32
"
"
*/
"Test 4"
$str1 = "John";
$str2 = "<clipboard>";
$str3 = "Strange";
$fin = "$str1 $str2 $str3";
// step;
$blank = substr("$fin", 10, 1); //this index gets the chr(32)
echo asc($blank);
step;
replace $fin, $fin, "$blank", "x";
echo $fin;-
CodeLobster
Re: annoying invisible problems
updated my previous post that gives a chr32 proper sample.
a cookie for the person who successfuly replaces "pilcrow dot" or "dot pilcrow" by anything else.
thanks in advance for any idea on whats going on.
a cookie for the person who successfuly replaces "pilcrow dot" or "dot pilcrow" by anything else.
thanks in advance for any idea on whats going on.
-
CodeLobster
Re: annoying invisible problems
i really need some help here.
i teamed up with another user and we made a great script out of his original idea but again the invisible chars are on the way and we cant rename files when they show up their ugly invisible faces.
so any ideas on how to match the chars posted below for further replacemnt when its found?
on a prior post theres a mini test script that may give an idea.
i teamed up with another user and we made a great script out of his original idea but again the invisible chars are on the way and we cant rename files when they show up their ugly invisible faces.
so any ideas on how to match the chars posted below for further replacemnt when its found?
on a prior post theres a mini test script that may give an idea.
Code: Select all
/*
//samples of char9, 10 and 32
"
"
*/
XYplorer Beta Club