MJLM Posted September 30, 2014 Share Posted September 30, 2014 (edited) I have this routine which I found on this or an other forum. (defun ctc ( text / htmlfile result ) (vl-load-com) ;; Caller's sole responsibility is to pass a ;; text string. Anything else? Pie in face. ;; Attribution: Reformatted version of ;; post by XShrimp at theswamp.org. ;; ;; See [url]http://tinyurl.com/2ngf4r[/url]. (setq result (vlax-invoke (vlax-get (vlax-get (setq htmlfile (vlax-create-object "htmlfile")) 'ParentWindow ) 'ClipBoardData ) 'SetData "Text" text ) ) (vlax-release-object htmlfile) text ) It basically copies a string into the clipboard. However I just updated to windows 8.1 64bit and it doesn't work. I tried it at work too and it doesn't work on windows 7 64 bit either. Any ideas why or how to resolve the issue? Any other routine that works for someone in windows 8.1 64 bit? Thank you Edited October 1, 2014 by MJLM Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted October 1, 2014 Share Posted October 1, 2014 (edited) sorry i'm not using Win8 x64, i just try to translate your XSrimp's code to vb script, then invoke the tmp.vbs see whether working? (defun c:test (/ scr f tmp) (setq f (open (setq tmp (strcat (getvar "TEMPPREFIX") "tmp.vbs")) "w")) (foreach $ '("Set htmlfile = CreateObject(\"htmlfile\") " "Text = htmlfile.ParentWindow.ClipboardData.GetData(\"text\")" "MsgBox Text" ) ;_ end of setq (write-line $ f) ) ;_ end of foreach (close f) (setq scr (vlax-create-object "wscript.shell")) (vlax-invoke scr 'run (strcat "cscript " tmp)) (vlax-release-object scr) (startapp "notepad" tmp) ) ;_ end of defun This another test whether clipboard text can be retrieve? (defun get_cb ( / scr txt) ; (setq scr (vlax-create-object "ScriptControl")) (vlax-put scr 'language "vbs") (vlax-invoke-method scr 'ExecuteStatement "Set htmlfile = CreateObject(\"htmlfile\") Text = htmlfile.ParentWindow.ClipboardData.GetData(\"text\")") (setq txt (vlax-invoke-method scr 'eval "Text")) (vlax-release-object scr) txt ) ;_ end of defun after evaluate the code try this, (initially make sure you get something "text" copied) (alert (get_cb)) ; if none of this help, then you need to refer MSDN support or other VB expert Edited October 1, 2014 by hanhphuc scr variable localized Quote Link to comment Share on other sites More sharing options...
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.