Page 1 of 1
Open, Sendkeys and CKS.
Posted: 25 Sep 2010 17:02
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:
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!
Re: Open, Sendkeys and CKS.
Posted: 25 Sep 2010 17:18
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}";
Re: Open, Sendkeys and CKS.
Posted: 25 Sep 2010 18:23
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>";
.
Re: Open, Sendkeys and CKS.
Posted: 25 Sep 2010 18:54
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...
