Hello,
Thank you for your suggestion/question, don't hesitate to ask for more scripts.
Someone with the skills would have to make it accept the format Win use. OS/2-eCS list the first line as the url, while the Win version place [Internetshortcut] there.
Here's the code for you, it'll create folder ( My Internet Links ) on your desktop where it place your internet urls converted to OS/2-eCS style.
Note: It doesn't work with Shortcuts though
Usage: Drag & drop folder with links on the rexx script and it'll create the URLs, I haven't added any progressbar, but you may do that if you want.
//Jan-Erik
/* Create URL objects in a folder named 'My Internet Links' on the desktop */
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
obj_id = '<MYURLS>'
rc = SysFileTree( ARG(1)'\*.url', 'file', 'SOF' )
If \rc then
If SysCreateObject( 'WPURLFolder', 'My Internet Links', '<WP_DESKTOP>', 'OBJECTID='obj_id';', 'U' ) then
do
call SysSetObjectData obj_id, 'OPEN=DEFAULT;'
do i = 1 to file.0
parse value FILESPEC( 'N', file.i ) with url_fname'.url'
input = linein( file.i )
do while pos( 'URL=', input ) = 0 & lines( file.i ) > 0 then
input = linein( file.i )
end
parse value input with 'URL='url
call CreateURL url, obj_id,, url_fname
end
end
call SysDropFuncs
Return rc
CreateURL: PROCEDURE
/* URL, save_in_folder¹, object_identification_name², <title> */
/* ¹) This can be specified as either an object ID ( for example, <WP_DESKTOP> ) */
/* or a file system path ( for example, C:\Desktop ) */
/* ²) This can be specified as <my_ul_object_id_1234>, with or without "<" and ">" */
/* Optional: Title */
url = ARG(1)
objid = ARG(3)
title = ARG(4)
IF LENGTH( objid ) = 0 THEN
objid = SysTempFileName( '???????.???' )
objid = '<'||translate( objid,, '<>' )||'>'
/* Remove characters from object name, */
/* and add them back, just to ensure that */
/* we can handle object id names not in the form '<...>' */
object = SysTempFileName( 'add!????' )
if length( title ) = 0 then
title = GetFileFromURL( url )
IF SysOs2Ver() > "2.30" THEN
rc = SysCreateObject( 'WPUrl', object, ARG(2), 'OBJECTID='||objid||';TITLE='||title||';URL='||url, 'U')
ELSE
rc = SysCreateObject('WebExplorer_Url', title, url, 'OBJECTID='||objid||';LOCATOR='||url||';', 'U')
RETURN rc
DecodeURL: PROCEDURE
PARSE ARG url
DO WHILE POS( '%', url ) > 0
i = POS( '%', url )
url = SUBSTR( url, 1, i-1 )||X2C(SUBSTR( url, i+1, 2 ))||SUBSTR( url, i+3 )
END
RETURN url
GetFileFromURL: PROCEDURE
/* URL syntax consists of six components: */
/* <scheme>://<net_loc_and_path>/<fname>;<params>?<query>#<fragment> */
PARSE VALUE FILESPEC( 'N', ARG(1) ) WITH url'#'.
PARSE VALUE retval WITH url'?'.
PARSE VALUE retval WITH url';'.
RETURN DecodeURL( url )