乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 29|回复: 1

[编程交流] Problem with lisp routine - co

[复制链接]

49

主题

177

帖子

130

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
243
发表于 2022-7-5 22:22:55 | 显示全部楼层 |阅读模式
I have this routine which I found on this or an other forum.
 
 
  1. (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
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 23:26:48 | 显示全部楼层
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?
  1. (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?
  1. (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)
  1. (alert (get_cb)) ;
if none of this help, then you need to refer MSDN support or other VB expert
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-11 06:29 , Processed in 0.600325 second(s), 56 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表