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

[REBOL] How to load func defs at start-up Re:(2)

From: brett:codeconscious at: 19-Sep-2000 12:58

I'll just add that I do very similar to this but I try to put all my additions in another script called ConfigureSession.r which resides in a data directory (for ease of backing up my volatile configuration). ConfigureSession.r then sets words and calls utility scripts. Doing this allows the same configuration for Core and View. Brett. ----- Original Message ----- From: [civicminded4--yahoo--com] To: [list--rebol--com] Sent: Tuesday, September 19, 2000 5:56 AM Subject: [REBOL] How to load func defs at start-up Re: Following inline is my %user.r, followed by my %utilities.r script. All of the functions listed in utilities are then available to me during the session. *****************start user.r**************************** REBOL [ Title: "User Preferences" Date: 28-Aug-2000 ] protect-system ;protect system words from redefinition with all of my utilities set-net-cases: [ 1 [[aparman--netzero--net] smtp.netzero.net pop.netzero.net none none none ] 2 [[civicminded4--yahoo--com] smtp.mail.yahoo.com pop.mail.yahoo.com none none none] ] print "Which net account do you want to use?" foreach [number case] set-net-cases [ print [number tab case] ] set-net account: select set-net-cases choice: to-integer ask "Enter your number choice here :>> " system/console/prompt: "REBOL:>> " system/console/result: "REBOL:== " ;--------utilities to do each time---------------- ; keep the utilities folder as a subfolder of where the executable is i.e. %./utilities ;----------------------------greeting------------------- print "***************************************************************" Print "Hello, Alan!" print ["It is" now/date "at" now/time "."] print ["You are currently in the" what-dir "directory." newline] print ["The following are your scripts loaded with utilities.r" newline] do %./utilities/utilities.r ; put utilities in utilities folder and call them in %utilities.r *****************end of user.r************************************************** *****************start utilities.r************************************************** REBOL[ title: "My Utilities" file: %utilities.r purpose: "Things I want available." date: "22-May-2000/10:43:36-4:00" ] ; scripts I want available ;--------make 'symlinks' to directory functions------------------------ list: :list-dir pwd: :what-dir cd: :change-dir md: :make-dir ;-----a few simple shortcuts------- cls: does [prin ["^(1B)[J"]] ; this clears the screen ;---------my utilities-------------- do %../utilities/ls.r do %../utilities/mail.r do %../utilities/convert-lines.r do %../utilities/makehead.r do %../utilities/s-swap.r ***********end user.r*************************** Hope this helps. [tim--johnsons-web--com] wrote: Hi: How may I load function definitions at startup? As an experiment, I added the following function def to both user.r and rebol.r: import: func[{"do" a file (IMPORT function def}f[string!]] [do make file! f] However, upon starting rebol, rebol does not recognize it. I note also, that set-user is not recognized. Just curious... TIA Tim