明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3923|回复: 7

一对读写剪贴板文字的程序

[复制链接]
发表于 2010-5-16 11:03 | 显示全部楼层 |阅读模式
  1. (defun c:setclipbtext ()
  2.   (command
  3.     ".vbastmt"        "Set textObj = New DataObject"
  4.     ".vbastmt"        (strcat "textObj.SetText "" (getstring "\n 输入文本:") """)
  5.     ".vbastmt"        "textObj.PutInClipboard"
  6.     ".vbastmt"                       "Set textobj = nothing"
  7.    )     ;command
  8.   (princ)
  9. )
  10. (defun c:GETclipbtext ()
  11.   (command
  12.     ".vbastmt"        "Set textObj = New DataObject"
  13.     ".vbastmt"        "textObj.GetfromClipboard"
  14.     ".vbastmt"                       "Set textobj = nothing"
  15.    )     ;command
  16.   (princ)
  17. )
补充:cad2010版本以上需要vba支持。其余的不知道适用情况,大家测试下
读写剪贴板的程序有很多方法,调用html的,vbscript的,直接用vb或vba的,上面的实际上是在lisp借助"vbastmt"命令调用vba。好像没怎么见人贴过。贴出来玩玩
发表于 2010-5-16 11:09 | 显示全部楼层

顶下,2010的Application.Eval不知支不支持VBA的语句了,没试过

狂刀可以试下

发表于 2010-5-16 11:18 | 显示全部楼层

可以试下使用Application.Eval调用VBA语句

另外,可以用冒号分隔多个语句把VBA代码写成一行,调用一次

发表于 2010-5-16 13:09 | 显示全部楼层
运行vbastmt 命令仍然有“VBA未安装”的提示
发表于 2010-5-16 14:03 | 显示全部楼层
  1. ;by nonsmall @ mjtd
  2. (setq htm (vlax-create-object "htmlfile"))
  3. (defun nonsmall_GetClipboard();获取剪切板
  4. (setq Clip_Bord (Vlax-Get-Property (Vlax-Get htm 'ParentWindow) 'ClipboardData))
  5. (Vlax-Invoke Clip_Bord 'GetData "text")
  6. )
  7. (defun nonsmall_SetClipboard(clip);设置剪切板
  8. (Vlax-Invoke Clip_Bord 'SetData "text" clip)
  9. )
发表于 2010-5-17 09:40 | 显示全部楼层
;清空剪贴板
(Vlax-Invoke Clip_Bord 'cleardata "text" clip)
发表于 2010-11-7 09:35 | 显示全部楼层
向各位学习!
发表于 2013-6-1 00:00 | 显示全部楼层
呵呵,狂刀和不死猫
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-17 11:46 , Processed in 0.237467 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表