mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2014
Posts: 259
S
Sakana Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
I'm looking for a way to use output from Python in mIRC. Atm I write to a file and then read that with mIRC, but it's really clunky.

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
what's the python script/code? It may be possible to recode it as js and then use mIRC's COM implentation to execute the code and retrieve the value


I am SReject
My Stuff
Joined: Sep 2014
Posts: 259
S
Sakana Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
Basically what it does is search a .txt file with 16000 lines and find what best matches the input.

In mIRC I run it with
Code:
run -h search.py " $+ $1- $+ " 





Code:
from fuzzywuzzy import fuzz
import sys

def cardsearch(CardName):    
    Cardname = str(CardName)
    test = open("cards.txt","r")
    listen = [];
    inputLen = len(CardName.split(" "))
    for line in test:
        temp = fuzz.token_set_ratio(CardName,line),line
        listen.append(temp)
    listen.sort()
    temp = listen[-1]
    test.close()
    temp = " ".join(str(i).strip() for i in temp)
    result = temp.partition(" ")[2]
    target = open("matched.txt","w")
    target.write(result)
    target.close()

cardsearch(sys.argv[1])


Link Copied to Clipboard