Hello. I would like to make a web page call a (classic) Rexx script
when a link (or a button if necessary) is clicked. The script will
create and return a new web page to be displayed. (I don't want the
script to be part of the html.)
The pages and scripts would be on my machine, not on servers elsewhere.
I am using Windows XP and ooRexx 3.0. I think this should be easy,
but I can't find the documentation to do this.
Is this easy to do? I would welcome any suggestions, but as I am not
(yet) good with oo stuff, anything oo would need to be quite specific.
If it also works with IBM Object Rexx, that would be nice (I am
guessing it would). Thanks.
Alex Armstrong, Toronto.
|
|
0
|
|
|
|
Reply
|
ada2 (4)
|
7/16/2006 5:06:43 PM |
|
Alex wrote:
> Hello. I would like to make a web page call a (classic) Rexx script
> when a link (or a button if necessary) is clicked. The script will
> create and return a new web page to be displayed. (I don't want the
> script to be part of the html.)
>
> The pages and scripts would be on my machine, not on servers elsewhere.
> I am using Windows XP and ooRexx 3.0. I think this should be easy,
> but I can't find the documentation to do this.
>
> Is this easy to do? I would welcome any suggestions, but as I am not
> (yet) good with oo stuff, anything oo would need to be quite specific.
> If it also works with IBM Object Rexx, that would be nice (I am
> guessing it would). Thanks.
If your webserver supports the "#!" syntax then you can have your link
point to it and the first line of the script can be "#!c:\oorexx", or
whatever, and then the rest of your script.
|
|
0
|
|
|
|
Reply
|
Eric
|
7/16/2006 9:35:50 PM
|
|
Alex ha escrito:
> Hello. I would like to make a web page call a (classic) Rexx script
> when a link (or a button if necessary) is clicked. The script will
> create and return a new web page to be displayed. (I don't want the
> script to be part of the html.)
>
> The pages and scripts would be on my machine, not on servers elsewhere.
> I am using Windows XP and ooRexx 3.0. I think this should be easy,
> but I can't find the documentation to do this.
>
> Is this easy to do? I would welcome any suggestions, but as I am not
> (yet) good with oo stuff, anything oo would need to be quite specific.
> If it also works with IBM Object Rexx, that would be nice (I am
> guessing it would). Thanks.
Unfortunatly client-side scripting is very platform-specific (even
web browser specific) and also it depends on an object oriented
approach. With Object REXX you can do with Internet Explorer the same
things that you can do with JavaScript, but only with Internet Explorer
and using objects and DOM. There are other approachs, but all of them
very ugly.
Can you use server-side scripting locally? That is: a small web
server with CGI support (web/2: http://dink.org/web2/) or REXX macros
support (the unreleased version of GoServe for Windows:
http://www.cary.demon.co.uk/memowiki/MemoWiki.html) in a special port
(8080, for example).
Best regards:
Salvador Parra Camacho
|
|
0
|
|
|
|
Reply
|
Salvador
|
7/16/2006 9:57:14 PM
|
|
Salvador Parra Camacho wrote:
> Alex ha escrito:
> ...
> Unfortunatly client-side scripting is very platform-specific (even
> web browser specific) and also it depends on an object oriented
> approach. With Object REXX you can do with Internet Explorer the same
> things that you can do with JavaScript, but only with Internet Explorer
> and using objects and DOM. There are other approachs, but all of them
> very ugly.
>
> Can you use server-side scripting locally? ...
I was hoping to avoid the complexity of using a web server, local or
not. The June 22 post by Rainer titled "get result of oorexx script
into frame" at
http://groups.google.com/group/comp.lang.rexx/msg/cc8fbd653c658b69
looks more like what I have in mind.
The script in my html need only call a Rexx program (on my machine)
with an argument to say which button or link was clicked, and then use
document~writeln(<new page html returned>) to display the new page in
Internet Explorer. (I can handle that much oo code. :-) Thanks.
|
|
0
|
|
|
|
Reply
|
Alex
|
7/17/2006 4:14:42 AM
|
|
Alex wrote:
> I was hoping to avoid the complexity of using a web server, local or
> not. The June 22 post by Rainer titled "get result of oorexx script
> into frame" at
> http://groups.google.com/group/comp.lang.rexx/msg/cc8fbd653c658b69
> looks more like what I have in mind.
>
> The script in my html need only call a Rexx program (on my machine)
> with an argument to say which button or link was clicked, and then use
> document~writeln(<new page html returned>) to display the new page in
> Internet Explorer. (I can handle that much oo code. :-) Thanks.
>
OH. Well, that code is handled by the server, not the client, unless
there's something I'm unaware of. I'm pretty sure that Rainer wasn't
aware of this.
For client side you could try Java or Javascript since they're handled
by browsers fairly consistently.
|
|
0
|
|
|
|
Reply
|
Eric
|
7/17/2006 4:35:57 PM
|
|
Alex wrote:
> Hello. I would like to make a web page call a (classic) Rexx script
> when a link (or a button if necessary) is clicked. The script will
> create and return a new web page to be displayed. (I don't want the
> script to be part of the html.)
>
> The pages and scripts would be on my machine, not on servers elsewhere.
> I am using Windows XP and ooRexx 3.0. I think this should be easy,
> but I can't find the documentation to do this.
>
> Is this easy to do? I would welcome any suggestions, but as I am not
> (yet) good with oo stuff, anything oo would need to be quite specific.
> If it also works with IBM Object Rexx, that would be nice (I am
> guessing it would). Thanks.
Given your infrastructure (XP, ooRexx) you could use the MS Internet Explorer. ooRexx is an
"ActiveX" scripting language and can be employed wherever VBScript, JScript etc. are used.
The way to declare script code in MSIE is by the means of a
<script language="Object Rexx"> ...yourCode... </script>
element. If you do not want to keep your script code within the HTML, then you could use the "src"
attribute in the script opening tag to denote URL of your script, e.g.
<script language="Object Rexx" src="myRexxScript.rex"></script>
the URL can be fully qualified (the above one will be relative to the document's base URL).
If wishing to invoke a Rexx routine at the click of a button, you need to make sure that the
external Rexx script was read in by MSIE already such that its public routines are
available/visible. Then you define the code that should get executed w.r.t. the events a user
causes, like the "onClick"-event at the press of a button.
At the end you see a snippet for an external Rexx script and a HTML text that uses that external
script.
You can create any HTML text at runtime and replace existing one with that (cf. method "innerhtml").
Hope that helps,
---rony
P.S.: Save each of the two snippets in their own files, then load "aha.html" into MSIE.
------------------------- cut here ---- "aha.rex" --------------------------
/* "aha.rex" - this script, if invoked via MS IE will use a popup-window */
call do_a_popup "-- main --" /* this will run after the directives have been carried out */
/* A *PUBLIC* routine will remain visible and can be invoked at any time later in a HTML text. */
::routine do_a_popup public
parse arg text
window~alert( "This is from 'aha.rex':" text date("S") time() )
------------------------- cut here ---- "aha.rex" --------------------------
------------------------- cut here ---- "aha.html" --------------------------
<html>
<head>
<title>Demonstrate using ooRexx from MSIE</title>
<script language="Object Rexx" src="aha.rex"></script>
<script lnaguage="Object Rexx">
call alert "This is an alternative way to invoke the alert-popup-window." date("S") time()
</script>
</head>
<body>
This is the body of our text.
<p>
If you press the button, you will get a popup window:
<input type="button" value="Press me!" language="Object Rexx" onclick="call do_a_popup '-- from the
Button --'">
</body>
</html>
------------------------- cut here ---- "aha.html" --------------------------
|
|
0
|
|
|
|
Reply
|
rony
|
7/17/2006 5:56:28 PM
|
|
Alex ha escrito:
> > Can you use server-side scripting locally? ...
>
> I was hoping to avoid the complexity of using a web server, local or
> not.
Some web servers can be configured quickly and CGI programming is
easy. web/2 is a good example:
1. Download it from http://dink.org/files/web2win32beta3.zip.
2. Extract the ZIP contents into a directory.
3. Execute "setup.exe" and change the default web port from 80 to
8080.
4. Edit the "cgi.cfg" file adding the DOS path to your interpreter:
"C:\ARCHIV~1\ApDev\langs\orexx\ooRexx\rexx.exe .rex"
5. Put your HTML files in ".\html".
6. Put your REXX CGIs in ".\cgi-bin".
7. Create the following "start.cmd" file in web/2 directory:
@echo off
start "Web server" /min web.exe
start http://localhost:8080
Now you have a web server ready for REXX CGI programming. Your
application now works with every web browser (in fact, "start.cmd"
starts the default browser, not MSIE): Internet Explorer, Firefox,
SeaMonkey, Netscape, Opera, Links...
Pros: web browser and platform independent, can be used for remote
applications, easy programming.
Cons: this method needs a web server.
As sample HTML file:
<!-- form_server.html -->
<html>
<head>
<title>Server-side REXX web application</title>
</head>
<body>
<h1>Server-side REXX web application</h1>
<form name="form_server" id="form_server"
method="post" action="cgi-bin/form_server.rex"
onsubmit="" onreset="">
<p>Text field: <input type="text" name="text" /></p>
<p>Password: <input type="password" name="password" /></p>
<p>Selection:
<select name="selection">
<option> REXX </option>
<option> Object REXX </option>
<option> NetREXX </option>
</select>
</p>
<p>Textarea: <textarea name="area" rows="5"
cols="20"></textarea></p>
<input type="submit" value="Send" />
<input type="reset" value="Clear" />
</form>
</body>
</html>
As sample REXX file:
/* form_server.rex */
say 'Content-type: text/html'
say
method = value('REQUEST_METHOD', , 'ENVIRONMENT')
length = value('CONTENT_LENGTH', , 'ENVIRONMENT')
if method = 'GET' then do
query_string = value('QUERY_STRING', , 'ENVIRONMENT')
end
if method = 'POST' & length <> '' then do
post_string = charin(, , length)
query_string = post_string
end
say '<html>'
say '<head>'
say '<title>Server-side REXX web application output</title>'
say '</head>'
say '<body>'
say '<h1>Server-side REXX web application output</h1>'
if query_string = '' then
say '<em>No input data</em>'
do while query_string <> ''
parse var query_string data '&' query_string
say '<p>' || data || '</p>'
end
say '</body>'
say '</html>'
exit
> The June 22 post by Rainer titled "get result of oorexx script
> into frame" at
> http://groups.google.com/group/comp.lang.rexx/msg/cc8fbd653c658b69
> looks more like what I have in mind.
>
> The script in my html need only call a Rexx program (on my machine)
> with an argument to say which button or link was clicked, and then use
> document~writeln(<new page html returned>) to display the new page in
> Internet Explorer. (I can handle that much oo code. :-) Thanks.
The client-side approach using Internet Explorer as WSH (Windows
Scripting Host) and Object REXX as WSE (Windows Scripting Engine)
doesn't depend on a web server, but is harder to program (IMHO). See
the Rony example.
As additional advantage, you can convert your web application in a
HTA application and then you can tokenize your code to protect it
(unlike JavaScript).
As sample HTML file:
<!-- form_client.html -->
<html>
<head>
<title>Client-side REXX web application</title>
<script language="Object REXX" src="form_client.rex"></script>
</head>
<body>
<h1>Client-side REXX web application</h1>
<form name="form_client" id="form_client"
method="" action=""
onsubmit="return handle_form(this);" onreset="">
<p>Text field: <input type="text" name="text" /></p>
<p>Password: <input type="password" name="password" /></p>
<p>Selection:
<select name="selection">
<option> REXX </option>
<option> Object REXX </option>
<option> NetREXX </option>
</select>
</p>
<p>Textarea: <textarea name="area" rows="5"
cols="20"></textarea></p>
<input type="submit" value="Send" />
<input type="reset" value="Clear" />
</form>
</body>
</html>
As sample REXX file:
/* form_client.rex */
::routine handle_form public
use arg form
document~writeln('<html>')
document~writeln('<head>')
document~writeln('<title>Client-side REXX web application
output</title>')
document~writeln('</head>')
document~writeln('<body>')
document~writeln('<h1>Client-side REXX web application
output</h1>')
document~writeln('<p>' form '</p>')
/* Unfortunatly I can't extract the values of the form with the
usual
JavaScript methods of the Form object. The output truncates
here
if I try call some of this methods... and there aren't any
"JavaScript"
warning. -Open Object REXX 3.1 beta 1-
Suggestions?
*/
document~writeln('</body>')
document~writeln('</html>')
return .false -- prevents the submision of the form
You can convert this web application in a HTA application easily
changing the name of "form_client.html" to "form_client.hta". And
adding the special tag "hta:application" you can also set some
properties of this application. Following, an example:
<hta:application
id="MyCoolApplication"
applicationname="My Cool Application"
singleinstance="yes"
border="dialog"
contextmenu="no"
icon="form_client.ico"
innerborder="no"
maximizebutton="no"
scroll="no"
selection="no"
version="1.0"
/>
Best regards:
Salvador Parra Camacho
|
|
0
|
|
|
|
Reply
|
Salvador
|
7/17/2006 8:22:38 PM
|
|
Thank you very much to both Rony and Salvador for great suggestions.
I tried the solution suggested by Rony first, and it works well except
when my script (aha.rex in the example) tries to do file I/O, I get a
msg: "File I/O operation not allowed in sandbox model!" It is running
afoul of the SP 2 security settings, and I can't find which one to
allow it. I have tried every one I can find in the Internet Options,
Security tab.
If there are no suggestions about that here, I will look in an MSIE
group, Thanks, Alex Armstrong.
|
|
0
|
|
|
|
Reply
|
Alex
|
7/20/2006 3:55:55 PM
|
|
Alex wrote:
> Thank you very much to both Rony and Salvador for great suggestions.
>
> I tried the solution suggested by Rony first, and it works well except
> when my script (aha.rex in the example) tries to do file I/O, I get a
> msg: "File I/O operation not allowed in sandbox model!" It is running
> afoul of the SP 2 security settings, and I can't find which one to
> allow it. I have tried every one I can find in the Internet Options,
> Security tab.
>
> If there are no suggestions about that here, I will look in an MSIE
> group, Thanks, Alex Armstrong.
>
Hmm, sometimes the following helps: rename the extensions of your HTML-file which contains your code
from ".html" to ".hta".
".hta" files are executed by "mshta.exe" and their contents have unrestricted access to the machine
(ie. the credentials of the logged-on user). ("HTA" is the acronym for 'HTML application'.)
HTH,
---rony
|
|
0
|
|
|
|
Reply
|
rony
|
7/20/2006 4:20:32 PM
|
|
rony wrote:
> Hmm, sometimes the following helps: rename the extensions of your HTML-file which contains your code
> from ".html" to ".hta".
>
> ...
Absolute magic! Workes perfectly. Thanks very much.
Alex.
|
|
0
|
|
|
|
Reply
|
Alex
|
7/21/2006 2:34:51 AM
|
|
|
9 Replies
286 Views
(page loaded in 0.151 seconds)
|