Author Topic: Pick And Pull Scripts  (Read 5862 times)

onthecuttingedge2005

  • Guest
Pick And Pull Scripts
« on: December 15, 2017, 05:09:45 pm »
I Started this thread so we can show off Tid Bit skills and helpful functions. please keep the
scripts small as possible.

'Also, I am not responsible for your mistakes in using any pick and pull scripts
'use at your own risk.

'here is another edge.

Code: [Select]

'Compliments of The Edge.
    'Tight little package for ending any further responses.
    'Exit Function does the same thing but when that becomes
    'illegal in a script this little Tid Bit can save ones butt.
    'this line goes to top of a routine or function.
    'it extracts stored variables for script transfer.
    EndResponse = HalBrain.ExtractVar(CustomMem, "EndResponse")
    'variable to end a script specifically as a priority.
    'if True then End Response.
    EndResponse = False
    'the magic bullets are here.
    If EndResponse = True Then OriginalSentence = ""
    If EndResponse = True Then UserSentence = ""
    'place our variables back into custom memory.
    'usually located at bottom of a function.
    CustomMem = HalBrain.EncodeVar(EndResponse, "EndResponse")


'Example:
If SomeVariable <> "" Then
GetResponse = "" & SomeResponse & ""
'priority response
EndResponse = True
'no more GetResponse's will be given
'below this script line.
End If


Enjoy!
Happy Holidays.
Jerry 8)
« Last Edit: December 19, 2017, 09:41:04 pm by OnTheCuttingEdge »

onthecuttingedge2005

  • Guest
Re: Pick And Pull Scripts
« Reply #1 on: December 19, 2017, 09:31:21 pm »
'A Work of Art. for all you scrip-tors who like to scribe, lol
'This Script removes duplicate responses inside a full GetResponse.

'updated
'added punctuation adjustments for periods with no space trailing.

'The Script & help.
Code: [Select]

'Compliments of the Edge.
'Remove duplicate responses from full getresponse.
'Usually more effective near the bottom of all getresponses.
'This routine does work for all responses, PrevSent, PrevUserSent
'OriginalSentence and UserSentence i.e GetResponse.
HalString = GetResponse', <-- change this to what you want cleaned.
GetResponse = "" 'temporaraly suspend getresponse for cleaning.
Set oDict = CreateObject("Scripting.Dictionary")
oDict.CompareMode = vbTextCompare
For Each Sentence In Split(HalString, ". ")
    oDict(Sentence) = Null
Next
MasterResponse = Join(oDict.Keys, ". ")
'Adjust for punctuation.
MasterResponse = Replace(MasterResponse, "  ", " ", 1, - 1, vbTextCompare)
MasterResponse = Replace(MasterResponse, ".", ". ", 1, -1, vbTextCompare)
MasterResponse = Replace(MasterResponse, "  ", " ", 1, -1, vbTextCompare)
GetResponse = MasterResponse', <-- all duplicate entries in Getresponse
'are removed before the response is given.
GetResponse = GetResponse & vbCrLf
Set oDict = Nothing
HalBrain.DebugWatch MasterResponse, "MasterResponse"


this script works best between Rem PLUGIN: PLUGINAREA7 and
Rem PLUGIN: CUSTOMMEM2 in the Hal Brain Editor. to catch as many
GetResponses as possible. assembled getresponses act differently because
of word assembly differences. if there is 1% difference between
compares the script will consider it as being different and not remove it
from the getresponse list. but it will be different.

always make a backup, even if you are experienced.

download below to your Ultra Hal 6 or 7 folder
choose plug in brain options.

Happy Holidays and Merry Christmas.
Jerry 8)
« Last Edit: December 20, 2017, 07:56:19 pm by OnTheCuttingEdge »

onthecuttingedge2005

  • Guest
Re: Pick And Pull Scripts
« Reply #2 on: December 20, 2017, 07:37:52 pm »
updated the GetResponse cleaner script.

1. temporarily clipped GetResponse during cleaning
and then re-insert GetResponse As Cleaned.

I'll probably make a plug for this soon. because it is a utility.
really, every script needs a janitor? C'mon.. lol

okay, I'll call it the Janitor, you happy, lol

okay, plug-in download is posted

Jerry 8)
« Last Edit: December 20, 2017, 07:57:38 pm by OnTheCuttingEdge »

Arkright

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Pick And Pull Scripts
« Reply #3 on: December 22, 2017, 05:55:57 pm »
Thank you OnTheCuttingEdge!
what would the world be without janitors of any kind.
^,=,^

onthecuttingedge2005

  • Guest
Re: Pick And Pull Scripts
« Reply #4 on: December 22, 2017, 10:19:21 pm »
thanks. I appreciate the boost.

onthecuttingedge2005

  • Guest
Re: Pick And Pull Scripts
« Reply #5 on: December 22, 2017, 10:51:37 pm »
I still love candy.

Code: [Select]
'As String translated from visual basic for use in vbscript.-As String.
Do While HalFeedBack = "  "', <-double spaces
'some reference to a table here as HalFeedBack. -on this line.
Delimiter = " "', one space. punctuation can be used here.
   HalFeedBack = Split(HalFeedBack, Delimiter)
   HalFeedBack = Join(HalFeedBack, Delimiter)
   HalFeedBack = Replace(HalFeedBack, "  ", " ", 1, - 1, vbTextCompare)
   'String output cleaned.
   'one can use ReadAll in this candy package as well.
   Loop

this is for educational experience, you can change your flavor
of candy to whatever you like.
some people like butterscotch but I think I'll stick to my Licorice.

Happy Holidays for you and yours.
Jerry :)
« Last Edit: December 23, 2017, 09:08:12 pm by OnTheCuttingEdge »

onthecuttingedge2005

  • Guest
Re: Pick And Pull Scripts
« Reply #6 on: January 04, 2018, 01:56:49 am »
'A wikipedia tag filter.

Code: [Select]
'Rem Type=Plugin
'Rem Name=Wikipedia tag filter 01_03_2018
'Rem Author=Gerald L. Blakley A.K.A OnTheCuttingEdge2005
'Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "Formats and removes wikipedia tags i.e [1] to [1000]."
    lblPlugin(0).Move 120, 10, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub

Rem PLUGIN: CUSTOMMEM
    'The preceding comment is actually a plug-in directive for
    'the Ultra Hal host application. It allows for code snippets
    'to be inserted here on-the-fly based on user configuration.
   
'wiki tag type Filter if existing tags exist.
For i = 1 To 1000
   OriginalSentence = Replace(OriginalSentence, ("[" & i & "]"), "", 1, - 1, vbTextCompare)
   UserSentence = Replace(UserSentence, ("[" & i & "]"), "", 1, - 1, vbTextCompare)
Next

 Rem PLUGIN: CUSTOMMEM2
    'The preceding comment is actually a plug-in directive for
    'the Ultra Hal host application. It allows for code snippets
    'to be inserted here on-the-fly based on user configuration.

'wiki tag type Filter if existing tags exist.
For i = 1 To 1000
   GetResponse = Replace(GetResponse, ("[" & i & "]"), "", 1, - 1, vbTextCompare)
Next

or download plug below, slip into your Hal 6 or 7 folder
choose plug via brain options.

Jerry 8)

onthecuttingedge2005

  • Guest
Re: Pick And Pull Scripts
« Reply #7 on: January 05, 2018, 12:27:54 am »
'Math scripts will be added below over time.

Hi Rob.

You can add this to your Hal 7 Math script.

MathSent = Replace(MathSent, " IS?", " = ?", 1, -1, vbTextCompare)

works very well
Jerry