乐筑天下

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

[编程交流] 互联网新闻阅读器

[复制链接]

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 11:36:01 | 显示全部楼层
  1. (defun c:RSS (/ url Data RSS Items link)
  2. [color=Red];; © Lee Mac  ~  07.06.10 (modified by Alan J. Thompson)[/color]
  3. (setq url "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml")
  4. (if (setq Data (VK_ReadXML url))
  5.    (progn
  6.      (setq RSS (caddr (car (caddr (caddr Data)))))
  7.      (setq Items (RemoveTilFoo (lambda (x) (eq "item" (strcase (car x) t))) RSS))
  8.      (if (and (setq Items (mapcar 'caddr Items))
  9.               (setq Items (SubList Items 0 10))
  10.               (setq Items
  11.                      (mapcar
  12.                        (function
  13.                          (lambda (x)
  14.                            (list (caddr (car x)) (caddr (caddr x)))
  15.                          )
  16.                        )
  17.                        Items
  18.                      )
  19.               )
  20.               (setq link (dos_popupmenu (mapcar 'car Items)))
  21.          )
  22.        (command "_.browser" (cadr (nth link Items)))
  23.      )
  24.    )
  25. )
  26. (princ)
  27. )
  28. (defun RemoveTilFoo (foo lst)
  29. ;; © Lee Mac  ~  07.06.10
  30. (while (and lst (not (foo (car lst))))
  31.    (setq lst (cdr lst))
  32. )
  33. lst
  34. )
  35. (defun SubList (lst start len)
  36. ;; © Lee Mac  ~  07.06.10
  37. (if lst
  38.    (if (< 0 start)
  39.      (SubList (cdr lst) (1- start) len)
  40.      (if (< 0 len)
  41.        (cons (car lst)
  42.              (SubList (cdr lst) start (1- len))
  43.        )
  44.      )
  45.    )
  46. )
  47. )
  48. ;; .....................................................................;;
  49. ;;                   -- VovKa's XML Functions --                        ;;
  50. ;; .....................................................................;;
  51. (defun vk_XMLGetAttributes (Node / Attributes Attribute OutList)
  52. (if (setq Attributes (vlax-get Node "attributes"))
  53.    (progn (while (setq Attribute (vlax-invoke Attributes "nextNode"))
  54.             (setq OutList (cons (cons (vlax-get Attribute "nodeName")
  55.                                       (vlax-get Attribute "nodeValue")
  56.                                 )
  57.                                 OutList
  58.                           )
  59.             )
  60.             (vlax-release-object Attribute)
  61.           )
  62.           (vlax-release-object Attributes)
  63.           (reverse OutList)
  64.    )
  65. )
  66. )
  67. ;;;(vk_XMLGetAttributes Node)
  68. (defun vk_XMLGetchildNodes (Node /)
  69. (if Node
  70.    (if (= (vlax-get Node "nodeType") 3)
  71.      (vlax-get Node "nodeValue")
  72.      (append (list
  73.                (list (vlax-get Node "nodeName")
  74.                      (vk_XMLGetAttributes Node)
  75.                      (vk_XMLGetchildNodes (vlax-get Node "firstChild"))
  76.                )
  77.              )
  78.              (vk_XMLGetchildNodes (vlax-get Node "nextSibling"))
  79.      )
  80.    )
  81. )
  82. )
  83. ;;;(vk_XMLGetchildNodes Node)
  84. (defun vk_ReadXML (FileName / Doc OutList *error*)
  85. (if (and FileName
  86. ;;;       (setq FileName (findfile FileName))
  87.           (setq Doc (vlax-create-object "MSXML.DOMDocument"))
  88.           (not (vlax-put Doc "async" 0))
  89.           (if (= (vlax-invoke Doc "load" FileName) -1)
  90.             t
  91.             (prompt
  92.               (strcat "\nError: "
  93.                       (vlax-get (vlax-get Doc "parseError") "reason")
  94.               )
  95.             )
  96.           )
  97.           (= (vlax-get Doc "readyState") 4)
  98.      )
  99.    (setq OutList (vk_XMLGetchildNodes (vlax-get Doc "firstChild")))
  100. )
  101. (and Doc (vlax-release-object Doc))
  102. (gc)
  103. OutList
  104. )
  105. ;;;(vk_ReadXML (getfiled "" "" "xml" 16))

 
很好的触摸李;很少有事情像计划周密的Lisp程序那么优雅
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:38:35 | 显示全部楼层
谢谢Ollie
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 11:43:44 | 显示全部楼层
...
 
LoL:LoL:
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:47:00 | 显示全部楼层
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 11:49:23 | 显示全部楼层
I'm sure there is and if I had a use for something like this, I might consider making an attempt. I only wanted to show an example of not using text (which is why I used the bulk of your code). I'll happily stick with the Google reader.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:52:25 | 显示全部楼层
I have no use for it either - but I get easily addicted to learning new things...
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 11:54:25 | 显示全部楼层
Ditto, but it's hard to justify coding for random stuff when at work.
回复

使用道具 举报

37

主题

125

帖子

87

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
190
发表于 2022-7-6 11:57:23 | 显示全部楼层
  1. ;Lee Mac 7.6.10 ;Space declaration statement (setq spc   (if     (or       (eq AcModelSpace         (vla-get-ActiveSpace           (setq doc             (vla-get-ActiveDocument               (vlax-get-acad-object)             )           )         )       )       (eq :vlax-true (vla-get-MSpace doc))     )     (vla-get-ModelSpace doc)     (vla-get-PaperSpace doc)   ) )
 
Nice touch Lee; few things are as elegant as well planned lisp
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:00:11 | 显示全部楼层
Thanks Ollie
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 12:04:38 | 显示全部楼层
...
 
LoL:lol:
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-6 11:23 , Processed in 0.460607 second(s), 70 queries .

© 2020-2025 乐筑天下

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