Digital Workshop

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: textObj.Write
PostPosted: August 22nd, 2011, 9:54 am 
Offline

Joined: June 9th, 2007, 10:53 am
Posts: 34
Location: UK
Opus: Opus Pro 8.0
OS: Windows XP Pro SP3
System: Acer Intel Core 2 Quad, 2.4GHz, 3 MB RAM
Hi all. Can anyone please help as am trying to create a .html page using textObj.Write. I can create the initial file with:
var textObj = OpenFile("c:\\Windows\temp\Temp.html") and write the first line with: textObj.Write("<Head>") BUT when I write the next line: textObj.Write("<meta http-equiv="content-type" content="text/html; charset=utf-8"/>) I get expression error and I presume this is due to the " (doublequotes). Is there a list of how to add special characters using textObj.Write? The special characters I will need to write are: " < > { } ) )) ;

Many thanks to any help as not getting very far with this.

Regards
Anthony

Copy of example .html file is below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>Google Maps JavaScript API Example: Simple Directions</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA"
type="text/javascript"></script>
<script type="text/javascript">
// Create a directions object and register a map and DIV to hold the
// resulting computed directions

var map;
var directionsPanel;
var directions;

function initialize() {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(42.351505,-71.094455), 15);
directionsPanel = document.getElementById("route");
directions = new GDirections(map, directionsPanel);
directions.load("from: 500 Memorial Drive, Cambridge, MA to: 4 Yawkey Way, Boston, MA 02215 (Fenway Park)");
}
</script>
</head>

<body onload="initialize()">
<div id="map_canvas" style="width: 70%; height: 480px; float:left; border: 1px solid black;"></div>
<div id="route" style="width: 25%; height:480px; float:right; border; 1px solid black;"></div>
<br/>
</body>
</html>


For this message ajhunt has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: textObj.Write
PostPosted: August 23rd, 2011, 12:30 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
You have no Profile & System Info -- it's a good idea to keep one up-to-date e.g., Opus version, Windows environ, etc.

Okay you wrote:
Quote:
I get expression error and I presume this is due to the " (doublequotes).
I am not a good writer of html, but I may be able to point you to a few things to check.

1. First, look at your write-to-file expression. You should have an even number of quote marks.
2. In Opusscript you can use a combination of single quotes and double quotes, e.g.
Code:
var myWriteString = '<meta http-equiv="content-type" content="text/html; charset=utf-8"/>' ;
Depending on what you need, you can mix these to serve your purpose. The example in this thread link below is not relevant to your html, but may give you a broader understanding. (it seems you are experienced scripting anyway, and may not need this).
viewtopic.php?f=4&t=3047&hilit=syntax see: "Wrong Eval syntax" / Mackavi solution
3. As for special characters, you may need to look into escape characters. But I doubt this is the issue here.

You did not show how you are advancing to next line in the file. As for writing to the file, certain OpusScript commands can automatically append to the file and I will assume that is what you are doing. If not, here are some links to additional posts/reading.
viewtopic.php?f=6&t=2608&hilit=writeline+false ( solution near bottom of Post )

viewtopic.php?f=6&t=3361&hilit=html+quotes (good html example?)
You could also do something like
Code:
var myHTML01 = '<meta http-equiv="content-type" content="text/html; charset=utf-8"/>' ;
textObj.write(myHTML01) ;


Cheers.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : ajhunt, mackavi


Top
 Profile  
 
 Post subject: Re: textObj.Write
PostPosted: August 23rd, 2011, 9:35 am 
Offline

Joined: June 9th, 2007, 10:53 am
Posts: 34
Location: UK
Opus: Opus Pro 8.0
OS: Windows XP Pro SP3
System: Acer Intel Core 2 Quad, 2.4GHz, 3 MB RAM
Hi GodLike, many many thanks for your time and help - I now have it working as I want it. It's so easy when you know something but so dam frustrating when you don't lol. Once again many many thanks GodLike.


For this message ajhunt has been thanked by : mackavi


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 53 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group