I've got it!!!!
...though I think it's more a circumvention than a solution, and I think somewhere there's a bug in.
I found a thread from Muroph from 1.9.2009, "getkey and quotes". (I did contribute, too.)
Till this morning I always thought from side of the ini-file. (I just want to clone a value seen in the file by using the setkey command!) Now i learned (again) to respect quoting from setkey-command to the file, be it in XY or even be it in Windows. (The opposite of "GetPrivateProfileString"? Don't know how XY
writes the key, and Windows
might change here, too.)
The Conclusion of today: if the ini says
key=""abc" def"
the value in XY should be
"abc" def
but testing with this lead to
key="abc" def
in the file. Wrong!
Quoting this string lead to double-adding quotes in the file:
key="""abc" def""
No no no!
The circumvention: I added a space character to the end of the string!
And suddenly someone (XY or Windows?) added just one pair of quotes around the string - and the ini-file contained what it should, plus that one space character, which shouldn't make a problem here...
To verify: run the following script
1st group: text without trailing " ", unquoted and quoted
2nd group: text with trailing " ", unquoted and quoted
and at the end the contents of the created ini-file is shown.
Code: Select all
$file = "%temp%\XYtest.ini"; // name of .ini file to test with
Delete 0, 0, $file; // to clean all entries (no Recycler, no Question)
// - - - - - - - - - - - - - - - - - - - - - - - - -
$t1 = '"Copy/Move to Other Pane||0" #804; #803;'; // THE value I (NO space at end!)
SetKey $t1 , test1, test1, $file;
SetKey Quote($t1), test2, test1, $file;
$t11 = GetKey( test1, test1, $file);
$t12 = GetKey( test2, test1, $file);
// - - - - - - - - - - - - - - - - - - - - - - - - -
$t2 = '"Copy/Move to Other Pane||0" #804; #803; '; // THE value II: added trailing space
SetKey $t2 , test1, test2, $file;
SetKey Quote($t2), test2, test2, $file;
$t21 = GetKey( test1, test2, $file);
$t22 = GetKey( test2, test2, $file);
// - - - - - - - - - - - - - - - - - - - - - - - - -
$file = ReadFile($file);
Text "$t1<crlf 2>$t11<crlf>$t12"
."<crlf 3>$t2<crlf 2>$t21<crlf>$t22"
."<crlf 3>$file";
Now what's the error???
- either XYs "guessing", when setkey should add quotes
- or windows on writing that key, maybe doing it "somehow unexpected" in this case
- or the value in XY-ini, created by XY, that maybe should not be quoted
- or still something else???
At least it seams to be impossible to clone a (special) setting made by XY in it's ini-file, by the XY-command setkey - but just that's the reason for setkey?!
Only the "trick" with the appended " " leads to a maybe acceptable result. (I didn't test that till now...)
edit verified: the trailing " " makes no problem in my usage case
Code: Select all
setkey '"Copy/Move to Other Pane" Load "CM2OtherPane.xys"; ', 1, "CustomButtons";