Source language: Translate to:

Question on how to format IF Contains statement

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Question on how to format IF Contains statement

Postby lowridertj » Mon Jan 07, 2013 10:29 am

Im reading a file into a variable

And I want to see if something is contained within that variable regardless of case
How would I structure this in neobook?

your help is greatly appreciate and thank you in advance.
Internet Automation www.botguru.net
Skype: emw-dgn
lowridertj
 
Posts: 11
Joined: Mon Jul 16, 2012 11:43 am

Re: Question on how to format IF Contains statement

Postby dec » Mon Jan 07, 2013 11:19 am

Hello,

With the information you provide, I think on a very simple way to search if an string is found in another string, just using the "SearchStr" NeoBook native action. More possible solutions can be available, using or not native NeoBook actions, for example, search for an string using Regular Expressions it is possible using my npRexp plugin. Anyway, take a look at the bellow sample, which use the "SearchStr" action to find an string into another previously loaded from a file:

http://neoplugins.com/?download/searchstr.zip

Hope this can help you in some manner. ;)
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Host file check for distibuting software

Postby lowridertj » Mon Jan 07, 2013 12:14 pm

thank you that worked perfectly..

What I came up with was a host file check that could be incorporated for distrobution software, that is only 1 of many checks that should be performed.. but working out a massive system at the moment for it.

example code
Code: Select all
.CHECK HOSTS FILE
FileExists "[SystemDir]drivers\etc\hosts" "[hostfile]"
If "[hostfile]" "=" "False"
   .AlertBox "Error" "Cant find host file in [SystemDir]drivers\etc\hosts"
Else
    FileRead "[SystemDir]drivers\etc\hosts" "All" "[hostfile_details]"
    SearchStr "YOUR DOMAIN NAME HERE" "[hostfile_details]" "[found_in_host_file]"
if "[found_in_host_file]" ">" "0"
    SendMail "EMAIL TO" "EMAIL FROM" "Host File Hack Attempt" "A Host file hack was attempted with 'domain name' from ip: " "" "HideProgress"
    AlertBox "Error" "We have emailed support, We believe you to be attempting to run a pirated copy!"
    Exit "" ""
EndIf
    SearchStr "YOUR IP OF SERVER HOST HERE" "[hostfile_details]" "[found_in_host_file]"
if "[found_in_host_file]" ">" "0"
    SendMail "EMAIL TO" "EMAIL FROM" "Host File Hack Attempt" "A Host file hack was attempted with 'ip of server' from ip: " "" "HideProgress"
    AlertBox "Error" "We have emailed support, We believe you to be attempting to run a pirated copy!"
    Exit "" ""
EndIf

EndIf
Internet Automation www.botguru.net
Skype: emw-dgn
lowridertj
 
Posts: 11
Joined: Mon Jul 16, 2012 11:43 am


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest

cron