Creating text files

Discuss and share scripts and script files...
Post Reply
zer0
Posts: 2673
Joined: 19 Jan 2009 20:11

Creating text files

Post 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... :wink:

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 :)
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

admin
Site Admin
Posts: 60288
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Creating text files

Post 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... :wink:

Your other script: quoting a variable ("$a") works but is not necessary.

zer0
Posts: 2673
Joined: 19 Jan 2009 20:11

Re: Creating text files

Post 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.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

admin
Site Admin
Posts: 60288
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Creating text files

Post 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.

zer0
Posts: 2673
Joined: 19 Jan 2009 20:11

Re: Creating text files

Post 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 :)
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

sl23
Posts: 223
Joined: 03 Feb 2015 23:34

Re: Creating text files

Post by sl23 »

Superb Script, thank you for sharing! :tup: :appl:

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!

Post Reply