【发布时间】:2011-09-05 01:40:53
【问题描述】:
我正在编写一个自动热键脚本,它允许我选择文本/代码到我的剪贴板并点击键盘组合,然后它将它作为新条目发布在我的帐户下的 pastbin.com 网站上并返回 URL将新的 pastebin.com 条目添加到我的剪贴板。
到目前为止,除了 1 个例外,我的效果很好。下面是我的自动热键代码...
; ******* INFO *******
; < Pastebin.com copy/paste> - Instantly share your code on pastebin.com
; SCRIPT FUNCTION: Press hotkey (ctrl+shift+c) to save selected text to pastebin.com
; ******* Initiate script *******
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance, Force
; ******* Hotkeys - Post Code and Get URL *******
^+c::
Send ^c
ClipWait
pastestring:=ClipBoard
api_user_key:="cd25-CHANGED-7c0158bgg06a91e617"
api_dev_key:="24-CHANGED-eecedghb97f35"
URL:="http://pastebin.com/api/api_post.php"
POSTDATA := "api_paste_code=" pastestring "&api_user_key=" api_user_key "&api_paste_name=" filename "&api_paste_private=1&api_paste_format=php&api_dev_key=" api_dev_key "&api_option=paste"
html := httpQUERY(URL,POSTDATA)
Clipboard:=html
TrayTip, AHKClipper, Added %Html%, 2, 1
真正的魔法发生在
对httpQUERY(URL,POSTDATA)的函数调用
该函数的代码位于此处的文件中... http://pastebin.com/Bcb3ELPE 我把它贴在那里是因为它有 200 多行,并不真正需要回答这个问题。
现在问题是我上面的脚本可以工作,我必须将 httpquery.ahk 文件的内容包含到我自己的上面的 .ahk 文件中。
难道没有什么方法可以将该文件包含在其中,而不会将所有代码都放入我自己的文件中吗?
【问题讨论】:
标签: autohotkey