Auto-PoE Wiki Searching (AutoHotKey)

It really surprise me, at this ago of gaming, people can get every piece of info on the internet. There's convenient tools like PoE-Wiki and people will ask silly question.

People can pay 1chaos to buy "Hatred" gem. Don't they realize it's a Brutus quest rewarded gem which you can get by just playing 20mins?

So nothing fancy, just a hotkey to do the PoE-wiki search. Just mouse hover an item in game and press "F7", it will create search text, run browser(firefox or chrome, don't use IE). I use it to check "roll" on unique, etc.

WARMING: whenever you find something like "Run", "File", etc in a script. Check carefaully what it do. For this one, it's just to run Chrome( or Firefox) to browse your search.

;PoE WiKi Search
F7::
IfWinActive Path of Exile
{
Clipboard := ;empty clipboard
Send, ^C ;ctrl-C to get info of weapon into Clipboard
Sleep, 200 ;if nothing in clipboard, it'll hang, so to use sleep instead of Clipwait

If( Clipboard != "" )
{
Info := Clipboard
StringSplit, LineArray, Info, `n
Item_name := LineArray2
;remove "superior"
replace := "Superior "
StringReplace, Item_name, Item_name, %replace%
; replace space to + for search string
StringReplace, Search, Item_name, %A_SPACE%, +, All

url = http://pathofexile.gamepedia.com/index.php?search=%Search%

; if use firefox to search
; Firefox = C:\Program Files (x86)\Mozilla Firefox\firefox.exe
; Run %Firefox% %url%
; change accordingly if Chrome is installed in other location
Google = C:\Users\*user_name*\AppData\Local\Google\Chrome\Application\chrome.exe
Run %Google% %url%
}

}
Else
{
Send, {F7}
}
Return
Последняя редакция: stefan_12345#3840. Время: 17 дек. 2013 г., 07:21:33
Last bumped18 дек. 2016 г., 18:25:15
Would it surprise you I'd rather pay 1 chaos than play from the start for 5 minutes, even? In those 5 minutes, I'd have gotten some XP, and more currency than that 1 chaos, probably.
[3.26] ❄️⚡CantripN's Hadoken! - Lightning Conduit Permafreeze⚡❄️
www.pathofexile.com/forum/view-thread/3229590
I don't think it's written well, but I love the idea, so I'm doing it my way. I have rewritten (not changed) the code, as it was unreliable. I have rewritten it and explained why in comments. I credited it as mine, as I don't think that part that was left can be copyrighted (i.e. trivial work, not really a different than any example in the Internet).

Instructions:
* Get AutoHotKey and install it. 64 bit, Unicode version is recommended. It will work with 32 bit POE
* Create an empty file named e.g. poe.ahk (ahk is an extension!)
* Copy code (from lines beginning with ";" to the end of the post, paste into file (you can use Notepad) and save it
* Run it, e.g. by double clicking on that
If that's too much to you, PM me and I'll send you .exe file you can run without anything more.

Improvements:
* Reliable detect if Path of Exile window is active
* Don't destroy clipboard contents
* Use default browser (this way you don't have to change anything in the code)
* Other performance and reliability changes

Script is released on following free licenses (you may choose!): MIT, LGPL, CC BY (no version number means current + further)

Side note from a professional coder - should one learn AHK or not? Read it before you'd decide.
Скрытый текст

AHK is... so bad... so wrong... Like the house made of cardboard box. You spend your time to paint it, add furniture and then you realize that you need to use long, expensive (time) code to do very simple things, often you won't be able to do stuff and you will learn very bad standards. It's a big mess. Does it have use? Yes! The author used it correctly. Simple scripts. It tempts to know more if you learnt a bit of AHK, but really, your first GUI app will be done slower than learning a normal language from a scratch. If you want to learn how to make apps, use something standardised, then every next language will be obvious. For a limited time you can download Embarcadero Delphi for free (not a trial!). Delphi is outdated, but the language itself is a good choice for learning/coding sometimes even big apps. It's hard to find free IDE for Windows GUI apps (except for /C(|++|#)/). Heck, it's even better to write GUI apps in PHP-WX (WxWidgets wrapper), because yeah, it's limited and hard to share, but if you know WxWidgets (or GTK with Glade editor, as in PHP-GTK), you could use your experience in every other language with Wx/GTK bindings (virtually any modern language), as the only difference will be grammar of different language; commands, way to handle things, parameters, events etc. - it's the same in every language. I wrote once a proof-of-concept - PHP-GTK app - browser and metadata editor for SVG files, beautifully rendered previews, de facto multithreading (in coding sense, not hardware), ability to upload to OpenClipboard... Yeah, it wasn't a good way, but I've shown it's possible - together with the last step, i.e. bundle it in the installer with every dependency included. The .NET version checker/downloader/installer which needs to be run before PHP script, was in fact done in AHK. It's named SVGnife (@GitHub).



; POE Wiki Search Tool, b1, v0.1
; (c) krzysiu.net, 2016; inspired by CantripN
; Released on MIT, LGPL, CC BY

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir% ; better performance and reliability with these directives

#IfWinActive, ahk_class POEWindowClass ; first check if window is active, then process hotkey; the original author's approach may cause unexpected behaviour; also check for the window class, not title - author's version checks if windows starts with POE, so it might be "POE - Mozilla Firefox". This version doesn't check window name, but type, so it's reliable
F7::
ClipBackup := ClipboardAll ; make a copy of clipboard, so it can be restored after temporary use; "ClipboardAll" is critical, "Clipboard" would back up only text
Clipboard :=
Send, ^c ; technical nazi - it's CTRL+c, not "C"
ClipWait, 0.5, 1 ; ClipWait has timeout parameter; also wait only for text (2nd param, "1")
Info := Clipboard ; taken out of expression to avoid redundancy later
Clipboard := ClipBackup ; restore before end; to restore it, we use "Clipboard", not "~All";

If !Info
Return ; inverting expression; it's pointless to process the rest when it fails; let's just return here

StringSplit, LineArray, Info, `n
Item_name := LineArray2
replace := "Superior "
StringReplace, Item_name, Item_name, %replace%
StringReplace, Search, Item_name, %A_SPACE%, +, All


url = http://pathofexile.gamepedia.com/index.php?search=%Search%
Run, %url% ; you can run just URL and it will open in browser - same as in cmd or with "start" shell command

Return
#IfWinActive ; optional, end of IfWinActive compiler directive
http://krzysiu.net
By job: programmer and PC repair technician. By passion: photography and DIY movement. I'm glad when I can help! Feel free to ask me about PC/technical stuff.

Пожаловаться на запись форума

Пожаловаться на учетную запись:

Тип жалобы

Дополнительная информация