[Closed] ActiveX and strings
hey
Im creating an activex object and writing HTML code for the <control_Type>, some of the variables in the code should be calculated through functions in the script, so this is what I wrote
activeXControl ax "MSHTML: <html><head><meta http-equiv='Content-Language' content= 'en-us'><meta name= 'GENERATOR' content= 'Microsoft FrontPage 5.0'><meta name='ProgId' content='FrontPage.Editor.Document'><meta http-equiv='Content-Type' content='text/html; charset=windows-1252'><title>New Page 1</title></head><body bgcolor= '#FFFFCC'><p><b><font color='#800000' face='Lucida Handwriting'>Name: " + planetName + " </font></b></p><p><b><font color=\"#800000\" face=\"Lucida Handwriting\">Distance Traveled: " + distTraveled + "</font></b></p><p><b><font color=\"#800000\" face=\"Lucida Handwriting\">Number Of Days Passed:</font></b></p><p><b><font color=\"#800000\" face=\"Lucida Handwriting\">Number Of Months Passed: " + monthsTraveled + "</font></b></p><p><b><font color=\"#800000\" face=\"Lucida Handwriting\">Number Of Years Passed: " + yearsTraveled +"</font></b></p></body></html>" width: 1000 height: 1000
and this is the error im having
[size=1]– Syntax error: at +, expected <rollout clause>
– In line: activeXControl ax “MSHTML: <html><head><meta http-equiv=‘Content-Language’ content= ‘en-us’><meta name= ‘GENERATOR’ content= ’
please tell me where im goin wrong, im guessing that “+” is not allowed in here?[/size]
If you’re going to specify the control_type string directly in the the activeXControl call (as opposed to assigning it to a string variable first and passing the variable), you’ll want to enclose it with ():
activeXControl ax ("MSHTML: <html><head><meta http-equiv='Content-Language' content= 'en-us'><meta name= 'GENERATOR' content= 'Microsoft FrontPage 5.0'><meta name='ProgId' content='FrontPage.Editor.Document'><meta http-equiv='Content-Type' content='text/html; charset=windows-1252'><title>New Page 1</title></head><body bgcolor= '#FFFFCC'><p><b><font color='#800000' face='Lucida Handwriting'>Name: " + planetName + " </font></b></p><p><b><font color=\"#800000\" face=\"Lucida Handwriting\">Distance Traveled: " + distTraveled + "</font></b></p><p><b><font color=\"#800000\" face=\"Lucida Handwriting\">Number Of Days Passed:</font></b></p><p><b><font color=\"#800000\" face=\"Lucida Handwriting\">Number Of Months Passed: " + monthsTraveled + "</font></b></p><p><b><font color=\"#800000\" face=\"Lucida Handwriting\">Number Of Years Passed: " + yearsTraveled +"</font></b></p></body></html>") width:1000 height: 1000
This is most likely the problem, but without the rest of the script it's a bit difficult to tell. :)
umm, i tried it your way and gave me an error for putting the ()
anyways here is my code:
fn displayPlanetInformation =
(
distTraveled = "54 Km"
daysTraveled = "blah blah"
monthsTraveled = "blah blah blah"
yearsTraveled = "4 years of blah"
Page = "MSHTML:<html><head><meta http-equiv=\"Content-Language\" content= \"en-us\"><meta name= \"GENERATOR\" content= \"Microsoft FrontPage 5.0\"><meta name=\"ProgId\" content=\"FrontPage.Editor.Document\"><meta http-equiv='Content-Type' content='text/html; charset=windows-1252'><title>New Page 1</title></head><body bgcolor= '#FFFFCC'><p><b><font color='#800000' face='Lucida Handwriting'>Name:"
Page += planetName
Page += "</font></b></p><p><b><font color=\"#800000\" face=\"Lucida Handwriting\">Distance Traveled:"
Page += distTraveled
Page += "</font></b></p><p><b><font color=\"#800000\" face=\"Lucida Handwriting\">Number Of Days Passed:"
Page += daysTraveled
Page += "</font></b></p><p><b><font color=\"#800000\" face=\"Lucida Handwriting\">Number Of Months Passed:"
Page += monthsTraveled
Page += "</font></b></p><p><b><font color=\"#800000\" face=\"Lucida Handwriting\">Number Of Years Passed:"
Page += yearsTraveled
Page += "</font></b></p></body></html>"
--"MSHTML:<HTML><BODY>This is a line of text</BODY></HTML>"
rollout information "Traveled Properties"
(
activeXControl ax Page width: 1000 height: 500 releaseOnClose: true
)
framePage = newRolloutFloater "Maha" 1000 1000 0 0
addRollout information framePage
)
the variables planetName and the others are actually returned by function calls and they r not the cause of the error, I tested them they only return strings. in here I assigned them to strings so that you can run the code if you want :shrug:
so I changed it a little bit, I saved my HTML code in a variable and called it and I still get errors, could u run it and tell me where im going wrong?
thanx for the reply
any solution? did I do anything wrong with the code or is it just acting weird? please tell me cause im running out of time and I’d like to switch to something else if it is not doable
Thanks
Hi,
you cannot use variable when defining an activeX control.
you should write the text (Page) to a file
ie:
f=openfile “C:\ est.html” mode:“w”
format “%
” Page to:f
close f
and then create the rollout with the activeX either with
rollout information “Traveled Properties”
(
activeXControl ax “file://C:\ est.html” width: 1000 height: 500 releaseOnClose: true
)
or
rollout information “Traveled Properties”
(
activeXControl ax “Shell.Explorer” width: 1000 height: 500 releaseOnClose:true
on information open do (ax.Navigate filename)
)
thank you SO MUCH ZBuffer, it worked and Im EXTREMELY HAPPY now
Thanks I REALLY appreciate your help :love: