/* $VER: AskDowload.term (20.1.95) ** ** Written by Olaf `Olsen' Barthel ** ** You can put this script into the `Binary dowload' text entry field ** of the transfer settings. When a download is invoked, you will be ** asked if you only want to receive files or if you want to both receive ** and send data. Depending on what you choose the Hydracom protocol ** will be invoked. ** ** NOTE: In order for this script to work it must be able to find ** the Hydracom program. Change the line that reads `hydra = "hydracom"' ** if necessary, e.g. into `hydra = "c:hydracom"' or where ever you ** put the program. */ hydra = "hydracom" OPTIONS results ARG parameters requestresponse options '"Receive|Receive & Send|Cancel"' prompt '"Do you wish to receive, or receive & send files?"' /*requestresponse options '"Nur empfangen|Auch versenden|Abbrechen"' prompt '"Dateien nur empfangen, oder auch versenden?"'*/ IF RC = 0 THEN DO IF result = 1 THEN DO cmd = "run " || hydra || " " || parameters || " get" END; ELSE DO requestfile title '"Select files to send"' multi stem names /* requestfile title '"Zu verschickende Dateien wählen"' multi stem names*/ IF RC = 0 THEN DO plus = " send" DO i = 0 TO names.count - 1 plus = plus || " " || FixName(names.i) END cmd = "run " || hydra || " " || parameters || plus END; ELSE DO EXIT END END ADDRESS command cmd END EXIT FixName: PROCEDURE PARSE ARG name blanks = 0 quotes = 0 chars = length(name) DO i = 1 TO chars c = substr(name,i,1) IF c = ' ' THEN blanks = blanks + 1; IF c = '"' THEN quotes = quotes + 1; END IF blanks > 0 THEN DO result = '"' END; ELSE DO result = '' END DO i = 1 TO chars c = substr(name,i,1) IF c = '"' THEN result = result || '*'; result = result || c END IF blanks > 0 THEN result = result || '"'; RETURN result