2017-02-16 40 views
0

試圖設置AutoHotkey命令,但它不工作,我以前使用過這個腳本,但它不適用於AutoHotKey的1.1.24.05版本。基本的AutoHotkey不評估變量

local = http://lcl. 
dev = http://dev. 
stage = http://stg. 
prod = https://www. 
mywebsite1 = sitename1.com 
mywebsite2 = sitename2.com 

:*:lclmywebsite1::%local%%mywebsite1%{enter} 
:*:devmywebsite1::%dev%%mywebsite1%{enter} 
:*:stgmywebsite1::%stage%%mywebsite1%{enter} 
:*:lclmywebsite2::%local%%mywebsite2%{enter} 
:*:devmywebsite2::%dev%%mywebsite2%{enter} 
:*:stgmywebsite2::%stage%%mywebsite2%{enter} 

當我鍵入stgmywebsite2 AutoHotkey的返回%階段%% mywebsite2%

這是什麼,我有以下,但上面的例子似乎並沒有評估的變量沒有什麼不同。有任何想法嗎?

:*:[email protected]::[email protected] 

回答

0

此示例演示使用熱字串內的變量擴展:

local = http://lcl. 
mywebsite1 = sitename1.com 

:*:lclmywebsite1:: 
    SendInput %local%%mywebsite1%{enter} 
    return 

從文檔Hotstrings

變量引用如%MyVar的%當前未更換內支撐文本。要解決此問題,請不要使這些熱點自動更換。相反,使用縮寫下方的SendInput命令,後跟一行僅包含單詞Return的行。

+0

這不起作用,它返回一個空行 –

+0

這對我很有用。我正在運行與您相同的版本(v1.1.24.05)。您可能有其他代碼干擾此熱點字符串。嘗試右鍵單擊任務欄上的autohotkey圖標並選擇「編輯此腳本」。用我的示例代碼保存並替換默認腳本的內容。再次右鍵單擊autohotkey圖標並選擇「重新加載此腳本」。打開記事本並鍵入'lclmywebsite1'。 –

+0

我確實有代碼干擾,我的變量需要在文件的頂部創建,但我添加了一堆其他命令之後。感謝您的幫助 –