
PRO
rz90208
USA
Asked
— Edited
I receive the error: Error on line 7: Missing ) in Expression
$HumanSaid = "How far is the earth from the moon"
$URL="http://api.brainshop.ai/get?bid=xxx&key=xxxxxxxxxx&uid=1&msg=" + $HumanSaid
$URL = $URL + "Hello There"
sleep(3000)
$Answer = HttpGet($URL)
$StringLength = length($Answer)
$MessageLength = $StringLength - 14
$APIResponse = SubString($Answer,11,$MessageLength)
Say($APIResponse)
The variable $Answer = "{"cnt":"The moon is 252,088 miles (405,696 km) from Earth."}" If $Answer does not contain the character ( , the code works fine.
OK. I finally took some time and revised the Text Scrubber program I have for more basic operation.
I have uploaded a project called ScrubProgBasic.ezb. It contains the scripts needed to make the scrubbing of web site text possible. It also contains 2 Notepad controls with a description of how it all works and how to use it.
Additionally, I have attached a zip file to this post which contains the executable file needed to make it all work, as well as, an .rtf file with the same information as in the Notepad controls. The difference is that, being rtf formatted it has appropriate bolding and color added to help make the text easier to read and understand. Otherwise the information is the same. Of course, by having it free from the project it can be placed at hand on the screen for reference.
NOTE: This zip file has been updated as of 10/01/2016 at approx. 5:00 PM
This project has been checked, but not fully. Not every possibility has been run. But I'm putting it out now to get it into the hands of users. Consider it a Beta release. While I expect it operate as expected, one never knows where software is concerned.
The first thing to do is to decide where you want to place the executable file, ScrubText.exe and modify the variable, $UserDir in MainScript to that directory path. Place ScrubText.exe there and everything else will fall into place. You can put it anywhere you like, on any drive. The default directory path is: $UserDir ="C:\Users\Public\Documents\TextScrubber".
Once you have done that you can run the ScrubInit script (once) to set everything up, and then run MainScript to watch it work. You won't really see anything since the program will be invisible when it runs, though the screen may refresh. MainScript is initially set up to run the system in Line By Line mode. That means the scrubbed text will be displayed in the monitor window line by line as it is read from the result file. It will go by really fast, so you won't actually be able to read it. It's just to demonstrate the operation.
That is one of two modes in which it can gather the data from the web site. The other is the "All At Once" mode in which the scrubbed text can be read into a single variable all at once. Unfortunately these two modes are mutually exclusive. This is explained in the documentation. Generally, you will find the line by line mode better to use.
The ScrubText.exe program does not run in the background. It only runs when scrubbing the web site raw text. It has no associated .ini file, nor does it make any entries in the Registry. It does create a few files for it's own use that reside in the same directory as it does. This means that if you wish to place it somewhere else later, all you have to do is move the executable file there and change the $UserDir variable to reflect that change. You can also delete the old directory and it's contents.
Let me know if you have questions and concerns.
ScrubFiles.zip
Outstanding!, Thank you. I hope to find time to implement this this weekend. I will let you know how it goes. Thank you again
@rz90208 You're welcome. Glad to help.
One thing though. There are a couple of lines in the MainScript script which need to be removed. They are:
The script will still work even with it in, but it's redundant and the $GetRawData variable will have no effect as long as the second line is there. I'll be uploading a corrected project shortly.
Wow, this is a lot of technical anf detailed work. Thanks so much for going through all this trouble. This is very valuable stuff. Much appreciated!
@Dave_Schulpius
You're very welcome as well.
To ALL I went in to add a new section to the documentation in the Notepad controls and the rtf file and noticed some spelling errors. So I decided to run another spell check and found a number of other errors. Strange they weren't caught the first time. Anyway. as a result, I have re-uploaded the ScrubTextBasic.ezb file to reflect those changes.
Additionally, I revised the zip file in Post # 10. However, for convenience sake I have also zipped up just the rtf file with the added section as well as the corrections, attaching it to this post. Please download this revised rtf file version and kill the old one with fire. Thanks. ScrubTextBasic.zip
Revisions, Revisions, Revisions
I figured out a reasonably easy way to add case sensitivity selection to the ScrubText program and decided to implement it. The revised project has been uploaded to the cloud. Only the text in the Notepad control needed revision to reflect this new option so you don't need to download again if you don't want to.
However, you will need to download the new ScrubText executable. To do so, please go to post #10 and download the ScrubFiles.zip file which is attached to it.
While I was adding the case sensitivity option to the program, I discovered a potential bug in the software that can fill the ModData.txt file with incorrect data in some circumstances. Thus, you should download the zip file even if case sensitivity is not important to you (case sensitive = True is the current default). Once you have the new zip file, please replace the ScrubText.exe program with the new one and the ScrubText Basic.rtf you have now with the revised one.
The case sensitivity options are explained in the rtf file, but I'll list them here so you won't have to go through the entire text to find it.
Two of the parameters used in the scrub system are ::STT and ::ENT. The ::ENT parameter has been changed to ::ETT to better conform with the case sensitivity options. Two new parameters have been added. They are ::STF and ::ETF. These two parameters correspond directly to :STT and ::ETT. Each behaves exactly as their corresponding ones do except that they are not case sensitive.
STT stands for Start Text True and ETT stands for End Text True. The True part meaning Case Sensitive = True. Likewise, ::STF stands for Start Text False and ETF is End Text False. Meaning the search performed by them is Case Insensitive (Case Sensitive = False).
There is one more new Command; ::RCS. This stands for Replace Case Sensitive. This refers to character replacements (substitutions). The default in the ScrubText progran is Case Sensitive = True. To make the substitution search and replace case insensitive, you will need to send the command: ::RCS=False in the $ConStr variable.
Sorry about all that, but that's how it goes with new software.