Jump to content

Converter


NS5
 Share

Recommended Posts

#include-once

#include <GUIConstants.au3>

$BOTTITLE = "PRICE FETCHER"

$Form1 = GUICreate($BOTTITLE, 500, 40, ( @DesktopWidth - 500 ) / 2, (@DesktopHeight - 40) / 2 )
$Label1 = GUICtrlCreateLabel("Please wait, " & $BOTTITLE & " will download prices from cardbot and then update your price list.", 10, 10, 470, 17)
GUISetState(@SW_SHOW)

Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1)   ; Default tray menu items (Script Paused/Exit) will not be shown.


Func ShowInfo()
    MsgBox(0, "About", $BOTTITLE)
EndFunc   ;==>ShowInfo

TraySetClick(16)    ; Only secondary mouse button will show the tray menu.

Global $infoitem = TrayCreateItem("About")
TrayItemSetOnEvent(-1, "ShowInfo")

TrayCreateItem("")

Global $exititem = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "_exit")

TraySetState()

func _exit()
    exit
EndFunc

$line = FileRead("cards.js")
$pricefile = FileRead("prices.js")

$prices = StringSplit($pricefile, "") ;could be the problem

$a = StringSplit($line, "\n", 1)

;#cs
For $i = 1 To $a[0]

    If StringInStr($a[$i], "booster") Then ContinueLoop
    If StringInStr($a[$i], "Tournament Pack") Then ContinueLoop
    If StringInStr($a[$i], "Theme Deck") Then ContinueLoop
    If StringInStr($a[$i], "Event Ticket") Then ContinueLoop
    
    If StringInStr($a[$i], "g_cardNames") Then $a[$i] = StringRight($a[$i], StringLen($a[$i]))

    $cardname = StringSplit($a[$i], "(#)")

    If $cardname[0] < 2 Then ContinueLoop

    $p = (((Asc($prices[ $i + 75]) + (Asc($prices[ $i + 74]) * 256)) - 35) / 100) ;could be the problem
    
    FileWriteLine("temp.js", $cardname[1] & " (" & $cardname[2] & ")=" & $p)


Next
;#ce

$file = FileOpen("temp.js", 0)

While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop

    $cardname = StringSplit($line, "=")

    $p = $cardname[2]
    $cardname = $cardname[1]

    $oldprice = IniRead("prices.ini", "cards", $cardname, "NOT FOUND")

    If $oldprice <> "NOT FOUND" Then

        $price = StringSplit($oldprice, " ")

        IniWrite("prices.ini", "cards", $cardname, $price[1] & " " & $price[2] & " " & $p & " " & $price[4])


    EndIf



WEnd

FileClose($file)

Problem getting the exact value for $p, probably wrong translation on prices.js. Need this fix for my auto pricing updater

Rename the txt files as js when you got it. Forum does not allow js file uploads.

e.g. Adun Oakenshield (MED) = 0.35 ;correct prices

Allosaurus Rider (CSP) = 0.50

Can you explain the structure of the price file?
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...