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.
(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.
:D