CaptainSparky Posted June 7, 2015 Share Posted June 7, 2015 my script is a chatbot, It's a little hard to explain so Imma do my best, I need this:1) I send a message to the chatbot, "hello there okay"2) make the script read ini file and search for key "hello" then "there" then "okay", in other words, I need my script to split this "hello there okay" into $var1= "hello" $var2 = "there", $var3 = "okay." THANKS in advance!expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <File.au3> #include <Misc.au3> #Include <Array.au3> Global $BrainLocation = @ScriptDir & "\brain.txt" Global $FormName = "Project Lisa" Global $ReatInput = "null" Global $BrainCount = 1 Global $Random[100] Global $RandomCount = 0 Global $ReatBrain[100] Global $BrainData[100] Loader() Func Loader() Global $Form = GUICreate($FormName, 417, 279, 192, 124) Global $Output = GUICtrlCreateEdit("", 8, 8, 401, 225, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_HSCROLL),0) Global $Input = GUICtrlCreateInput("", 104, 240, 209, 21) GUISetState(@SW_SHOW) ControlFocus($FormName,"",$input) HotKeySet("{ENTER}","SendText") Main() EndFunc func Main() HotKeySet("{ENTER}","SendText") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc Func SendText() Global $ReatInput = GUICtrlRead($Input) GUICtrlSetData($Output,@CRLF & "You > " & $ReatInput,1) CreateRandoms() EndFunc Func CreateRandoms() While $RandomCount <> 100 $Random[$RandomCount] = Random(1,$RandomCount,1) $RandomCount += 1 WEnd $RandomCount = 0 CheckBrain() EndFunc Func CheckBrain() $ReatBrain[$BrainCount] = IniRead($brainlocation,"Brain",$ReatInput & $BrainCount,"error") If $ReatBrain[$BrainCount] = "error" then If $BrainCount = 1 Then NoUnderstand() EndIf ; right here If $ReatBrain[$BrainCount] <> 1 Then sleep(1000) GUICtrlSetData($Output,@CRLF & "Lisa > " & $ReatBrain[$Random[$BrainCount]],1) Main() EndIf ;right here EndIf $BrainCount += 1 CheckBrain() EndFunc Func NoUnderstand() sleep(1000) $ReatBrain = IniRead($BrainLocation,"Values","NoUnderstand" & $Random[5],"error") GUICtrlSetData($Output,@CRLF & "Lisa > " & $ReatBrain,1) Main() EndFunc Func Done() sleep(1000) GUICtrlSetData($Output,@CRLF & "Lisa > " & $ReatBrain,1) Main() EndFunc Hello. If in someway I have helped, please consider liking my post(s). The formula for the right answer: You + Right Question = Answer (Think) BEFORE you post. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 7, 2015 Developers Share Posted June 7, 2015 StringSplit() should do it.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
CaptainSparky Posted June 7, 2015 Author Share Posted June 7, 2015 Also, this: what's the operator for anything, here:if fileexists("C:\windows\f" & *)... (where * is the anything operator) how you do it in autoit?Thanks in advance Hello. If in someway I have helped, please consider liking my post(s). The formula for the right answer: You + Right Question = Answer (Think) BEFORE you post. Link to comment Share on other sites More sharing options...
CaptainSparky Posted June 7, 2015 Author Share Posted June 7, 2015 StringSplit() should do it.JosAlso, this: what's the operator for anything, here:if fileexists("C:\windows\f" & *)... (where * is the anything operator) how you do it in autoit?Thanks in advance Hello. If in someway I have helped, please consider liking my post(s). The formula for the right answer: You + Right Question = Answer (Think) BEFORE you post. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 7, 2015 Developers Share Posted June 7, 2015 (edited) Not sure what the question is? Are you trying to check whether any file exists in c:\windows that is equal to the maks f* ?If so then FileFindFirstFile() should work.Jos Edited June 7, 2015 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
CaptainSparky Posted June 7, 2015 Author Share Posted June 7, 2015 For example, I need the character that means "anything after" for example in DOS you do (del *) and deletes all, I need to know how the * works in autoit. Hello. If in someway I have helped, please consider liking my post(s). The formula for the right answer: You + Right Question = Answer (Think) BEFORE you post. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 7, 2015 Developers Share Posted June 7, 2015 (edited) Look in the helpfile at the function I mentioned, FileFindFirstFile().Jos Edited June 7, 2015 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now