Steven P Posted 16 hours ago Posted 16 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
JerryFiedler Posted 4 hours ago Posted 4 hours ago @Steven P Your function seems to work for me although I am not sure what you expect. I am using Windows 11 and BricsCAD Pro V25. When I run my test program which calls your routine: NotePad++ is opened with the test data file, the specified text is highlighted and the text is in the "find" dialog box. ( I had to click the binocular icon as the find dialog did not open on its own.) Are you expecting the "find" dialog box to open automatically? testdata.txt testNF.lsp Quote
mhupp Posted 2 hours ago Posted 2 hours ago in windows 11 they have two notepads now. think you will have to remove the app one to go back to the classic one. https://www.dedoimedo.com/computers/windows-11-notepad-classic.html Quote
BIGAL Posted 2 hours ago Posted 2 hours ago (edited) Maybe have a look at the windows command findstr it will search a directory for a key word, I guess could open one at a time. findstr d2 d:/mylisps/*.lsp may be useful how I find old posts Edited 2 hours ago by BIGAL 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.