Page 1 of 1

Create Test.txt with some data

Posted: 15 Sep 2008 07:29
by Quad Master
--------------------------------------------
The Scenario

In Directory [C:\Temp]
C:\Temp\Test.ext [Selected]
--------------------------------------------
When "Test.ext" is selected and a script is run i want the following things to happen.

1.> Create "Test.txt"
2.> Write "Filename is : <curname>" in the Test.txt and Saved.
--------------------------------------------

So the final output should be

Test.txt
Filename is : Test.ext


=================================
My current status
Got
Step 1: new "<curbase>.ext"

Donno how to write data in a text file.

Also wud want to accept some input from user.
That can be done using
input $data, "Enter Data", Value;
Also want the accepted input to be written in the text file.

Re: Create Test.txt with some data

Posted: 15 Sep 2008 13:42
by admin
Hi + welcome!

You cannot yet write text to a (new) file using scripting. The command WriteFile will come soon though.

Don

Re: Create Test.txt with some data

Posted: 15 Sep 2008 13:52
by jacky
Actually, in the mean time here's a little trick you might find interesting: put your text into the clipboard (copytext) and then trigger Paste Text Into New File (#219), you might have to add a "focus l;" to get ride of the automatic rename mode, then the file should be focused & selected and a rename will allow you to rename it as you wish...

Re: Create Test.txt with some data

Posted: 15 Sep 2008 15:54
by Quad Master
Firstly thanks for the welcome.

@admin : It will be fantastic if we would have a "writefile.anyext" method as it would help a lot.

@ jacky : Thanks for the suggestion.
Can u write the exact code for the description you gave above.
I want the exact code for "copying text into a file which is present in the clipboard"
Since i can add info to clipboard with copytext.

When i Rt click on the Clipboard "There is an option to copy text to newfile.txt"
but i want the file to be "somecustomname.customext"

---------------------------------------------------------------------------------
I have created a drag and drop batch file for this thing but , wanted it the XY Way ;)

I have really missed the best explorer in the world must say.
Just came across it accidentially and was amazed with the power a simple explorer software can offer with custom scripting.

This is an amazing product must say.
Thumbsup to the Developer , you guyz Rock.

Re: Create Test.txt with some data

Posted: 15 Sep 2008 16:07
by jacky
On menu Edit (or when right-clicking an empty area on List), under "Paste Special" you have an option "Paste Text Into New File" which allows you, at any given time, to create a new textfile with the text on the clipboard.

To use this command in scripting, you need to use it's ID, which can be obtained from the CKS dialog (Tools|Customize Keyboard Shortcuts...). This one is 219, so all you need to do to trigger it from a script is to use #219; as command.

Here's an example :

Code: Select all

  input $comment, "Enter comments or something for <curname> :";
  copytext "File: <curname><br>Comments: $comment";
  #219;
  focus l;
  rename ,"Test.txt/e";
And to find out more about Scripting, you can have a look on the XYwiki ;)

Re: Create Test.txt with some data

Posted: 15 Sep 2008 16:09
by Quad Master
Ok got following

Code: Select all

copytext "Filename is : <curname>";#219;
This creates "Clipboard-20080915.txt" with the content i want but i want a code to rename the
file to "<curbase>.anyextenstion" or "anyotherfilename.anyotherextenstion"

Re: Create Test.txt with some data

Posted: 15 Sep 2008 16:31
by Quad Master

Code: Select all

"Test"
  input $comment, "Enter comments or something for <curname> :";
  copytext "File: <curname><br>Comments: $comment";
  set $filename, <curbase>;
  #219;
  focus l;
  rename ,"$filename.txt/e";
This did exactly what i wanted.
Thanks jacky.

Re: Create Test.txt with some data

Posted: 15 Sep 2008 16:47
by j_c_hallgren
Quad Master wrote:I have really missed the best explorer in the world must say.
Just came across it accidentially and was amazed with the power a simple explorer software can offer with custom scripting.

This is an amazing product must say.
Thumbsup to the Developer , you guyz Rock.
Hi and a belated welcome from me also!

Yes, we think it's the best file manager available! 8)
So do us a favor and pass the word on to as many friends/contacts as possible, please?
We try to be here to help as much as possible...also, you'll be amazed (if not already) at the speed of development.

Re: Create Test.txt with some data

Posted: 15 Sep 2008 16:56
by Quad Master
j_c_hallgren wrote: Yes, we think it's the best file manager available! 8)
So do us a favor and pass the word on to as many friends/contacts as possible, please?
We try to be here to help as much as possible...also, you'll be amazed (if not already) at the speed of development.
Will definitely pass on the word to as many ppl as possible for sure.
On Tech Forums i visit and on my blog. :)