Page 1 of 1
Creating text files
Posted: 10 May 2009 01:06
by zer0
I was getting tired of having to open Notepad to paste text into a file and then saving it as a text file in the current folder and Edit -> Paste Special -> Paste Text into New File didn't provide enough flexibility so I made a script that did the job just right.
Code: Select all
"Save Text" $a = input("Enter Text",,, "m",,640,500);
$b = input("Enter Name");
writefile("<curpath>\$b.txt", "$a");
First line pops up a text area where you can enter your text, second line asks you for the name you wish this file to have and third writes it to a folder you're currently in. It's not spectacular, but it's what I want and it works. I hope that for some of you it may be useful.
Now if only those scripting windows can be minimised and scripting error popups supressed...
P.S. While I was at it, I also needed to see List of Functions so I created a script to dump it to text file too
Code: Select all
"Dump list of functions to file" #705;
writefile("<curpath>\ListOfFunctions.txt", <clipboard>);
It's a little annoying that when calling this function from a script it comes up with notices of what it's going to do and what it has done, but Don made it so so there must be a reason

Re: Creating text files
Posted: 10 May 2009 07:43
by admin
zer0 wrote:P.S. While I was at it, I also needed to see List of Functions so I created a script to dump it to text file too
Code: Select all
"Dump list of functions to file" #705;
writefile("<curpath>\ListOfFunctions.txt", <clipboard>);
It's a little annoying that when calling this function from a script it comes up with notices of what it's going to do and what it has done, but Don made it so so there must be a reason

Well, I guess you don't use this script very often per day...
Your other script: quoting a variable ("$a") works but is not necessary.
Re: Creating text files
Posted: 10 May 2009 16:05
by zer0
admin wrote:Your other script: quoting a variable ("$a") works but is not necessary.
Is there a reason why it's not necessary? Once I paste some text into the big input window and click OK it goes away and single-line window appears, so I thought it would be important to differentiate between those 2 different inputs, since one is the body of a text file and the other is its name.
Re: Creating text files
Posted: 10 May 2009 20:52
by admin
zer0 wrote:admin wrote:Your other script: quoting a variable ("$a") works but is not necessary.
Is there a reason why it's not necessary? Once I paste some text into the big input window and click OK it goes away and single-line window appears, so I thought it would be important to differentiate between those 2 different inputs, since one is the body of a text file and the other is its name.
It's called "interpolation" (see Help) -- it's just a service to make scripting easier.
Re: Creating text files
Posted: 10 May 2009 21:01
by zer0
admin wrote:It's called "interpolation" (see Help) -- it's just a service to make scripting easier.
I see what you mean. I misunderstood you, I thought that you meant that using $a in my call to writefile is not necessary and that confused me because I couldn't understand where that function would have got the data to write to a file. Another aspect of scripting learnt

Re: Creating text files
Posted: 30 May 2021 23:34
by sl23
Superb Script, thank you for sharing!
Btw, I found this on page 22of23 in the Script exchange forum! I've gone through every page to find useful scripts and hopefully learn a little! It's not easy going though!