mIRC Home    About    Download    Register    News    Help

Print Thread
Using output from another language? #252629 29/04/15 07:03 PM
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.

Re: Using output from another language? [Re: Sakana] #252630 29/04/15 07:14 PM
Joined: Apr 2010
Posts: 966
F
FroggieDaFrog Offline
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 966
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
Re: Using output from another language? [Re: FroggieDaFrog] #252631 29/04/15 07:46 PM
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])