I have created two useful buttons to help me set up the secure and insecure ports correctly. See attached image
These are the items to add near the end of the Webserver Window using the Window Structure Editor:
BUTTON('Insecure Address'),AT(6,297),USE(?InsecureButton),TIP('Open the browser with' & |
' the insecure address and port')
BUTTON('Secure Address'),AT(82,297),USE(?SecureButton),TIP('Open the browser with ' & |
'the secure address and port')
In the Local data "Generated Declarations" embed point, add in:
! Secure and Insecure Address buttons
loc:Run cstring(255)
loc:parameters cstring (255)
loc:ret long
st StringTheory
For the "?InsecureButton" Accepted embed point add in:
! Open the insecure address
IF len(clip(set:Domains)) > 4 THEN ! Domains are listed
st.SetValue(CLIP(set:Domains) & '<13,10>') ! Get the domains, add a CR LF to the end
loc:Run = 'http://' & CLIP(st.Before('<13,10>')) & ':' & CLIP(set:InsecurePort) ! First listed domain
ELSIF LEN(CLIP(set:BindToIpAddress)) > 4 THEN ! IP Address filled in
loc:Run = 'http://' & CLIP(set:BindToIpAddress) & ':' & CLIP(set:InsecurePort)
ELSE ! IP Address missing
loc:Run = 'http://127.0.0.1:' & CLIP(set:InsecurePort)
END ! IP Address
loc:parameters = ''
loc:ret = OS_ShellExecute(0{prop:clienthandle}, 0, address(loc:Run), address(loc:Parameters), 0, 1) ! Open the URL
Similarly for the "?SecureButton"
! Open the secure address
IF set:SecurePort > 0 THEN ! Secure port set
IF len(clip(set:Domains)) > 4 THEN ! Domains are listed
st.SetValue(CLIP(set:Domains) & '<13,10>') ! Get the domains, add a CR LF to the end
loc:Run = 'https://' & CLIP(st.Before('<13,10>')) & ':' & CLIP(set:SecurePort) ! First listed domain
ELSIF LEN(CLIP(set:BindToIpAddress)) > 4 THEN ! IP Address filled in
loc:Run = 'https://' & CLIP(set:BindToIpAddress) & ':' & CLIP(set:SecurePort)
ELSE ! IP Address missing
loc:Run = 'https://127.0.0.1:' & CLIP(set:SecurePort)
END ! IP Address
loc:parameters = ''
loc:ret = OS_ShellExecute(0{prop:clienthandle}, 0, address(loc:Run), address(loc:Parameters), 0, 1) ! Open the URL
ELSE ! Secure port is zero
MESSAGE('Secure Port not set')
END ! Secure port
I'm not entirely sure I have got it right. Please could you guys have a look at my code and tell me how I can improve it further. I'm still very new at all of this.
Thanks in advance
Donn