Steven P Posted 2 hours ago Posted 2 hours ago Good Morning, I have been using this to search for text in a text file, now I have been upgraded to windows 11 it doesn't work, and I can't work out what change to make. Looking for some guidance again, thanks! fnm: File name (including filepath) str: Text String delay: a delay, say 1000 mS Will open notepad and should perform a 'find' to jump to the text. It gets as far as 'find' to open the dialogue box but won't populate it or hit 'enter' to do the find, using sendkeys - which has always worked before. thanks for any help ;;To find text within a text file. ;;http://www.cadtutor.net/forum/showthread.php?102326-Open-text-file-and-jumping-to-a-line&p=694572#post694572 ; example command to call it (NotepadFind "C:\\Downloads\\test 123.txt" "findtext" 300) (defun NotepadFind (fnm str delay / obj) (vl-catch-all-apply (function (lambda () (setq obj (vlax-get-or-create-object "WScript.Shell")) (vlax-invoke obj 'Run (strcat "Notepad.exe \"" fnm "\"")) ;; or notepad++ if that is used. (setvar 'cmdecho 0) (command "_.delay" delay) ; Milliseconds. For BricsCAD users: (sleep delay) does not work. (setvar 'cmdecho 1) (vlax-invoke obj 'AppActivate "Notepad++") ; Title bar name of application. ++ for notepad++ but still works? (vlax-invoke obj 'SendKeys (strcat "^f" str "{ENTER}{ESC}")) ) ) ) (if obj (vlax-release-object obj)) ) Quote
Recommended Posts
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.