Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load an autohotkey file into another autohotkey file (.ahk) [duplicate]

Tags:

autohotkey

I am working on a autohotkey script that will allow me to select text/code tomy clipboard and hit a keyboard combination, it will then post it as a new entry on the pastbin.com website under my account and return the URL for the new pastebin.com entry to my clipboard.

So far I have it working great with 1 exception. Below is my autohotkey code...

; ******* 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

The real magic happens with the

function call to httpQUERY(URL,POSTDATA)

The code for that function is in the file located here... http://pastebin.com/Bcb3ELPE I posted it on there because it is like 200+ lines and isn't really needed to answer this question.

Now the problem is for my script above to work, I have to include the contents of the httpquery.ahk file into my own .ahk file above.

Isn't there some way to include that file into it without having all that code cluttered into my own file?

like image 529
JasonDavis Avatar asked Oct 23 '25 03:10

JasonDavis


1 Answers

I seem to have it working by including the other file like this

#include HTTPQuery.ahk

I didn't know you could do this

like image 136
JasonDavis Avatar answered Oct 26 '25 07:10

JasonDavis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!