Open, Sendkeys and CKS.

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Open, Sendkeys and CKS.

Post by SkyFrontier »

The following script should:
-create a new text file;
-rename it with a prepended underscore;
-open it.
BUT:
When I execute it via CKS, it stops at the renaming portion:

Code: Select all

"New Text.txt" in rename mode.
When I run it via Address Bar or "Run Script...", it does the job nicely.
-Any workaround for this (and a bit of explanation)?;

Code: Select all

#234; sendkeys "{enter}"; rename b, "_*"; sendkeys "{enter}";
-Am I missing something or I really can't tell rename batch what to do on name collision?
Thanks!
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...

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

Re: Open, Sendkeys and CKS.

Post by SkyFrontier »

Tip:
You can use the "/i" switch to avoid the name collision dialog, but this will not play nicely when executed via AB/Run Script... (producing files like New Text-01-01.txt, New Text-01-02.txt, New Text-01-03.txt instead of New Text-01.txt, New Text-02.txt, New Text-03.txt).
#234; sendkeys "{enter}"; rename b, "_*/i"; sendkeys "{enter}";
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...

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Open, Sendkeys and CKS.

Post by Stefan »

sendkeys() is an unsupported command, so expect not to many answers.

To create an new text file with the right name you may use new() as
new "_New Textfile.txt", file;

So you could use
::$a = "_New Textfile.txt"; new $a, file; run notepad $a;

The only problem is if "_New Textfile.txt" already exists
then this command still opens "_New Textfile.txt" in notepad
instead of the newly created "_New Textfile-001.txt" e.g.

so here is the solution > http://www.xyplorer.com/xyfc/viewtopic. ... 306#p38306
The following script should:
-create a new text file with an leading underscore;
-open it.
::new "_New Textfile.txt", file; run notepad "<curitem>";


.

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

Re: Open, Sendkeys and CKS.

Post by SkyFrontier »

@Stefan:
Splendid way of lateral thinking. Thank you.
But I still see as a valid request to have full native support on rename operations when collisions occur... :roll:
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...

Post Reply