Indigo Rose Software
  #1  
Old 09-18-2005
mrdude mrdude is offline
Forum Member
 
Join Date: Jun 2004
Posts: 105
Replace string help please

Hi guys, can anyone tell me how to do this?

Ok I have a document with a certain string value inside it, I then want to make APMS open that document, find the string and then replace it with one from an input box and then save/replace the document with the value from the input box.

How do I go about this - I'm using the demo of APMS 6 but can't find any examples.

Thanks.
Reply With Quote
  #2  
Old 09-18-2005
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
Hi. What format is your "document"?
Reply With Quote
  #3  
Old 09-18-2005
mrdude mrdude is offline
Forum Member
 
Join Date: Jun 2004
Posts: 105
Quote:
Originally Posted by Corey
Hi. What format is your "document"?

It's a html web page that has some text in it that I want to be able to change using a database, basically I select an entry in the database and it is then shown in an input box - from the input box I want the enrty to be writen to the html page so that the next time the page is loaded the new text value from the database is shown.

I already have the database working fine and putting the entries in the input box - I am stuck on the searching for a string value part in the html document and then replacing it with the new value from the database.

Last edited by mrdude; 09-18-2005 at 12:07 PM.
Reply With Quote
  #4  
Old 09-18-2005
Dermot Dermot is offline
Indigo Rose Customer
 
Join Date: Apr 2004
Location: Vancouver, Canada
Posts: 1,520
Try this

Code:
-- Load in your html file
SourceFile = TextFile.ReadToString("Path and file name of your html file.html")

-- Find and replace the text
OutPutFile = String.Replace("SourceFile", "Text To Replace", "Text to replace with", false)

-- Save the file
TextFile.WriteFromString(OutPutFile, "Path and file name to save as.html", false)
__________________
Dermot

AMS Add-ons - xDialog.com

A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.
Reply With Quote
  #5  
Old 09-18-2005
mrdude mrdude is offline
Forum Member
 
Join Date: Jun 2004
Posts: 105
Thanks - Got it working with this:

Code:
-- Load in your html file
SourceFile = TextFile.ReadToString("AutoPlay\\Docs\\page1.htm")

-- get the data from our input fields
text1 = Input.GetText("Inputmac");

-- Find and replace the text
result = String.Replace(SourceFile, "000123456789", text1, false);

-- Save the file
TextFile.WriteFromString("AutoPlay\\Docs\\page2.htm", result, false)

-- Reload web page ---
Web.LoadURL("Web1", "AutoPlay\\Docs\\page2.htm");
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross-Eyed XML Worm Developer's Den 7 09-01-2005 09:55 AM
String Replace Bruce AutoPlay Media Studio 4.0 12 09-09-2003 10:39 AM
replace a character in a string boudie Setup Factory 6.0 7 06-10-2003 09:48 AM
string search & replace antjedi AutoPlay Media Studio 4.0 5 10-22-2002 12:02 PM
String search and replace tuhkanen Setup Factory 6.0 0 04-15-2002 08:31 PM


All times are GMT -6. The time now is 11:19 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software