Hello Everyone
I've seen this done through lisp (e.g. custom input box) just have no idea how to go about what I intend to do.
Situation:
I have a folder (C:\folder1\scripts) that contains hundreds of .scr files which I browse through using script command and click open.
What I need is a lisp that invokes a popup with input box, browse and run button. Once browsed for the file, the exact path (e.g. C:\folder1\scripts\scr001.scr) remains in the input box till its browsed again but retains previous browsed files (think input box pull-down) and the run button will simply run the script that is in the input box and clear button should clear the dropdown lists. Hope I explained it well 🙂
I'd rather not deal with dcl or .net and do this strictly on lsp.
Thanks in advance
Quick routine to get what you are looking for without DCL:
; runscr function shows file selection window to select script to run
(princ"\nLoading...")(princ)
(defun c:runscr ()
(if (null file_nam) (setq file_nam ""))
(setq file_nam (getfiled "Select a Scripte File to Run" file_nam "scr" 2))
(if file_nam ; Got filename?
(command"_.Script" file_nam)
)
)
(princ"\nRunScr command ready.")(princ)
Thanks for the reply pli.....
That worked well!!!! However, I need it to point to my scr directory everytime it launch rather than "My Documents".
*It does retain my scr directory if I choose to run something from that directory but if I press cancel it goes back to "My Documents".
and also needs to retain the prvious run in the box.
Then include in the lisp function the path and the first script file name ie: C:\folder1\scripts\scr001
This way, the lisp function will always show your script folder and if the selection window is cancelled, it'll set it back to the first script file as the default selection.
; runscr function shows file selection window to select script to run
(princ"\nLoading...")(princ)
(defun c:runscr (/ set_file)
(defun set_file ()
(if (null file_nam) (setq file_nam "C:\\folder1\\scripts\\scr001s"))
)
(set_file)
(setq file_nam (getfiled "Select a Scripte File to Run" file_nam "scr" 2))
(if file_nam ; Got filename?
(command"_.Script" file_nam)
(set_file)
)
)
(princ"\nRunScr command ready.")(princ)
That's odd because the lisp routine should always come up with the default script file selected assuming it's named scr001.scr and located in folder: C:\folder1\scripts
Also the lisp routine will save the last script file selected when ran again as long as you don't close out of the current drawing session.
If you change
"C:\\folder1\\scripts\\scr001s"))
to
"C:\\folder1\\scripts\\"))
If no file was selected yet, the "c\\...\\" will be the start directory, if a .scr file was already selected in this drawing session, it will be shown as default.
Henrique
Of course...I thought that the lisp routine would be an improvement compared to the standard SCRIPT command to have a default script file already selected instead of just showing the folder with no script file selected.