Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 6:55 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: A simple search box
PostPosted: March 21st, 2005, 8:11 pm 
Offline
User avatar

Joined: March 12th, 2005, 10:31 pm
Posts: 140
Location: U.S.A. - Deep South
Opus: ver 7.06 - Opus Pro - Build 15130
OS: Windows XP Build 2600 Service Pack 3
System: (2) 3.2 CPUs Intel - (2) gigs ram - 3.2 tb HD
I have asked for a simple search box on a text page for a long time. I have a program that would be greatly enhanced if one were provided. The answer I always got back was that there is already a search, just rewrite it to do what you want.

One of the reasons I love Opus is because you don't have to know how to write code to create some great multimedia... (long answer for... I don't know how to write code).

Has anyone else solved this problem? Is so, would you please explain how it is done?

This is what I'm trying to accomplish. The one below is what you get when you do a ctrl F in windows. This would be perfect if I could accomplish it in an Opus program


Image

_________________
PlanetDenn.com
Lots of Fun Freeware
Image


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 22nd, 2005, 12:18 am 
Offline

Joined: November 3rd, 2004, 8:12 pm
Posts: 129
Location: New Brunswick, Canada
Opus: 8.6
OS: Win 8 (ASUS) - Win 7: (ASUS)
System: Asus - Windows 7 - 8 - Intel Core 3 - 4RAM - 16RAM
Denn,

Check out the Graphics in Action site and look at the Services section:
http://graphicsinaction.com/forum.htm

_________________
Leo Taylor
Win XP Home / Opus Pro 7.01 & 6.4 / P4-2.8 / 1.5 GB RAM / ATI All-in-Wonder 9600 /160GB-HD


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 22nd, 2005, 12:23 am 
Offline

Joined: November 19th, 2004, 1:36 pm
Posts: 178
Location: Birmingham
have you tried chris jones ?

from what I've seen on his website he seems to be an expert at search tools...

unless I'm mistaken!



http://graphicsinaction.com/forum.htm

edit:

well they say great minds think alike!!!!


Top
 Profile  
 
 Post subject:
PostPosted: March 23rd, 2005, 2:31 am 
Offline
User avatar

Joined: March 12th, 2005, 10:31 pm
Posts: 140
Location: U.S.A. - Deep South
Opus: ver 7.06 - Opus Pro - Build 15130
OS: Windows XP Build 2600 Service Pack 3
System: (2) 3.2 CPUs Intel - (2) gigs ram - 3.2 tb HD
Thanks to you both. I've downloaded the search that Chris Jones did and it's very nice... however, once again it's over kill and more than I need. I really need a very simple find box that can be attached to a text file where the single click of a button would open up the search box to look up any word within the text file you have already attached it to. No bells… no whistles… no cigars… just a simple find.


Image

_________________
PlanetDenn.com
Lots of Fun Freeware
Image


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 23rd, 2005, 4:15 am 
Denn

Have you thought of asking Chris for a quote to make you exactly what you want? I'm sure he would be interested in making it for a fee.

Based on watching the Opus newgroups for almost 5 years, and from memory I can't recall there being a great demand for this feature.


Top
   
 
 Post subject:
PostPosted: March 23rd, 2005, 3:59 pm 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi,

Thank you for your enquiry.

Please find attached a sample publication which features a simple pop-up 'Find Text' field. Clicking the Find Next button calls the find() function which uses a series of script actions to search through the contents of the Text object and highlight each instance of the search string.

To use this example in your publication, simply copy all of the objects from the page and paste them into one of your publication pages. Now click Publication > Publication Properties > Variables, click Add and create a variable named inputstring with a default blank text value.

Now simply open the properties of the Text object, select the Text tab and change the file referenced in the 'Automatically read in this disk file' field to point to the text file you wish to display. The publication should now operate as expected.

Kind regards,


You do not have the required permissions to view the files attached to this post.

_________________
Robin Garrett
Digital Workshop Technical Support


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 23rd, 2005, 5:06 pm 
Offline
User avatar

Joined: March 12th, 2005, 10:31 pm
Posts: 140
Location: U.S.A. - Deep South
Opus: ver 7.06 - Opus Pro - Build 15130
OS: Windows XP Build 2600 Service Pack 3
System: (2) 3.2 CPUs Intel - (2) gigs ram - 3.2 tb HD
Robin Garrett wrote:
Hi,

Thank you for your enquiry.

Please find attached a sample publication which features a simple pop-up 'Find Text' field. Clicking the Find Next button calls the find() function which uses a series of script actions to search through the contents of the Text object and highlight each instance of the search string.

To use this example in your publication, simply copy all of the objects from the page and paste them into one of your publication pages. Now click Publication > Publication Properties > Variables, click Add and create a variable named inputstring with a default blank text value.

Now simply open the properties of the Text object, select the Text tab and change the file referenced in the 'Automatically read in this disk file' field to point to the text file you wish to display. The publication should now operate as expected.

Kind regards,

Robin,

Thank you... that is most appreciated. I will start on it immediately.

Image

_________________
PlanetDenn.com
Lots of Fun Freeware
Image


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 24th, 2005, 3:59 pm 
Offline
User avatar

Joined: March 12th, 2005, 10:31 pm
Posts: 140
Location: U.S.A. - Deep South
Opus: ver 7.06 - Opus Pro - Build 15130
OS: Windows XP Build 2600 Service Pack 3
System: (2) 3.2 CPUs Intel - (2) gigs ram - 3.2 tb HD
Robin,

Once again I want to thank you for the script. It works great, but does have a quirk that I want to ask you about.

Also there is a difference between what you did and what I was doing so I had to adjust the script. I changed the name of the text file from “Text” to “TextInput1”. There is also a TextInput2 and TextInput3 in the program so I adjusted the script for each.

The one small quirk that I was talking about is this. If you search for something that doesn’t exist, the script highlights the entire text being searched through. Is there anything that could be added to the script to make it pop up something saying “Text not found” instead?

Below shows (in blue) the changes I did.

lastsearch = 0

function find() {
TextInput1.SetSelection(0,-1)
var newStyle = new Object
newStyle.backgroundcolour = "transparent"
newStyle.colour = "000000"
TextInput1.SetSelectionStyle(newStyle)
wholetext = TextInput1.GetSelectionText()
stringexists = String.contains(wholetext,inputstring)
if (stringexists == true) {
searchlength = String.length(inputstring)
lastinstance = wholetext.lastIndexOf(inputstring)
firstchar = wholetext.indexOf(inputstring,lastsearch)
lastchar = firstchar + searchlength
lastsearch = lastchar
TextInput1.SetSelection(firstchar,lastchar)
var newStyle = new Object
newStyle.backgroundcolour = "000080"
newStyle.colour = "FFFFFF"
TextInput1.SetSelectionStyle(newStyle)
linenumber = TextInput1.LineFromChar(firstchar)
TextInput1.Scroll("LineTo", linenumber)
if (firstchar == lastinstance) {
lastsearch = 0
}
}
}

_________________
PlanetDenn.com
Lots of Fun Freeware
Image


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 24th, 2005, 4:26 pm 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi,

Thank you for your reply.

I'm afraid that I cannot replicate the behaviour you describe. When I type a string which does not appear in the text and click Find Next, nothing happens.

Please find attached an updated version of the original sample which now displays an error message (similar to Notepad's) when the search string cannot be found in the text.

Kind regards,


You do not have the required permissions to view the files attached to this post.

_________________
Robin Garrett
Digital Workshop Technical Support


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 25th, 2005, 6:39 am 
Offline
User avatar

Joined: March 12th, 2005, 10:31 pm
Posts: 140
Location: U.S.A. - Deep South
Opus: ver 7.06 - Opus Pro - Build 15130
OS: Windows XP Build 2600 Service Pack 3
System: (2) 3.2 CPUs Intel - (2) gigs ram - 3.2 tb HD
Robin Garrett wrote:
Hi,

Thank you for your reply.

I'm afraid that I cannot replicate the behaviour you describe. When I type a string which does not appear in the text and click Find Next, nothing happens.

Please find attached an updated version of the original sample which now displays an error message (similar to Notepad's) when the search string cannot be found in the text.

Kind regards,

Once again I am in your debt. You have brilliantly shown how the right script can solve a problem. My little program went from being good, to being great thanks to you.

I truly appreciate the help

Dennis

_________________
PlanetDenn.com
Lots of Fun Freeware
Image


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 50 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group