Source language: Translate to:

action

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

action

Postby Alex » Thu Oct 05, 2006 9:49 am

I have a problem which I do not manage to solve, it is as follows: If I write in my TextEntry “Microsoft”, or a sentence which comprises the word Microsoft (yes, it would be although I do not have to write full with sentences different in the programming from TextEntry whereas it should know only one word) it answers me in the box “result”: “Microsoft is a company, want you more information?”. If I say yes in my Text-Entry, it goes on the page “www.microsoft.com” if I say not, it answers me in “result” OK It has the easy surface but I do not find, want to look at what I made to help me please
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Neosoft Support » Thu Oct 05, 2006 11:50 am

I'm not sure I completely understand what you're asking for, but if you want to search for the word "Microsoft" withing something typed into a text entry field, you can try this:

SearchStr "Microsoft" "[TextEntry1]" "[FoundPos]"
If "[FoundPos]" ">" "0"
AlertBox "Found" "Microsoft was found!"
Else
AlertBox "Sorry" "Microsoft was NOT found!"
EndIf
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Alex » Fri Oct 06, 2006 7:44 am

Thanks,

But it's not what I asked,

I will writte in the "TextEntry" the word Microsoft (It's what you give me) and when I puch the button "Go" it show in the "result" : "Microsoft is a company, want you more information ?" When I writte "Yes" in the TextEntry it gives me a InternetLink "www.microsoft.com" or if I write "No" it says "OK"


Thanks
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Neosoft Support » Fri Oct 06, 2006 10:50 am

Artificial intelligence is a pretty advance topic, and there are many ways to approach it. You could use a series of SearchStr actions to look for specific words, like "Microsoft". You could create a database of keywords and responses, then perform a query based on what the user enters.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Alex » Fri Oct 06, 2006 12:41 pm

Thanks,

But it's not what I will do.

When I write the word Micorosoft.
It says if I will information

If in the TextEntry I write Yes it go on www.micorosft.com

If No, it do nothing

My inclue was :



If "[TextEntry]" "<=" "Microsoft"
setvar "[result]" "Microsoft is a compagny, do you whish more info ?"
If "[TextEntry]" "=" "Yes"
InternetLink "http://www.microsoft.com"
else
setvar "[result]" "OK"
EndIf
Endif


Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Sam Cox » Fri Oct 06, 2006 1:23 pm

Perhaps this will work for you:
Code: Select all
If "[TextEntry]" "=" "Microsoft"
  SetVar "[Question]" "Microsoft is a company.|Do you want more information?"
  MessageBox "YES OR NO" "[Question]" "Yes|No|Cancel" "[Answer]"
  If "[Answer]" "=" "1"
    InternetLink "http://www.microsoft.com"
  Endif
Endif
User avatar
Sam Cox
 
Posts: 768
Joined: Fri Apr 01, 2005 7:30 am
Location: Loveland CO USA

Postby Alex » Fri Oct 06, 2006 10:43 pm

Thanks

But can I use something compared to the message box, I don't will have a message box, I will have this in Result.

It ask in the result if I want to have more info about Microsoft and I have to write yes or no in the TextEntry.



Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Gaev » Sat Oct 07, 2006 7:27 am

Alex:

If I understand you correctly ... you want to use a TextEntry Box to have an ongoing conversation between the user and your program ... don't know why you would want to restrict yourself to this kind of interface (as NeoBook offers a rich set of facilities for a full-fledged Graphical User Interface (GUI) ... but you might try this ...

a) somewhere in your startup section ...
Code: Select all
SetVar "[QuestionText]" "Microsoft is a company, do you whish more info ?"

b) in the TextChange section of the TextEntry Box ...
Code: Select all
If "[TextEntry]" "=" "Microsoft"
   SetVar "[result]" "[QuestionText]"
EndIf

If "[TextEntry]" "=" "Yes"
   If "[result]" "=" "[QuestionText]"
      SetVar "[result]" "OK"
      InternetLink "http://www.microsoft.com"
   Endif
EndIf

If "[TextEntry]" "=" "No"
   If "[result]" "=" "[QuestionText]"
      SetVar "[result]" "OK"
   Endif
EndIf


This will work for the requirement you specified ... but I am assuming that you will want to take the user to other sites e.g. Yahoo, Google, NeoSoftware ... in which case, you either end up with a whole bunch of If "[TextEntry]" "=" "XXXXX" ... type commands (not recommended) or you exploit other facilities of NeoBook (like List/Combo Boxes) ... or if the list very large, the NeoBookDB plugin.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Alex » Sat Oct 07, 2006 10:47 am

Thank you very much


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am


Return to NeoBook Action Commands

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest