/* open.cmd - by L. Van Bogaert 2002 */ /* */ /* Open a WPS object (folder) from the command line */ /* */ /* Parameters : -I : open icon view */ /* -T : open tree view */ /* -D : open details view */ /* path : path to folder to be opened or */ /* name of subdirectory to open */ /* */ /* Usage : open [-I(con)|T(ree)|D(etails)] [path|subdir] */ call RxFuncAdd 'SysSetObjectData', 'RexxUtil', 'SysSetObjectData' /* set the default view mode */ view = "OPEN=DEFAULT" /* set the default directory to open (= current dir) */ folder = directory() /* parse the command line parameters */ parse arg arg1 arg2 /* check the first parameter */ select when translate(arg1) = "-I" | translate(arg1) = "-ICON" then view = "OPEN=ICON" when translate(arg1) = "-T" | translate(arg1) = "-TREE" then view = "OPEN=TREE" when translate(arg1) = "-D" | translate(arg1) = "-DETAILS" then view = "OPEN=DETAILS" when translate(arg1) = "-S" | translate(arg1) = "-P" |, translate(arg1) = "-SETTINGS" |, translate(arg1) = "-PROPERTIES" then view = "OPEN=SETTINGS" otherwise curDir = directory() call directory arg1 if translate(arg1) = translate(directory()) |, translate(arg1) = translate(substr(directory(),lastpos('\',directory())+1,)) then do /* first argument seems to be a directory path, so let's use it */ /* and go back to the directory the call was made from afterwards */ folder = directory() call directory curDir end end /* check the second parameter */ select when translate(arg2) = "-I" then view = "OPEN=ICON" when translate(arg2) = "-T" then view = "OPEN=TREE" when translate(arg2) = "-D" then view = "OPEN=DETAILS" when translate(arg2) = "-S" | translate(arg2) = "-P"then view = "OPEN=SETTINGS" otherwise curDir = directory() call directory arg2 if translate(arg2) = translate(directory(arg2)) |, translate(arg2) = translate(substr(directory(),lastpos('\',directory())+1,)) then do /* second argument seems to be a directory path, so let's use it */ /* and go back to the directory the call was made from afterwards */ folder = directory() call directory curDir end end /* openening the object twice places it on the foreground */ objectOpen = SysSetObjectData(folder, view) if objectOpen = 1 then objectOpen = objectOpen + SysSetObjectData(folder, view) exit