Yes, I need even SIMPLER than notepad :-)
March 3, 2010 7:29 AM
I need to streamline the insertion of variables into complex, but regular, plain-text code, which will ultimately reside in a basic TXT file. I’d like to find a text generator, or create a web-based form, or buy a program that will allow me to 1) establish or designate a block of text with defined places for variables 2) Type in values of the variables 3) It then places those values inside the block of text then 4) spits out the combined block of text with the variables in place so that it can be cut and pasted in totality. Much
have a PHP system that requires users (so I’d have to be able to share this “text amalgamator”) to add to a plain TXT file containing code. The additions made to the TXT file, once uploaded to the server, change the behavior of a website based on the variables placed in the TXT file. The “text amalgamator” I would like wouldn’t have to do calculations, but that would be a nice feature. I’d NEED for this to have some type of form-like GUI.
The current method of copying, pasting, editing each value by hand, copying, pasting, editing each value by hand, copying, pasting … is proving to be cumbersome and prone to “typo” type errors that grok the whole thing. Someone can accidentally delete a semi-colon, or delete close quotes, or paste something in the wrong place…
If the user could just cut/copy a whole block of generated text/code based on inputted information and do one paste in place, it would eliminate a ton of errors I’m seeing.
The code/text to be added/edited is, in a nutshell, something like:
$_SESSION ["blah"]["blah"]["XXX"]["blah"]= "YYY";
$_SESSION ["blah"]["ZZZ"][" XXX "]["blah"]= "AAA";
BBB$_SESSION ["blah"]["blah"]["XXX"]["blah"]= "CCC";
$_SESSION ["blah"][" XXX "]["blah"]= "DDDEEEFFF";
The variables would be akin to:
XXX – a numeric value
YYY – Some plain text words
ZZZ – a numeric value
AAA – Some plain text words
BBB – Something inserted based on a YES or NO answer
CCC - Some plain text words
DDD – a numeric value
EEE – a numeric value
FFF – a numeric value
I’m sure there’s got to be something out there that can do this. Any ideas?
Thanks in advance, gang!
have a PHP system that requires users (so I’d have to be able to share this “text amalgamator”) to add to a plain TXT file containing code. The additions made to the TXT file, once uploaded to the server, change the behavior of a website based on the variables placed in the TXT file. The “text amalgamator” I would like wouldn’t have to do calculations, but that would be a nice feature. I’d NEED for this to have some type of form-like GUI.
The current method of copying, pasting, editing each value by hand, copying, pasting, editing each value by hand, copying, pasting … is proving to be cumbersome and prone to “typo” type errors that grok the whole thing. Someone can accidentally delete a semi-colon, or delete close quotes, or paste something in the wrong place…
If the user could just cut/copy a whole block of generated text/code based on inputted information and do one paste in place, it would eliminate a ton of errors I’m seeing.
The code/text to be added/edited is, in a nutshell, something like:
$_SESSION ["blah"]["blah"]["XXX"]["blah"]= "YYY";
$_SESSION ["blah"]["ZZZ"][" XXX "]["blah"]= "AAA";
BBB$_SESSION ["blah"]["blah"]["XXX"]["blah"]= "CCC";
$_SESSION ["blah"][" XXX "]["blah"]= "DDDEEEFFF";
The variables would be akin to:
XXX – a numeric value
YYY – Some plain text words
ZZZ – a numeric value
AAA – Some plain text words
BBB – Something inserted based on a YES or NO answer
CCC - Some plain text words
DDD – a numeric value
EEE – a numeric value
FFF – a numeric value
I’m sure there’s got to be something out there that can do this. Any ideas?
Thanks in advance, gang!
These text files you need to generate, they're PHP include files?
And you need the data in the include files to vary?
And your solution is to have a separate include file for each possible criteria?
My immediate response is "you're doing it [very] wrong." Can you explain a little more (at a high level) what you're trying to do?
posted by Doofus Magoo at 8:13 AM on March 3, 2010
And you need the data in the include files to vary?
And your solution is to have a separate include file for each possible criteria?
My immediate response is "you're doing it [very] wrong." Can you explain a little more (at a high level) what you're trying to do?
posted by Doofus Magoo at 8:13 AM on March 3, 2010
Forget I said PHP. That's immaterial.
I need to generate TEXT to place in an existing TXT file, which when uploaded to the server the PHP system would read.
I'm basically looking for something to create my own Mad-Lib-like text files.
Jane has __ZZZ(Number)__ __YYY(Noun)___. She sells them at the__AAA___ for $___DDD___. Bob sells ___CCC(color)___ ___YYY(Noun)___.
posted by sandra_s at 8:51 AM on March 3, 2010
I need to generate TEXT to place in an existing TXT file, which when uploaded to the server the PHP system would read.
I'm basically looking for something to create my own Mad-Lib-like text files.
Jane has __ZZZ(Number)__ __YYY(Noun)___. She sells them at the__AAA___ for $___DDD___. Bob sells ___CCC(color)___ ___YYY(Noun)___.
posted by sandra_s at 8:51 AM on March 3, 2010
And what, you don't have PHP running anywhere so that you could create a simple form that spits out exactly that text file based on a form?
posted by themel at 8:59 AM on March 3, 2010
posted by themel at 8:59 AM on March 3, 2010
Directly answering the question: You might want to give a macro-enabled text editor (I use Notepad++) a try. The way I'd envision it working is that you open up a new file, and type in AAA value (enter) BBB value (enter) CCC value (enter). You'd then run a macro that would take all of that information and format it like you need it.
A slightly more complicated solution would be a simple web form where it asks for the values of AAA, BBB, CCC (as well as the target filename), then when the user clicks "Submit," a text file is either (a) saved on the server somewhere with those values; or (b) downloaded by the user. You're almost certainly looking at a custom app there, though, as I don't know of anything like that that exists already. For someone who knows PHP, though, this is a <15-minute job. MeMail me if it's a solution you're interested in pursuing.
Not directly answering the question: From what little I know (i.e., virtually nothing, so take it with a grain of salt) about what you're doing here, you probably want to have a backend database to store the possible values of AAA/BBB/CCC, and then have the "text file" dynamically generated from the database on an as-needed basis.
posted by Doofus Magoo at 9:18 AM on March 3, 2010
A slightly more complicated solution would be a simple web form where it asks for the values of AAA, BBB, CCC (as well as the target filename), then when the user clicks "Submit," a text file is either (a) saved on the server somewhere with those values; or (b) downloaded by the user. You're almost certainly looking at a custom app there, though, as I don't know of anything like that that exists already. For someone who knows PHP, though, this is a <15-minute job. MeMail me if it's a solution you're interested in pursuing.
Not directly answering the question: From what little I know (i.e., virtually nothing, so take it with a grain of salt) about what you're doing here, you probably want to have a backend database to store the possible values of AAA/BBB/CCC, and then have the "text file" dynamically generated from the database on an as-needed basis.
posted by Doofus Magoo at 9:18 AM on March 3, 2010
creating something PHP is not an option for me, as I do not have the skill.
posted by sandra_s at 9:19 AM on March 3, 2010
posted by sandra_s at 9:19 AM on March 3, 2010
Here's one way to do it, using a Windows batch file.
Save the following as as "gen-txt.bat".
Edit to suit.
Then call it on the command line, thus:
posted by chazlarson at 9:33 AM on March 3, 2010
Save the following as as "gen-txt.bat".
Edit to suit.
goto :start
:syntax
@echo.
@echo SYNTAX: gen-txt XXX YYY ZZZ AAA Y/N CCC DDD EEE FFF
@echo.
@echo where XXX : a numeric value
@echo YYY : Some plain text words
@echo ZZZ : a numeric value
@echo AAA : Some plain text words
@echo Y/N : Y = BBB, N = GGG
@echo CCC : Some plain text words
@echo DDD : a numeric value
@echo EEE : a numeric value
@echo FFF : a numeric value
@echo.
goto :end
:start
if "%1"=="" goto :syntax
if "%2"=="" goto :syntax
if "%3"=="" goto :syntax
if "%4"=="" goto :syntax
if "%5"=="" goto :syntax
if "%6"=="" goto :syntax
if "%7"=="" goto :syntax
if "%8"=="" goto :syntax
if "%9"=="" goto :syntax
if "%5"=="Y" set bbb=BBB
if "%5"=="y" set bbb=BBB
if "%5"=="N" set bbb=GGG
if "%5"=="n" set bbb=GGG
echo $_SESSION ["blah"]["blah"]["%1"]["blah"]= "%2"; > outfile.txt
echo $_SESSION ["blah"]["%3"][" %1 "]["blah"]= "%4"; >> outfile.txt
echo %bbb%$_SESSION ["blah"]["blah"]["%1"]["blah"]= "%6"; >> outfile.txt
echo $_SESSION ["blah"][" %1 "]["blah"]= "%7%8%9"; >> outfile.txt
:end
set bbb=
Then call it on the command line, thus:
I:\>gen-txt XXX YYY ZZZ AAA N CCC DDD EEE FFF
I:\>type outfile.txt
$_SESSION ["blah"]["blah"]["XXX"]["blah"]= "YYY";
$_SESSION ["blah"]["ZZZ"][" XXX "]["blah"]= "AAA";
GGG$_SESSION ["blah"]["blah"]["XXX"]["blah"]= "CCC";
$_SESSION ["blah"][" XXX "]["blah"]= "DDDEEEFFF";
I:\>gen-txt XXX YYY ZZZ AAA Y CCC DDD EEE FFF
I:\>type outfile.txt
$_SESSION ["blah"]["blah"]["XXX"]["blah"]= "YYY";
$_SESSION ["blah"]["ZZZ"][" XXX "]["blah"]= "AAA";
BBB$_SESSION ["blah"]["blah"]["XXX"]["blah"]= "CCC";
$_SESSION ["blah"][" XXX "]["blah"]= "DDDEEEFFF";
I:\>gen-txt foo bar baz quux Y corge grault garply waldo
I:\>type outfile.txt
$_SESSION ["blah"]["blah"]["foo"]["blah"]= "bar";
$_SESSION ["blah"]["baz"][" foo "]["blah"]= "quux";
BBB$_SESSION ["blah"]["blah"]["foo"]["blah"]= "corge";
$_SESSION ["blah"][" foo "]["blah"]= "graultgarplywaldo";
I:\>
posted by chazlarson at 9:33 AM on March 3, 2010
The batch file idea is probably the simplest. This is also a sort of PHP101 type lesson - the kind that even I could do if I put my mind to it. All you have to do is create an HTML form where all the first bits go & then create a PHP page that calls in the variables that have been passed along where appropriate within the rest of the text.
Then select all, copy, paste into your text editor & keep going.
An alternate way would be to use a search & replace program that just did:
Replace "[XXX]" with "Bob Smith"
Replace "[YYY]" with "100 Main Street"
etc.
To the same block of text & spit out a new file. ReplaceText is great in that you can define a bunch of this stuff up front in a sort of spreadsheet style UI & even save & export/import the replace tables for later use.
posted by MesoFilter at 10:12 AM on March 3, 2010
Then select all, copy, paste into your text editor & keep going.
An alternate way would be to use a search & replace program that just did:
Replace "[XXX]" with "Bob Smith"
Replace "[YYY]" with "100 Main Street"
etc.
To the same block of text & spit out a new file. ReplaceText is great in that you can define a bunch of this stuff up front in a sort of spreadsheet style UI & even save & export/import the replace tables for later use.
posted by MesoFilter at 10:12 AM on March 3, 2010
Doofus Mango has it right. This sounds like (no offense intended) "But I have a HAMMER!" syndrome. Is there something sensitive about the eventual application of this (unusual, dangerous, and terribly kludgy) hack that prevents you from describing what you want to do rather than how you want it done? I give much better advice when people say, "My wheel keeps falling off; how do I keep the nuts from unscrewing?" than when they ask, "What's the best way to keep spilled thermite from burning the rubber when I weld my lug nuts on?"
posted by d. z. wang at 10:43 AM on March 3, 2010
posted by d. z. wang at 10:43 AM on March 3, 2010
Perl Template Toolkit is my favorite hammer for this particular nail, but, like other people say, your question gives a strong Doing It Wrong vibe. Don't be put off by the name, virtually no perl knowledge is required to use it.
posted by Dr Dracator at 11:09 AM on March 3, 2010
posted by Dr Dracator at 11:09 AM on March 3, 2010
This thread is closed to new comments.
posted by themel at 8:10 AM on March 3, 2010