|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
Hi. What format is your "document"?
|
|
#3
|
|||
|
|||
|
Quote:
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. |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
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");
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
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.








Linear Mode

