Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

request-dir

 [1/5] from: atruter::hih::com::au at: 3-Sep-2002 9:24


While request-file uses the native file selector (at least on Windows that is), this doesn't let you select a directory. Anyone written a simple request-dir function yet? Regards, Ashley *****************Privacy, Confidentiality & Liability Notice ************ This email is intended for the named recipient only. The information contained in this message may be confidential, or commercially sensitive. If you are not the intended recipient you must not reproduce or distribute any part of this email, disclose its contents to any other party, or take any action in reliance on it. If you have received this email in error, please contact the sender immediately. Please delete this message from your computer. You must scan this email and any attached files for viruses. The company accepts no liability for any loss, damage or consequence, whether caused by our own negligence or not, resulting directly or indirectly from the use of any attached files. Any views expressed in this Communication are those of the individual sender, except where the sender specifically states them to be the views of the Company. **************************************************************************

 [2/5] from: atruter:hih:au at: 3-Sep-2002 12:27


Reply to self, The following code (on windows) seems to do the trick: <code> request-dir: function [path] [where lst] [ view center-face layout [ where: info 300 form path lst: text-list 300x200 data insert remove-each file read path [not dir? path/:file] %../ [ either path <> %/ [ path: dirize clean-path join path lst/picked/1 ][ either not none? attempt [open dirize lst/picked/1] [ path: dirize lst/picked/1 ][ alert "Device not ready." ] ] lst/lines: remove-each file read path [not dir? path/:file] if path <> %/ [insert lst/lines %../] ; Refresh list clear lst/picked lst/sld/data: 0 lst/sn: 0 lst/sld/redrag lst/lc / max 1 length? head lst/lines show lst ; Refresh text where/text: path show where ] btn "Select" [unview] ] path ] new-dir: request-dir %/c/rebol/ </code> Note the use of "port" to determine whether removable media (typically %/a/ on windows) is actually present. Is this a good technique? (I don't know whether using port without a matching close is *a bad thing* or not). Regards, Ashley

 [3/5] from: atruter:hih:au at: 3-Sep-2002 17:00


> I'm guessing remove-each is a function from the beta REBOLs?
Er, yes. Native too so I can't paste the source. ;) Regards, Ashley

 [4/5] from: carl:cybercraft at: 3-Sep-2002 18:49


Hi Ashley, I get the following error with the function... ** Script Error: remove-each has no value ** Where: do-facets ** Near: insert remove-each file read path I'm guessing remove-each is a function from the beta REBOLs? Carl. On 03-Sep-02, [atruter--hih--com--au] wrote:
> Reply to self, > The following code (on windows) seems to do the trick:
<<quoted lines omitted: 39>>
> Regards, > Ashley
-- Carl Read

 [5/5] from: anton:lexicon at: 3-Sep-2002 19:36


You mean: attempt [open ...] ? Well, it seems fine to me. If open fails then it hasn't opened a port, so you don't need to close one. If open fails it should know how to clean up after itself internally. Anton.

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted