PDA

View Full Version : Saving a page


Fashion
10-04-2004, 11:06 AM
This is an exemple of what i need:

I want to save page2 by clicking a button in page 1.
Is this possible with AMS5 pro and how to acheive that?

Thanks,

Stephen

longedge
10-04-2004, 12:30 PM
It's way out of my league but it occurs to me having looked at the 'code viewer' in this THIS (http://www.indigorose.com/forums/showthread.php?t=5549&highlight=code+viewer) thread it ought to be possible. If the content of page 2 is e.g. a web object or a text file being loaded into a paragraph then it would be a lot easier.

rhosk
10-04-2004, 03:13 PM
Yeah, it really depends on "what" is on Page2.

Fashion
10-05-2004, 06:52 AM
In other words, user must be able to place some texts and cliparts in a "page" and then save it. It is a kind of simple publicity page maker with save capabilities.

I intend to use this saved page in another AMS app.

Is this possible? If not, is there any other way to do this?

Thanks,

Stephen

longedge
10-05-2004, 10:49 AM
You could certainly get text input on a page and save that out as a file and then retrieve or print it whenever you like. As far as I know, there is no native way to do the same with images.

Fashion
10-05-2004, 11:23 AM
Is it possible to take HTML text (image) and put this code in a web object using a text.File write from string function?

Thanks,

Stephen

longedge
10-05-2004, 11:34 AM
Yes you can build html by concatenating the tags with the input text.

Are you are providing e.g. a set of thumbnails of images on the cd. If so you could then hard code the reference into the on click event of the image and use it in building the html and then save the html and images out to a folder.

Fashion
10-05-2004, 11:40 AM
Thank a lot, i'm not a programmer and may be it will be easier for me to have an exemple. Can you explain your method in details?

Thanks,

Stephen

yosik
10-05-2004, 12:29 PM
Stephen,
One solution would be to use a command line aware utility to capture your window. Irfanview does it well.
What I would do is put Iview in your Docs dir, launch an event (Page/Button...) which will launch a command line from Ivew (Something like i_view32.exe /capture=1 , which captures the active window), then use the image (clipboard, save or print..).

Good luck
Yossi

Intrigued
10-05-2004, 01:47 PM
If you interested in what Yosik put forth... here is a DLL file that user Worm put together and shares now via the Examples forum...

http://www.indigorose.com/forums/showthread.php?t=8797

Fashion
10-05-2004, 08:20 PM
Yeah thanks, i tried that but i don't want to capture all window. I just need user be able to put an image and/or text in a web browser object and save it for further use; making his own page and save it.

I told about web browser object but it can be any other way to achieve this app. Any help will be appreciate.

Thanks,
Stephen

JimS
10-06-2004, 01:08 AM
Fashion,
What I would suggest doing is to build an example of the web page you are after. This will become your template.

Next, split the HTML document up into logical parts. (i.e. Head, Body, Foot) and save them as text files.

When it is time to build a dynamic webpage for your user, you just combine the HTML parts with your user data, to create the finished HTML page.

Here is an example of how it might go together:

In your program you get two variables from the user:

The/path/to/the/picture/file = pic_path

The user text = user_text

Now you need to read your text files in as variables.
head = TextFile.ReadToString("AutoPlay\\Docs\\head.txt");
body = TextFile.ReadToString("AutoPlay\\Docs\\body.txt");
foot = TextFile.ReadToString("AutoPlay\\Docs\\foot.txt");

head.txt might look something like this:
<html>

<head>
<meta **********="Content-Language" content="en-us">
<meta **********="Content-Type" content="text/html; charset=windows-1252">
<title>User Page</title>
</head>

<body>

<p align="center">
<img border="0" src="file:///




body.txt might look like this:

" ></p>
<p align="left">


foot.txt might look like this:

</p>

</body>

</html>


Next you’re going to write out the full HTML file
TextFile.WriteFromString("AutoPlay\\Docs\\user.html", head .. pic_path .. body .. user_txt .. foot, false);


Now you can navigate to the page, or save it, or whatever you want.

If you plan on moving the page between machines, or onto the Web, then you will need to make the path to the picture a ‘relative path’ instead.

TJ_Tigger
10-06-2004, 09:21 AM
I am currently using a couple of functions in a project I am playing with that dynamically creates html pages based from a data file. I have a function that creates and destroys the page and I fill in the body as necessary.


function CreatePage(strTitle)
local String1 = ""
String1 = String1 .. '<html>' ..
'<head>' ..
'<title>'.. strTitle ..'</title>' ..
'</head>' ..
'<body bgcolor="white" text="black">' ;
return String1;
end


function DestroyPage()
return '</body></html>'
end


To use these functions I do this in the project.


strHTML = CreatePage(strName);
strHTML = strHTML .. '<p><b>'..tblGS.Name..'</b> by '..tblGS.Placed ..'<br>'.."\r\n"..
'Size: ' .. tblGS.Container ..'<br>'.. "\r\n" ..
strName ..'<br>'.. "\r\n" ..
strNS .. " " .. strLat .. " "..strEW .. " " .. strLon ..'<br>'.. "\r\n" ..
tblGS.State ..'<br>'.. "\r\n" ..
'Difficulty: ' .. tblGS.Difficulty.. "\/"..'Terrain: ' .. tblGS.Terrain ..'<br>'.. "\r\n"..
'<br>'.. "\r\n"..
tblGS.Short ..'<br>'.. "\r\n"..
'<hr>'..'<br>'.. "\r\n"..
tblGS.Long ..'<br>'.. "\r\n"..
'<hr>'..'<br>'.. "\r\n" ..
'<a href="'..strName..'_hints.htm">Hints</a>'
strHTML = strHTML .. DestroyPage()

TextFile.WriteFromString(_TempFolder .. "\\"..strName..".htm", strHTML, false);


This creates a page per item that was read from a text file. Works great. I cannot claim the code as my own but found it here on the IR forum.

HTH
Tigg

Fashion
10-06-2004, 09:30 AM
Thanks JimS,

i'm not sure to understand all your suggestion but i think i will be able to try it out. The problem is i don't have enough HTML knowledge to achieve that but i have good books and helps.

Thanks a lot,

Stephen

Fashion
10-06-2004, 09:35 AM
Thanks Tigger too,

i will try this with some help here cause i'm not sure what to do with function.


Thanks again,


Stephen