如何將 變數內容 打在文章中?

HyperEditor Q&A/技術交流
主題已鎖定
shinho
一般會員
文章: 14
註冊時間: 1日 1月 1970年, 08:33

如何將 變數內容 打在文章中?

文章 shinho »

:shock: 文章中有 :
民國 #95 年
(想將 95 換成西元,我用漢書XP 寫 macro 如下)
[/#/][right][mark block][right][mark block]
[%yr = %MarkText][atod %yr][%wyr = %Result+1911]
[cursor data]"西元 %wyr 年"

(乖乖 文章 中變數 %wyr 無法展開 成 2006 !) :roll:
mason
Site Admin
文章: 373
註冊時間: 29日 4月 2003年, 09:57

文章 mason »

我用您的 macro,可以執行啊!
的確是變成「西元2006年」
只是你要先將原先的內容清除,
不然新文字會插入到舊文字中。
shinho
一般會員
文章: 14
註冊時間: 1日 1月 1970年, 08:33

可能是小Bug!

文章 shinho »

如果將下列命令 存檔於 ...He8\macro\macro1.pro 之中
理論上 按下工具列 [1] 號按鈕, 應可在本文視窗中
顯示 "西元 2007 年".
實際上 只會顯示 "西元 %yr 年"
------
[cursor data][%yr="2007"]
"西元 %yr 年"
mason
Site Admin
文章: 373
註冊時間: 29日 4月 2003年, 09:57

文章 mason »

您要在 macro 中使用的話,不能用「區域變數」。
必須用全域變數。
所以你試試:
[cursor data][%@yr="2007"]
"西元 %@yr 年"

要寫得比較靈活的話,建議還是寫在 my.pro 中。
自己用 :
def 按鍵=[cursor data][%yr="2007"]"西元 %yr 年"

再去按那個按鍵,這樣比較可以做得複雜些。
主題已鎖定