Source language: Translate to:

Search in ListBox or ComboBox

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Postby Alex » Sun Dec 05, 2010 9:34 am

Hi virger,

It doesn't work.

I create a list box were I put some sentenses.
I create a file in Function where I put this:
Code: Select all
{NeoBook Function}
Version=5.60
Language=JScript
Param=[%par1]|Variable|To Search
Param=[%par2]|Variable|Source String
Param=[%pos]|Variable|Return Position
{End}

I create a push button where I put this:
Code: Select all
Call "WichLine" "word" "" "[line1]"


And there is not result. Is my code correct?

Thanks


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

My apologies...

Postby virger » Sun Dec 05, 2010 10:50 am

My apologies, had not seen, did not add the function that creates complete, this is correct:
++++++++++++++++
{NeoBook Function}
Version=5.60
Language=JScript
Param=[%par1]|Variable|To Search
Param=[%par2]|Variable|Source String
Param=[%pos]|Variable|Return Position
{End}
var pr = nbGetVar("[%par1]");
var st = nbGetVar("[%par2]");
var re = new RegExp("^.*"+pr+".*$","mgi");
var ps = st.search(re);
var ln = st.substr(0,ps).split("\n").length;
nbSetVar( '[%pos]', ln )
++++++++++++++++

However, lines 12000 to search for, the response time is much longer, so I recommended the other option, using the "grep.exe"
User avatar
virger
 
Posts: 510
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Postby Alex » Thu Dec 09, 2010 7:41 am

Hi virger,

Thank you very much.

Best Regards


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

Previous

Return to NeoBook Action Commands

Who is online

Users browsing this forum: Bing [Bot] and 2 guests