/* @N This Genie will save any settings in the current PDraw environment to a config file. Professional Draw will then always start up with your specified settings. (Example: Magnification, WireFrame, Interlace, etc...) */ msg = PDSetup.rexx(2,0) units =getclip(pds_units) if msg ~= 1 then exit_msg(msg) cr = '0a'x call pdm_SetBatchMode(1) startprefs = "/*****Start Prefs*****/" endprefs = "/*****End Prefs*****/" startsave = "/*****StartSave*****/" endsave = "/*****EndSave*******/" startupfile = "s:pdraw.config" pdcolors = "s:pdcolors.dflt" startup = '' clist = 0 selection = "Units" selection = selection || cr"Grid Size" selection = selection || cr"Grid" selection = selection || cr"Ruler" selection = selection || cr"Grid Snap" selection = selection || cr"Ruler Type" selection = selection || cr"Dither Mode" selection = selection || cr"Fill Pattern" selection = selection || cr"Interlace" selection = selection || cr"Line Color" selection = selection || cr"Line Pattern" selection = selection || cr"Line Join" selection = selection || cr"Line Weight" selection = selection || cr"Color Mode" selection = selection || cr"Quick Move" selection = selection || cr"Wire Frame" selection = selection || cr"Workbench" counter = 1 if exists(startupfile) then do /* if exists then read file into line array and separate sections */ if ~open(file, startupfile, "r") then call exit_msg("DOS error. Unable to create a configuration file.") do while ~eof(file) text = strip(readln(file)) if text = '' then iterate if text = startprefs then do while ~eof(file) text = readln(file) if text = endprefs then leave end else if text = startsave then do while ~eof(file) text = readln(file) if text = endsave then leave end else startup = startup || cr || text end call close(file) end else do startup = "/*"cr"Professional Draw Configuration File"cr"*/"cr startup = startup"if ~show(l, 'rexxsupport.library') then"cr"if ~addlib('rexxsupport.library', 0, -30) then"cr"do"cr"call pdm_Inform(1,'You may need to install the rexxsupport.library in your libs: directory before running any Genies.',)"cr"end"cr startup = startup"if ~show(l, 'gdarexxsupport.library') then"cr"if ~addlib('gdarexxsupport.library', 0, -30) then"cr"do"cr"call pdm_Inform(1,'You may need to install the gdarexxsupport.library in your libs: directory before running any Genies.',)"cr"end" startup = startup || cr end if exists(startupfile) then do address command 'copy' startupfile startupfile".bak" address end selection = compress(pdm_SelectFromList("Select Settings to Save", 20, 12, 1, selection)) if selection = '' then exit_msg() call pdm_ShowStatus("Working") call pdm_SaveColorList(pdcolors) startup = startup || cr || startprefs || cr"call pdm_AutoUpdate(0)"cr startup = startup"call pdm_LoadColorList('"pdcolors"')"cr special = "LineWeight LineColor LineJoin" upos = pos('Units', selection) if upos ~= 0 then selection = delstr(selection, upos, 6) || '0a'x || "Units" do while selection ~= '' parse var selection command '0a'x selection command = strip(command) if command = '' then iterate interpret "setting = pdm_Get"command"()" if command = "FillPattern" then do parse var setting gradtype '0a'x color1 '0a'x color2 '0a'x steps '0a'x angle '0a'x centerx '0a'x centery setting = ","gradtype",'"color1"','"color2"',"steps","angle","centerx","centery end else if command = "LinePattern" then setting = "," || word(setting, 1) || ",'" || subword(setting, 2)"'" else if command = "Units" then setting = units else if pos(command, special) ~= 0 then setting = ",'"setting"'" else if words(setting) > 1 then setting = separate(setting, ',') else if ~datatype(setting,n) then setting = '"'setting'"' command = "call pdm_Set"command"("setting")" startup = startup || cr || command end startup = startup || cr"call pdm_AutoUpdate(1)"cr || endprefs if pdm_Inform(2, "Would you like to have the AutoSave Genie run upon startup?", "No", "Yes") then startup = startup || cr||startsave||cr"address command"cr"'rx' 'rexx:AutoSave.pdrx'"cr||endsave if ~open(file, startupfile, "w") then exit_msg("Unable to open config file") call writeln(file, startup) call close(file) call pdm_ShowStatus("Done") exit_msg() separate: procedure do parse arg string, separator string = replacestring(string, ' ', separator, 0) return(string) end exit_msg: expose units do parse arg message if message ~= '' then call pdm_Inform(1, message,) call pdm_SetUnits(units) call pdm_ClearStatus() call pdm_SetBatchMode(0) call pdm_AutoUpdate(1) exit end