0 Members and 1 Guest are viewing this topic.
Here ya go.Written quickly. This means there are errors I failed to find | fix. Please follow prudent backup / testing methodologies. No warranty for any particular use is stated or implied. Use at your own risk. Code: [Select](defun FindItemInFile ( PredicateFunction filename / handle item ) ;; © 2005 Michael Puckett (if (and (eq 'str (type filename)) (setq handle (open filename "r")) ) (vl-catch-all-apply '(lambda ( / stream ) (while (setq stream (read-line handle)) (cond ( (PredicateFunction stream) (close handle) (setq item stream) (exit) ) ) ) (close handle) ) ) ) item)(defun HiddenShellInPgpFile ( / filepath filebackup handle ) ;; © 2005 Michael Puckett (or (FindItemInFile (lambda (stream) (wcmatch (strcase (vl-string-trim " \t\n" stream)) "HIDDENSHELL`,`,4`,`*OS COMMAND:`," ) ) (setq filepath (findfile "acad.pgp")) ) (and filepath (setq filebackup (vl-filename-mktemp filepath)) (vl-file-copy filepath filebackup) (setq handle (open filepath "a")) (princ "\nHiddenShell,,4,*OS Command:,\n" handle) (null (close handle)) (setvar "re-init" 16) ) ))(defun HiddenShell ( statement / cmdecho ) ;; © 2005 Michael Puckett (cond ( (HiddenShellInPgpFile) (setq cmdecho (getvar "cmdecho")) (setvar "cmdecho" 0) (command "HiddenShell" statement) (setvar "cmdecho" cmdecho) t ) ))(defun GetIPAddress ( / tempfile ipAddressStream ipAddress ) ;; © 2005 Michael Puckett (if (and (HiddenShell (strcat "ipconfig.exe > " (setq tempfile (vl-filename-mktemp "ipconfig.txt") ) ) ) (setq ipAddressStream (FindItemInFile (lambda (stream) (wcmatch (strcase stream) "*IP ADDRESS*" ) ) tempfile ) ) ) (setq ipAddress (vl-string-trim " " (vl-list->string (cdr (member 58 (vl-string->list ipAddressStream) ) ) ) ) ) ) (if tempfile (vl-file-delete tempfile)) ;; clean up our mess ipAddress)Cheers.
(defun FindItemInFile ( PredicateFunction filename / handle item ) ;; © 2005 Michael Puckett (if (and (eq 'str (type filename)) (setq handle (open filename "r")) ) (vl-catch-all-apply '(lambda ( / stream ) (while (setq stream (read-line handle)) (cond ( (PredicateFunction stream) (close handle) (setq item stream) (exit) ) ) ) (close handle) ) ) ) item)(defun HiddenShellInPgpFile ( / filepath filebackup handle ) ;; © 2005 Michael Puckett (or (FindItemInFile (lambda (stream) (wcmatch (strcase (vl-string-trim " \t\n" stream)) "HIDDENSHELL`,`,4`,`*OS COMMAND:`," ) ) (setq filepath (findfile "acad.pgp")) ) (and filepath (setq filebackup (vl-filename-mktemp filepath)) (vl-file-copy filepath filebackup) (setq handle (open filepath "a")) (princ "\nHiddenShell,,4,*OS Command:,\n" handle) (null (close handle)) (setvar "re-init" 16) ) ))(defun HiddenShell ( statement / cmdecho ) ;; © 2005 Michael Puckett (cond ( (HiddenShellInPgpFile) (setq cmdecho (getvar "cmdecho")) (setvar "cmdecho" 0) (command "HiddenShell" statement) (setvar "cmdecho" cmdecho) t ) ))(defun GetIPAddress ( / tempfile ipAddressStream ipAddress ) ;; © 2005 Michael Puckett (if (and (HiddenShell (strcat "ipconfig.exe > " (setq tempfile (vl-filename-mktemp "ipconfig.txt") ) ) ) (setq ipAddressStream (FindItemInFile (lambda (stream) (wcmatch (strcase stream) "*IP ADDRESS*" ) ) tempfile ) ) ) (setq ipAddress (vl-string-trim " " (vl-list->string (cdr (member 58 (vl-string->list ipAddressStream) ) ) ) ) ) ) (if tempfile (vl-file-delete tempfile)) ;; clean up our mess ipAddress)
(defun GetIPAddress (/ tempfile ipAddressStream ipAddress) ;; © 2005 Michael Puckett (if (and (HiddenShell (strcat "ipconfig.exe > " (setq tempfile (vl-filename-mktemp "ipconfig.txt") ) ) ) (setq ipAddressStream (FindItemInFile (lambda (stream) (or (wcmatch (strcase stream) "*IP ADDRESS*" ) (wcmatch (strcase stream) "*IPV4 ADDRESS*" ) ) ) tempfile ) ) ) (setq ipAddress (vl-string-trim " " (vl-list->string (cdr (member 58 (vl-string->list ipAddressStream) ) ) ) ) ) ) (if tempfile (vl-file-delete tempfile) ) ipAddress)
<Why all the interest (in particular guest views, sometimes 4 or more at a time) in this thread today?/weird>
Quote from: MP on February 27, 2009, 04:21:32 PM<Why all the interest (in particular guest views, sometimes 4 or more at a time) in this thread today?/weird>I think it was referred to via a link in a message on WAUN...