Jump to content

Passward


Dayananda

Recommended Posts

On 4/18/2020 at 12:22 PM, Dayananda said:

This need to run with Mac. OS also.

 

since you are coder, my $0.05 optimization.

when prompt password, it would be friendlier if user gets notified [Caps-Lock ON/OFF] 

1.Easy: Echo to the the screen entmake Text dynamic entmod. (advance may consider - Textbox , GrText or Textmask )

2.Advanced: create Attributed block update value

3.Expert: If MacOS supports Actable? emulate table as dialog box, column width=row height as Grid, customize merge cell as edit cell & buttoms. hittest

4.or slide vector image? 

 

as participant, i personal vote for Lee's because bonus [<--Backspace] compatibility & excludes includes loop for [Function] keys.👍 

though just minor spacer bug. (to replicate, just key-in all spaces then Backspace. notice the pipe "|" walks away)

 

p/s: Ron's dcl is more practical but excluded due to OP's query w/o DCL :) 

 

v1.1 revision
;backspace
;expr - quoted list expression for additional functionality use 'STR' as token

;example: you make a fake dialog box using attributed block, Tag name is "KEY", 
;you use your-att-func which can replace or vla-put-textstring the token 'STR'
;(foo "•" 20 '(your-att-func blk (list (cons "KEY" (strcat (substr STR 10) "|")))) )

;for normal usage just put nil for expression
;(foo (chr 149) 20 nil) 

(defun foo ($ n expr / l k str x)
  ;;hp:pword 16.04.2020
  (terpri)
  (princ (setq x t
               str "Password: "
               ! str
         )
  )

  (while (and x (setq k (grread nil)))
    
    (if (and (= (car k) 2)
             (numberp (setq x (cadr k)))
             (or (= 8 x) (<= 32 x 127)) ;; 
             (< (length l) n)
        )

      (progn
	
        (princ
          (strcat "\r"
                  (setq str
                    (if (= x 8)
                      (if (> (strlen str) (strlen !))
                        (substr str 1 (1- (strlen str)))
                        !
                      )
                      (strcat str $)
                    )
                  )
          )
        )

        (setq l (if (= x 8)
                  (if (> (length l) 0)
                    (cdr l)
                    l
                  )
                  (cons x l)
                )
        )
	
    (eval expr)
	
      )
      (setq x nil)
    )
  )
  (vl-list->string (reverse l))
)

 

;example: you make a fake dialog box using attributed block, Tag name is "KEY", 
;you use your-att-func which can replace or vla-put-textstring the token 'STR'

 

(foo "•" 20 '(your-att-func blk (list (cons "KEY" (strcat (substr STR 10) "|")))) )

 

 

 

 

 

 

 

 

Edited by hanhphuc
code updated backspace, expr & allow space
  • Thanks 1
Link to comment
Share on other sites

For any of you have to remember DOS you take your password test code and add it to the start of a lisp file saving into another directory then turn into fas or VLX this is super fast for 100's of files.


 

make a bat filecopy 
copy c:\mydirectory\lips\password.lsp+c:\mydirectory\lips\file1.lsp c:\mydirectory\lips\tobecomp\file1.lsp
copy c:\mydirectory\lips\password.lsp+c:\mydirectory\lips\file2.lsp c:\mydirectory\lips\tobecomp\file2.lsp
copy c:\mydirectory\lips\password.lsp+c:\mydirectory\lips\file3.lsp c:\mydirectory\lips\tobecomp\file3.lsp

 

Link to comment
Share on other sites

 

7 hours ago, BIGAL said:

For any of you have to remember DOS you take your password test code and add it to the start of a lisp file saving into another directory then turn into fas or VLX this is super fast for 100's of files.


make a bat filecopy 
copy c:\mydirectory\lips\password.lsp+c:\mydirectory\lips\file1.lsp c:\mydirectory\lips\tobecomp\file1.lsp
copy c:\mydirectory\lips\password.lsp+c:\mydirectory\lips\file2.lsp c:\mydirectory\lips\tobecomp\file2.lsp
copy c:\mydirectory\lips\password.lsp+c:\mydirectory\lips\file3.lsp c:\mydirectory\lips\tobecomp\file3.lsp

 

 

with VLISP

vl-file-copy & vl-directory-files but avoid large file

 

(foo "c:\\mydirectory\\lips\\password.lsp"  ;;header file 

"*.lsp" ;;pattern
"c:\\mydirectory\\lips\\" ;;source path
"c:\\mydirectory\\lips\\tobecomp\\" ) ;;destination path

 

(defun foo (Header Ext SPath DPath / new fname)
  ;;addheader - hp 21.04.2020 
  (and
    (findfile header)
    (foreach fname (vl-directory-files SPath ext)
      (if (<= (vl-file-size fname) 10000)
	(progn
	  (vl-file-copy
	    header
	    (setq new (strcat DPath
			      (if (= SPath DPath)
				"x"
				""
			      )
			      fname
		      )
	    )
	  )
	  (vl-file-copy
	    (strcat SPath fname)
	    new
	    T
	  )

	  (princ (strcat "\n" new))
	)
    )
  )
  )
  (princ)
)

 

example  

(progn
  (if
    (setq ext  "*.txt"
	  path (strcat (getenv "userprofile") "\\Downloads\\")
	  password (getfiled "Select password header file " path "txt" 16)
    )
     (foo password ext path path)
  )
)

 

 

 

@Dayananda sample attributed 

 

Bcad PassWin7.dwg 

 

Block name PASSWIN7 

Tag name KEY = password

Tag name USER = Header 

insert at viewctr 

try -> attributes library

token= 'STR'

 

 

Edited by hanhphuc
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...