Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GUIConstantsEx.au3>
- #include <GuiMenu.au3>
- #include <WinAPI.au3>
- #include <EditConstants.au3>
- #include <WindowsConstants.au3>
- #include <ColorConstants.au3>
- #include <Table.au3>
- #include <Process.au3>
- #include <File.au3>
- #include <InetConstants.au3>
- Global $g_idMemo, $hGUI, $hFile, $hHelp, $hMain, $hSettings, $aGUI
- Global $bOverview, $lWallet, $lBalance, $lUnconfirmed, $lRecent, $bRefresh
- Global $bSend, $bPay, $lPayto, $lAmount, $iPayto, $iAmount, $lStatus
- Global $bReceive, $lAddress, $iAddress
- Global $bTransactions, $tTrans, $Data, $Type, $Trans, $Amou
- Global $bAddresses, $tAddy, $Addy, $bAdd
- Global $bMine, $bStart, $bEnd, $lMiningStatus, $lPool, $lHashrate, $lMoneroMade
- Global $bConsole, $eConsole
- Global Enum $e_idNew = 1000, $e_idBU, $e_idExit, $e_idAbout, $e_idConsole
- Global $State
- Global $about = 0
- $bitmonorodlog = @ScriptDir & "\bitmonerod.log"
- $simplewalletlog = @ScriptDir & "\simplewallet.log"
- $moneroguilog = @ScriptDir & "\monerogui.log"
- $addresslist = @ScriptDir & "\addresslist.txt"
- $mineconf = @ScriptDir & "\cpuminer\minerdconf.txt"
- FileOpen($moneroguilog, 10)
- FileOpen($addresslist, 9)
- If FileExists($mineconf) Then
- ;Do Nothing
- Else
- FileOpen($mineconf, 10)
- FileWrite($mineconf, @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF)
- EndIf
- $TransLN = _FileCountLines($simplewalletlog)
- If $TransLN > 100 Then
- $TransLN = 100
- EndIf
- If FileReadLine($moneroguilog, 1) = "" Then
- For $y = 0 to $TransLN Step 1
- $Trans = FileReadLine($simplewalletlog, $y)
- If StringInStr($Trans, "received") and StringInStr($Trans, "transaction") Then
- FileWrite($moneroguilog, $Trans & @CRLF)
- EndIf
- If StringInStr($Trans, "spent") and StringInStr($Trans, "transaction") Then
- FileWrite($moneroguilog, $Trans & @CRLF)
- EndIf
- Next
- EndIf
- If FileExists(@ScriptDir & "\wallet.bin") = 0 Then
- _FirstSetup()
- Endif
- If ProcessExists("bitmonerod.exe") Then
- ConsoleWrite("bitmonero is already running" & @CRLF)
- Else
- FileDelete(@ScriptDir & "\bitmonerod.log")
- If FileExists(@ScriptDir & "\bitmonerod.exe") Then
- $ibitonero = Run(@ScriptDir & "\bitmonerod.exe", @ScriptDir, @SW_HIDE)
- ConsoleWrite("bitmonero started PID= " & $ibitonero & @CRLF)
- Sleep(4000)
- Else
- $reply = MsgBox(17, "Fatal Error", "bitmonrod.exe not found, click Ok do download latest versions")
- If $reply = 1 Then
- _Download()
- Else
- Exit
- EndIf
- EndIf
- EndIf
- If ProcessExists("simplewallet.exe") Then
- ConsoleWrite("simplewallet is already running" & @CRLF)
- Else
- FileDelete(@ScriptDir & "\simplewallet.log")
- If FileExists(@ScriptDir & "\simplewallet.exe") Then
- $isimplewallet = Run(@ScriptDir & "\simplewallet.exe --wallet wallet.bin", @ScriptDir, @SW_HIDE)
- $Password = InputBox("Wallet Password", "Please provide your wallet password", "", "*", 250, 130)
- ConsoleWrite("simplewallet started PID= " & $isimplewallet & @CRLF)
- $simplewallet = WinGetHandle(@ScriptDir & "\simplewallet.exe", "")
- ControlSend($simplewallet,"","", $Password & @CRLF)
- Else
- $reply = MsgBox(17, "Fatal Error", "simplewallet.exe not found, click Ok do download latest versions")
- If $reply = 1 Then
- _Download()
- Else
- Exit
- EndIf
- EndIf
- EndIf
- $simplewallet = WinGetHandle(@ScriptDir & "\simplewallet.exe", "")
- $bitmonorod = WinGetHandle(@ScriptDir & "\bitmonerod.exe", "")
- Func MoneroGUI()
- ConsoleWrite("you are in MoneroGUI" & @CRLF)
- $sGUI = GUICreate("Monero GUI Wallet: Loading...", 920, 300)
- GUISetFont(8, 400, 0, "Tahoma")
- GUISetBkColor(0x464646)
- $lLoading = GUICtrlCreateLabel("Please wait while bitmonero starts up....", 10, 10, 400, 20)
- $eLoading = GUICtrlCreateEdit("", 10, 40, 600, 230)
- GUICtrlSetFont($lLoading, 10, 600, 0, "Tahoma")
- GUICtrlSetColor($lLoading, 0xC3B54C)
- GUISetState(@SW_SHOW)
- While 1
- $Load = FileRead($bitmonorodlog)
- GUICtrlSetData($eLoading, $Load)
- If StringInStr($Load, "The daemon will start synchronizing with the network.") Then
- GUIDelete($sGUI)
- ExitLoop
- EndIf
- Sleep(1000)
- WEnd
- Sleep(1000)
- $hGUI = GUICreate("Monero GUI Wallet", 920, 300)
- GUISetFont(8, 400, 0, "Tahoma")
- GUISetBkColor(0x464646)
- $hFile = _GUICtrlMenu_CreateMenu()
- _GUICtrlMenu_InsertMenuItem($hFile, 0, "Backup", $e_idBU)
- _GUICtrlMenu_InsertMenuItem($hFile, 1, "", 0)
- _GUICtrlMenu_InsertMenuItem($hFile, 2, "Exit", $e_idExit)
- $hHelp = _GUICtrlMenu_CreateMenu()
- _GUICtrlMenu_InsertMenuItem($hHelp, 0, "About", $e_idAbout)
- _GUICtrlMenu_InsertMenuItem($hHelp, 0, "Console", $e_idConsole)
- $hMain = _GUICtrlMenu_CreateMenu()
- _GUICtrlMenu_InsertMenuItem($hMain, 0, "File", 0, $hFile)
- _GUICtrlMenu_InsertMenuItem($hMain, 1, "Settings", 0, $hSettings)
- _GUICtrlMenu_InsertMenuItem($hMain, 2, "Help", 0, $hHelp)
- _GUICtrlMenu_SetMenu($hGUI, $hMain)
- GUICtrlSetFont($lRecent, 10, 400, 0, "Tahoma")
- $bOverview = GUICtrlCreateButton("Overview", 10, 10, 80, 25, 0)
- GUICtrlSetFont($bOverview, 10, 400, 0, "Tahoma")
- $bSend = GUICtrlCreateButton("Send", 95, 10, 80, 25, 0)
- GUICtrlSetFont($bSend, 10, 400, 0, "Tahoma")
- $bReceive = GUICtrlCreateButton("Receive", 180, 10, 80, 25, 0)
- GUICtrlSetFont($bReceive, 10, 400, 0, "Tahoma")
- $bTransactions = GUICtrlCreateButton("Transactions", 265, 10, 80, 25, 0)
- GUICtrlSetFont($bTransactions, 10, 400, 0, "Tahoma")
- $bAddresses = GUICtrlCreateButton("Addresses", 350, 10, 80, 25, 0)
- GUICtrlSetFont($bAddresses, 10, 400, 0, "Tahoma")
- $bMine = GUICtrlCreateButton("Mining", 435, 10, 80, 25, 0)
- GUICtrlSetFont($bMine, 10, 400, 0, "Tahoma")
- $lWallet = GUICtrlCreateLabel("Wallet:", 15, 40, 400, 20)
- GUICtrlSetFont($lWallet, 10, 600, 0, "Tahoma")
- GUICtrlSetColor($lWallet, 0xC3B54C)
- $lBalance = GUICtrlCreateLabel("Balance:", 15, 70, 400, 20)
- GUICtrlSetFont($lBalance, 10, 600, 0, "Tahoma")
- GUICtrlSetColor($lBalance, 0xC3B54C)
- $lUnconfirmed = GUICtrlCreateLabel("Unconfirmed:", 15, 100, 400, 20)
- GUICtrlSetFont($lUnconfirmed, 10, 600, 0, "Tahoma")
- GUICtrlSetColor($lUnconfirmed, 0xC3B54C)
- $lRecent = GUICtrlCreateLabel("Recent:", 15, 130, 950, 50)
- GUICtrlSetFont($lRecent, 10, 600, 0, "Tahoma")
- GUICtrlSetColor($lRecent, 0xC3B54C)
- $bRefresh = GUICtrlCreateButton("Refresh", 830, 250, 76, 25, 0)
- GUICtrlSetFont($bRefresh, 10, 400, 0, "Tahoma")
- $lPayto = GUICtrlCreateLabel("Pay to:", 15, 40, 70, 20)
- GUICtrlSetFont($lPayto, 10, 600, 0, "Tahoma")
- GUICtrlSetColor($lPayto, 0xC3B54C)
- GUICtrlSetState($lPayto, $GUI_HIDE)
- $iPayto = GUICtrlCreateInput("", 85, 40, 800, 20)
- GUICtrlSetFont($iPayto, 10, 400, 0, "Tahoma")
- GUICtrlSetState($iPayto, $GUI_HIDE)
- $lAmount = GUICtrlCreateLabel("Amount:", 15, 70, 70, 20)
- GUICtrlSetFont($lAmount, 10, 600, 0, "Tahoma")
- GUICtrlSetColor($lAmount, 0xC3B54C)
- GUICtrlSetState($lAmount, $GUI_HIDE)
- $iAmount = GUICtrlCreateInput("", 85, 70, 120, 20)
- GUICtrlSetFont($iAmount, 10, 400, 0, "Tahoma")
- GUICtrlSetState($iAmount, $GUI_HIDE)
- $lStatus = GUICtrlCreateLabel("Status:", 15, 100, 900, 150)
- GUICtrlSetFont($lStatus, 10, 600, 0, "Tahoma")
- GUICtrlSetColor($lStatus, 0xC3B54C)
- GUICtrlSetState($lStatus, $GUI_HIDE)
- $bPay = GUICtrlCreateButton("Pay", 830, 250, 76, 25, 0)
- GUICtrlSetFont($bPay, 10, 400, 0, "Tahoma")
- GUICtrlSetState($bPay, $GUI_HIDE)
- $lAddress = GUICtrlCreateLabel("Your address:", 15, 40, 100, 20)
- GUICtrlSetFont($lAddress, 10, 600, 0, "Tahoma")
- GUICtrlSetColor($lAddress, 0xC3B54C)
- GUICtrlSetState($lAddress, $GUI_HIDE)
- $iAddress = GUICtrlCreateInput("Your address:", 115, 40, 700, 20,$ES_READONLY,$WS_EX_TOOLWINDOW)
- GUICtrlSetFont($iAddress, 10, 400, 0, "Tahoma")
- GUICtrlSetState($iAddress, $GUI_HIDE)
- $bAdd = GUICtrlCreateButton("Add", 830, 250, 76, 25, 0)
- GUICtrlSetFont($bAdd, 10, 400, 0, "Tahoma")
- GUICtrlSetState($bAdd, $GUI_HIDE)
- $bStart = GUICtrlCreateButton("Start", 10, 40, 70, 25, 0)
- GUICtrlSetFont($bStart, 10, 400, 0, "Tahoma")
- GUICtrlSetState($bStart, $GUI_HIDE)
- $bEnd = GUICtrlCreateButton("End", 85, 40, 70, 25, 0)
- GUICtrlSetFont($bEnd, 10, 400, 0, "Tahoma")
- GUICtrlSetState($bEnd, $GUI_HIDE)
- $lMiningStatus = GUICtrlCreateLabel("Status:", 15, 70, 700, 20)
- GUICtrlSetFont($lMiningStatus, 10, 600, 0, "Tahoma")
- GUICtrlSetColor($lMiningStatus, 0xC3B54C)
- GUICtrlSetState($lMiningStatus, $GUI_HIDE)
- $lPool = GUICtrlCreateLabel("Your pool:", 15, 100, 700, 20)
- GUICtrlSetFont($lPool, 10, 600, 0, "Tahoma")
- GUICtrlSetColor($lPool, 0xC3B54C)
- GUICtrlSetState($lPool, $GUI_HIDE)
- $lHashrate = GUICtrlCreateLabel("Your address: ", 15, 130, 900, 20)
- GUICtrlSetFont($lHashrate, 10, 600, 0, "Tahoma")
- GUICtrlSetColor($lHashrate, 0xC3B54C)
- GUICtrlSetState($lHashrate, $GUI_HIDE)
- $lMoneroMade = GUICtrlCreateLabel("Daily income: ", 15, 160, 700, 20)
- GUICtrlSetFont($lMoneroMade, 10, 600, 0, "Tahoma")
- GUICtrlSetColor($lMoneroMade, 0xC3B54C)
- GUICtrlSetState($lMoneroMade, $GUI_HIDE)
- $eConsole = GUICtrlCreateEdit("", 10, 40, 600, 230)
- GUICtrlSetFont($eConsole, 10, 600, 0, "Tahoma")
- GUICtrlSetState($eConsole, $GUI_HIDE)
- GUISetState(@SW_SHOW)
- FileOpen($moneroguilog, 10)
- $TransLN = _FileCountLines($simplewalletlog)
- If $TransLN > 100 Then
- $TransLN = 100
- EndIf
- If FileReadLine($moneroguilog, 1) = "" Then
- For $y = 0 to $TransLN Step 1
- $Trans = FileReadLine($simplewalletlog, $y)
- If StringInStr($Trans, "received") and StringInStr($Trans, "transaction") Then
- FileWrite($moneroguilog, $Trans & @CRLF)
- EndIf
- If StringInStr($Trans, "spent") and StringInStr($Trans, "transaction") Then
- FileWrite($moneroguilog, $Trans & @CRLF)
- EndIf
- Next
- EndIf
- $lines = _FileCountLines($moneroguilog)
- $Recent = FileReadLine($moneroguilog, $lines)
- GUICtrlSetData($lRecent, "Recent: " & $Recent)
- $x = 0
- $e = 0
- While 1
- If $x > 10 Then $x = 0
- $State = _FileCountLines($bitmonorodlog)
- $State = FileReadLine($bitmonorodlog, $State - $x)
- If StringInStr($State, "behind") Or StringInStr($State, "SYNCHRONIZED OK") Then
- If StringInStr($State, "behind") Then
- $BehindLeft = StringInStr($State, "blocks")
- $Behind = StringTrimLeft($State, $BehindLeft + 7)
- $BehindRight = StringInStr($Behind, "behind")
- $Behind = StringLeft($Behind, $BehindRight - 3)
- $State = "Out of sync (" & $Behind & ")"
- GUICtrlSetColor($lWallet, $COLOR_RED)
- ExitLoop
- EndIf
- If StringInStr($State, "SYNCHRONIZED OK") Then
- $State = "Synchronized"
- GUICtrlSetColor($lWallet, $COLOR_GREEN)
- ExitLoop
- EndIf
- EndIf
- If $e > 10 Then
- $State = "Unknown"
- ExitLoop
- EndIf
- $e = $e + 1
- $x = $x + 1
- WEnd
- GUICtrlSetData($lWallet, "Wallet: " & $State)
- $i = 0
- $e = 0
- While 1
- If $i > 10 Then $i = 0
- $Bal = _FileCountLines($simplewalletlog)
- If $Bal > 500 Then
- $Bal = 500
- EndIf
- $Bal = FileReadLine($simplewalletlog, $Bal - $i)
- If StringInStr($Bal, "balance:") Then
- ExitLoop
- EndIf
- If $e > 10 Then
- $Bal = "0"
- ExitLoop
- EndIf
- $e = $e + 1
- $i = $i + 1
- WEnd
- $BalanceLeft = StringInStr($Bal, "balance:")
- $Balance = StringTrimLeft($Bal, $BalanceLeft + 8)
- ConsoleWrite($Balance & @CRLF)
- $BalRight = StringInStr($Balance, ",")
- $Balance = StringLeft($Balance, $BalRight - 1)
- ConsoleWrite($Balance & @CRLF)
- GUICtrlSetData($lBalance, "Balance: " & $Balance)
- $UnconfLeft = StringInStr($Bal, "balance:", 0, 2)
- $Unconf = StringTrimLeft($Bal, $UnconfLeft + 8)
- $Unconf = $Balance - $Unconf
- GUICtrlSetData($lUnconfirmed, "Unconfirmed: " & $Unconf)
- GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
- ;Do
- ;Until GUIGetMsg() = $GUI_EVENT_CLOSE
- While 1
- Switch GUIGetMsg()
- Case $GUI_EVENT_CLOSE
- If $about > 0 Then
- GUIDelete($aGUI)
- $about = 0
- _Overview()
- Else
- ConsoleWrite($about & @CRLF)
- ExitLoop
- EndIf
- EndSwitch
- WEnd
- EndFunc
- Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
- #forceref $hWnd, $iMsg, $lParam
- Switch _WinAPI_LoWord($wParam)
- Case $e_idBU
- _Backup()
- Case $e_idExit
- _Exit()
- Case $e_idAbout
- _About()
- Case $e_idConsole
- _Console()
- Case $bOverview
- _Overview()
- Case $bRefresh
- _Refresh()
- Case $bSend
- _Send()
- Case $bPay
- _Pay()
- Case $bReceive
- _Receive()
- Case $bTransactions
- _Transactions()
- Case $bAddresses
- _Addresses()
- Case $bAdd
- _Add()
- Case $bMine
- _Mine()
- Case $bStart
- _Start()
- Case $bEnd
- _End()
- EndSwitch
- Return $GUI_RUNDEFMSG
- EndFunc
- Func _Refresh()
- $simplewallet = WinGetHandle(@ScriptDir & "\simplewallet.exe", "")
- $bitmonorod = WinGetHandle(@ScriptDir & "\bitmonerod.exe", "")
- ControlSend($simplewallet,"","","refresh" & @CRLF)
- _Overview()
- EndFunc
- Func _Backup()
- ConsoleWrite("you are in backup" & @CRLF)
- EndFunc
- Func _Exit()
- ConsoleWrite("you are in exit" & @CRLF)
- $simplewallet = WinGetHandle(@ScriptDir & "\simplewallet.exe", "")
- $bitmonorod = WinGetHandle(@ScriptDir & "\bitmonerod.exe", "")
- ControlSend($simplewallet,"","","exit" & @CRLF)
- ControlSend($bitmonorod,"","","exit" & @CRLF)
- While ProcessExists("bitmonerod.exe")
- Sleep(1000)
- WEnd
- While ProcessExists("simplewallet.exe")
- Sleep(1000)
- WEnd
- Exit
- EndFunc
- Func _About()
- ConsoleWrite("you are in about" & @CRLF)
- $about = 1
- $aGUI = GUICreate("About", 420, 220)
- GUISetFont(8, 400, 0, "Tahoma")
- GUISetBkColor(0x464646)
- $eAbout = GUICtrlCreateEdit("Monero GUI Wallet Version 0.1" & @CRLF & "----------------------------------" & @CRLF & "Nov 25 2014" & @CRLF & "todo: Backup, Exitscreen, Get passphrase, Auto updates, First Setup, Console" & @CRLF & "by Farianman", 10, 10, 400, 200,$ES_READONLY,$WS_EX_TOOLWINDOW)
- GUISetState(@SW_SHOW)
- EndFunc
- Func _Overview()
- ConsoleWrite("you are in overview" & @CRLF)
- GUICtrlSetState($lWallet, $GUI_SHOW)
- GUICtrlSetState($lBalance, $GUI_SHOW)
- GUICtrlSetState($lUnconfirmed, $GUI_SHOW)
- GUICtrlSetState($lRecent, $GUI_SHOW)
- GUICtrlSetState($bRefresh, $GUI_SHOW)
- GUICtrlSetState($lPayto, $GUI_HIDE)
- GUICtrlSetState($lAmount, $GUI_HIDE)
- GUICtrlSetState($bPay, $GUI_HIDE)
- GUICtrlSetState($iPayto, $GUI_HIDE)
- GUICtrlSetState($iAmount, $GUI_HIDE)
- GUICtrlSetState($lStatus, $GUI_HIDE)
- GUICtrlSetState($lAddress, $GUI_HIDE)
- GUICtrlSetState($iAddress, $GUI_HIDE)
- GUICtrlSetState($bAdd, $GUI_HIDE)
- _GUICtrlTable_Delete($tTrans)
- _GUICtrlTable_Delete($tAddy)
- GUICtrlSetState($bStart, $GUI_HIDE)
- GUICtrlSetState($bEnd, $GUI_HIDE)
- GUICtrlSetState($lMiningStatus, $GUI_HIDE)
- GUICtrlSetState($lPool, $GUI_HIDE)
- GUICtrlSetState($lHashrate, $GUI_HIDE)
- GUICtrlSetState($lMoneroMade, $GUI_HIDE)
- GUICtrlSetState($eConsole, $GUI_HIDE)
- FileOpen($moneroguilog, 10)
- $TransLN = _FileCountLines($simplewalletlog)
- If $TransLN > 100 Then
- $TransLN = 100
- EndIf
- If FileReadLine($moneroguilog, 1) = "" Then
- For $y = 0 to $TransLN Step 1
- $Trans = FileReadLine($simplewalletlog, $y)
- If StringInStr($Trans, "received") and StringInStr($Trans, "transaction") Then
- FileWrite($moneroguilog, $Trans & @CRLF)
- EndIf
- If StringInStr($Trans, "spent") and StringInStr($Trans, "transaction") Then
- FileWrite($moneroguilog, $Trans & @CRLF)
- EndIf
- Next
- EndIf
- $lines = _FileCountLines($moneroguilog)
- $Recent = FileReadLine($moneroguilog, $lines)
- GUICtrlSetData($lRecent, "Recent: " & $Recent)
- $x = 0
- $e = 0
- While 1
- If $x > 10 Then $x = 0
- $State = _FileCountLines($bitmonorodlog)
- $State = FileReadLine($bitmonorodlog, $State - $x)
- If StringInStr($State, "behind") Or StringInStr($State, "SYNCHRONIZED OK") Then
- If StringInStr($State, "behind") Then
- If StringInStr($State, "behind") Then
- $BehindLeft = StringInStr($State, "blocks")
- $Behind = StringTrimLeft($State, $BehindLeft + 7)
- $BehindRight = StringInStr($Behind, "behind")
- $Behind = StringLeft($Behind, $BehindRight - 3)
- $State = "Out of sync (" & $Behind & ")"
- GUICtrlSetColor($lWallet, $COLOR_RED)
- ExitLoop
- EndIf
- GUICtrlSetColor($lWallet, $COLOR_RED)
- ExitLoop
- EndIf
- If StringInStr($State, "SYNCHRONIZED OK") Then
- $State = "Synchronized"
- GUICtrlSetColor($lWallet, $COLOR_GREEN)
- ExitLoop
- EndIf
- EndIf
- If $e > 10 Then
- $State = "Unknown"
- ExitLoop
- EndIf
- $e = $e + 1
- $x = $x + 1
- WEnd
- GUICtrlSetData($lWallet, "Wallet: " & $State)
- $i = 0
- $e = 0
- While 1
- If $i > 10 Then $i = 0
- $Bal = _FileCountLines($simplewalletlog)
- If $Bal > 500 Then
- $Bal = 500
- EndIf
- $Bal = FileReadLine($simplewalletlog, $Bal - $i)
- ConsoleWrite($Bal & @CRLF)
- If StringInStr($Bal, "balance:") Then
- ExitLoop
- EndIf
- If $e > 10 Then
- $Bal = "0"
- ExitLoop
- EndIf
- $e = $e + 1
- $i = $i + 1
- WEnd
- $BalanceLeft = StringInStr($Bal, "balance:")
- $Balance = StringTrimLeft($Bal, $BalanceLeft + 8)
- ConsoleWrite($Balance & @CRLF)
- $BalRight = StringInStr($Balance, ",")
- $Balance = StringLeft($Balance, $BalRight - 1)
- ConsoleWrite($Balance & @CRLF)
- GUICtrlSetData($lBalance, "Balance: " & $Balance)
- $UnconfLeft = StringInStr($Bal, "balance:", 0, 2)
- $Unconf = StringTrimLeft($Bal, $UnconfLeft + 8)
- $Unconf = $Balance - $Unconf
- GUICtrlSetData($lUnconfirmed, "Unconfirmed: " & $Unconf)
- EndFunc
- Func _Send()
- ConsoleWrite("you are in send" & @CRLF)
- GUICtrlSetState($lWallet, $GUI_HIDE)
- GUICtrlSetState($lBalance, $GUI_HIDE)
- GUICtrlSetState($lUnconfirmed, $GUI_HIDE)
- GUICtrlSetState($lRecent, $GUI_HIDE)
- GUICtrlSetState($lAmount, $GUI_SHOW)
- GUICtrlSetState($lPayto, $GUI_SHOW)
- GUICtrlSetState($bPay, $GUI_SHOW)
- GUICtrlSetState($iPayto, $GUI_SHOW)
- GUICtrlSetState($iAmount, $GUI_SHOW)
- GUICtrlSetState($lStatus, $GUI_SHOW)
- GUICtrlSetState($lAddress, $GUI_HIDE)
- GUICtrlSetState($iAddress, $GUI_HIDE)
- GUICtrlSetState($bRefresh, $GUI_HIDE)
- GUICtrlSetState($bAdd, $GUI_HIDE)
- _GUICtrlTable_Delete($tTrans)
- _GUICtrlTable_Delete($tAddy)
- GUICtrlSetState($bStart, $GUI_HIDE)
- GUICtrlSetState($bEnd, $GUI_HIDE)
- GUICtrlSetState($lMiningStatus, $GUI_HIDE)
- GUICtrlSetState($lPool, $GUI_HIDE)
- GUICtrlSetState($lHashrate, $GUI_HIDE)
- GUICtrlSetState($lMoneroMade, $GUI_HIDE)
- GUICtrlSetState($eConsole, $GUI_HIDE)
- EndFunc
- Func _Pay()
- ConsoleWrite("you are in pay" & @CRLF)
- $simplewallet = WinGetHandle(@ScriptDir & "\simplewallet.exe", "")
- $bitmonorod = WinGetHandle(@ScriptDir & "\bitmonerod.exe", "")
- ControlSend($simplewallet,"","","transfer 3 " & GUICtrlRead($iPayto) & " " & GUICtrlRead($iAmount) & @CRLF)
- Sleep(1000)
- $Status = _FileCountLines($simplewalletlog)
- If $Status > 100 Then
- $Status = 100
- EndIf
- $Status = FileReadLine($simplewalletlog, $Status)
- ConsoleWrite($Status & @CRLF)
- GUICtrlSetData($lStatus, "Status: " & $Status)
- If StringInStr($Status, "Money successfully sent") Then
- GUICtrlSetColor($lStatus, $COLOR_GREEN)
- Else
- GUICtrlSetColor($lStatus, $COLOR_RED)
- EndIf
- EndFunc
- Func _Receive()
- ConsoleWrite("you are in receive" & @CRLF)
- GUICtrlSetState($lAddress, $GUI_SHOW)
- GUICtrlSetState($iAddress, $GUI_SHOW)
- GUICtrlSetState($lWallet, $GUI_HIDE)
- GUICtrlSetState($lBalance, $GUI_HIDE)
- GUICtrlSetState($lUnconfirmed, $GUI_HIDE)
- GUICtrlSetState($lRecent, $GUI_HIDE)
- GUICtrlSetState($lPayto, $GUI_HIDE)
- GUICtrlSetState($lAmount, $GUI_HIDE)
- GUICtrlSetState($bPay, $GUI_HIDE)
- GUICtrlSetState($iPayto, $GUI_HIDE)
- GUICtrlSetState($iAmount, $GUI_HIDE)
- GUICtrlSetState($lStatus, $GUI_HIDE)
- GUICtrlSetState($bRefresh, $GUI_HIDE)
- GUICtrlSetState($bAdd, $GUI_HIDE)
- _GUICtrlTable_Delete($tTrans)
- _GUICtrlTable_Delete($tAddy)
- GUICtrlSetState($bStart, $GUI_HIDE)
- GUICtrlSetState($bEnd, $GUI_HIDE)
- GUICtrlSetState($lMiningStatus, $GUI_HIDE)
- GUICtrlSetState($lPool, $GUI_HIDE)
- GUICtrlSetState($lHashrate, $GUI_HIDE)
- GUICtrlSetState($lMoneroMade, $GUI_HIDE)
- GUICtrlSetState($eConsole, $GUI_HIDE)
- $Address = FileRead($simplewalletlog)
- $AddressLeft = StringInStr($Address, "Opened wallet:")
- If $AddressLeft < 5 Then
- $AddressLeft = StringInStr($Address, "ed new wallet:")
- EndIf
- $Address = StringTrimLeft($Address, $AddressLeft + 14)
- $Address = StringLeft($Address, 96)
- ConsoleWrite("Your address: " & $Address & @CRLF)
- GUICtrlSetData($iAddress, $Address)
- EndFunc
- Func _Transactions()
- ConsoleWrite("you are in transactions" & @CRLF)
- GUICtrlSetState($lWallet, $GUI_HIDE)
- GUICtrlSetState($lBalance, $GUI_HIDE)
- GUICtrlSetState($lUnconfirmed, $GUI_HIDE)
- GUICtrlSetState($lRecent, $GUI_HIDE)
- GUICtrlSetState($lPayto, $GUI_HIDE)
- GUICtrlSetState($lAmount, $GUI_HIDE)
- GUICtrlSetState($bPay, $GUI_HIDE)
- GUICtrlSetState($iPayto, $GUI_HIDE)
- GUICtrlSetState($iAmount, $GUI_HIDE)
- GUICtrlSetState($lStatus, $GUI_HIDE)
- GUICtrlSetState($lAddress, $GUI_HIDE)
- GUICtrlSetState($iAddress, $GUI_HIDE)
- GUICtrlSetState($bRefresh, $GUI_HIDE)
- GUICtrlSetState($bAdd, $GUI_HIDE)
- _GUICtrlTable_Delete($tTrans)
- _GUICtrlTable_Delete($tAddy)
- GUICtrlSetState($bStart, $GUI_HIDE)
- GUICtrlSetState($bEnd, $GUI_HIDE)
- GUICtrlSetState($lMiningStatus, $GUI_HIDE)
- GUICtrlSetState($lPool, $GUI_HIDE)
- GUICtrlSetState($lHashrate, $GUI_HIDE)
- GUICtrlSetState($lMoneroMade, $GUI_HIDE)
- GUICtrlSetState($eConsole, $GUI_HIDE)
- $tTrans = _GUICtrlTable_Create(15, 40, 128, 18, 10, 4, 0)
- _GUICtrlTable_Set_RowHeight($tTrans, 1, 35)
- _GUICtrlTable_Set_Justify_All($tTrans, 1, 1)
- _GUICtrlTable_Set_TextFont_All($tTrans, 8.5, 800, 0, "Tahoma")
- _GUICtrlTable_Set_CellColor_Row($tTrans, 1, 0x555555)
- _GUICtrlTable_Set_TextColor_All($tTrans, 0x555555)
- _GUICtrlTable_Set_TextColor_Row($tTrans, 1, 0xC3B54C)
- For $row = 3 To 11 Step 2
- _GUICtrlTable_Set_CellColor_Row($tTrans, $row, 0xDDDDDD)
- Next
- _GUICtrlTable_Set_ColumnWidth($tTrans, 1, 145)
- _GUICtrlTable_Set_ColumnWidth($tTrans, 2, 50)
- _GUICtrlTable_Set_ColumnWidth($tTrans, 3, 460)
- _GUICtrlTable_Set_ColumnWidth($tTrans, 4, 155)
- _GUICtrlTable_Set_Text_Row($tTrans, 1, "Date|Type|Transaction|Amount")
- FileOpen($moneroguilog, 10)
- $TransLN = _FileCountLines($simplewalletlog)
- If $TransLN > 100 Then
- $TransLN = 100
- EndIf
- If FileReadLine($moneroguilog, 1) = "" Then
- For $y = 0 to $TransLN Step 1
- $Trans = FileReadLine($simplewalletlog, $y)
- If StringInStr($Trans, "received") and StringInStr($Trans, "transaction") Then
- FileWrite($moneroguilog, $Trans & @CRLF)
- EndIf
- If StringInStr($Trans, "spent") and StringInStr($Trans, "transaction") Then
- FileWrite($moneroguilog, $Trans & @CRLF)
- EndIf
- Next
- EndIf
- $lines = _FileCountLines($moneroguilog)
- For $i = 10 To 2 Step - 1
- $Type = ""
- $Data = FileReadLine($moneroguilog, $lines - $i)
- $Date = StringLeft($Data, 20)
- ConsoleWrite($Date & @CRLF)
- If StringInStr($Data, "received") Then $Type = "In"
- If StringInStr($Data, "spent") Then $Type = "Out"
- ConsoleWrite($Type & @CRLF)
- $TransLeft = StringInStr($Data, "transaction <")
- $Trans = StringTrimLeft($Data, $TransLeft + 12)
- $TransRight = StringInStr($Trans, ">,")
- $Trans = StringLeft($Trans, $TransRight - 1)
- ConsoleWrite($Trans & @CRLF)
- $Trim = 8
- $AmouLeft = StringInStr($Data, "received")
- If $AmouLeft = 0 Then
- $AmouLeft = StringInStr($Data, "spent")
- $Trim = 5
- EndIf
- $Amou = StringTrimLeft($Data, $AmouLeft + $Trim)
- ConsoleWrite($Amou & "|" & $AmouLeft & @CRLF)
- _GUICtrlTable_Set_Text_Row($tTrans, $i, $Date & "|" & $Type & "|" & $Trans & "|" & $Amou)
- Next
- _GUICtrlTable_Set_Border_Table($tTrans, 0x555555)
- EndFunc
- Func _Addresses()
- ConsoleWrite("you are in addresses" & @CRLF)
- GUICtrlSetState($lWallet, $GUI_HIDE)
- GUICtrlSetState($lBalance, $GUI_HIDE)
- GUICtrlSetState($lUnconfirmed, $GUI_HIDE)
- GUICtrlSetState($lRecent, $GUI_HIDE)
- GUICtrlSetState($lPayto, $GUI_HIDE)
- GUICtrlSetState($lAmount, $GUI_HIDE)
- GUICtrlSetState($bPay, $GUI_HIDE)
- GUICtrlSetState($iPayto, $GUI_HIDE)
- GUICtrlSetState($iAmount, $GUI_HIDE)
- GUICtrlSetState($lStatus, $GUI_HIDE)
- GUICtrlSetState($lAddress, $GUI_HIDE)
- GUICtrlSetState($iAddress, $GUI_HIDE)
- GUICtrlSetState($bRefresh, $GUI_HIDE)
- GUICtrlSetState($bAdd, $GUI_SHOW)
- _GUICtrlTable_Delete($tTrans)
- _GUICtrlTable_Delete($tAddy)
- GUICtrlSetState($bStart, $GUI_HIDE)
- GUICtrlSetState($bEnd, $GUI_HIDE)
- GUICtrlSetState($lMiningStatus, $GUI_HIDE)
- GUICtrlSetState($lPool, $GUI_HIDE)
- GUICtrlSetState($lHashrate, $GUI_HIDE)
- GUICtrlSetState($lMoneroMade, $GUI_HIDE)
- GUICtrlSetState($eConsole, $GUI_HIDE)
- $addyLN = _FileCountLines($addresslist)
- ConsoleWrite($addyLN & @CRLF)
- $tAddy = _GUICtrlTable_Create(15, 40, 128, 18, $addyLN + 1, 2, 0)
- _GUICtrlTable_Set_RowHeight($tAddy, 1, 35)
- _GUICtrlTable_Set_Justify_All($tAddy, 1, 1)
- _GUICtrlTable_Set_TextFont_All($tAddy, 8.5, 800, 0, "Tahoma")
- _GUICtrlTable_Set_CellColor_Row($tAddy, 1, 0x555555)
- _GUICtrlTable_Set_TextColor_All($tAddy, 0x555555)
- _GUICtrlTable_Set_TextColor_Row($tAddy, 1, 0xC3B54C)
- For $row = 3 To $addyLN Step 2
- _GUICtrlTable_Set_CellColor_Row($tAddy, $row, 0xDDDDDD)
- Next
- _GUICtrlTable_Set_ColumnWidth($tAddy, 1, 190)
- _GUICtrlTable_Set_ColumnWidth($tAddy, 2, 700)
- _GUICtrlTable_Set_Text_Row($tAddy, 1, "Label|Address")
- _GUICtrlTable_Set_Border_Table($tAddy, 0x555555)
- For $t = 1 To $addyLN Step 1
- $Addy = FileReadLine($addresslist, $t)
- ConsoleWrite($Addy & @CRLF)
- _GUICtrlTable_Set_Text_Row($tAddy, 1 + $t, $Addy)
- Next
- EndFunc
- Func _Add()
- $Label = InputBox("Label", "Please provide a contact label", "", "", 250, 130)
- $Addy = InputBox("Address", "Please provide a contact address", "", "", 250, 130)
- $Write = $Label & "|" & $Addy & @CRLF
- FileWrite($addresslist, $Write)
- _Addresses()
- EndFunc
- Func _Mine()
- ConsoleWrite("you are in mine" & @CRLF)
- GUICtrlSetState($lWallet, $GUI_HIDE)
- GUICtrlSetState($lBalance, $GUI_HIDE)
- GUICtrlSetState($lUnconfirmed, $GUI_HIDE)
- GUICtrlSetState($lRecent, $GUI_HIDE)
- GUICtrlSetState($lAmount, $GUI_HIDE)
- GUICtrlSetState($lPayto, $GUI_HIDE)
- GUICtrlSetState($bPay, $GUI_HIDE)
- GUICtrlSetState($iPayto, $GUI_HIDE)
- GUICtrlSetState($iAmount, $GUI_HIDE)
- GUICtrlSetState($lStatus, $GUI_HIDE)
- GUICtrlSetState($lAddress, $GUI_HIDE)
- GUICtrlSetState($iAddress, $GUI_HIDE)
- GUICtrlSetState($bRefresh, $GUI_HIDE)
- GUICtrlSetState($bAdd, $GUI_HIDE)
- _GUICtrlTable_Delete($tTrans)
- _GUICtrlTable_Delete($tAddy)
- GUICtrlSetState($bStart, $GUI_SHOW)
- GUICtrlSetState($bEnd, $GUI_SHOW)
- GUICtrlSetState($lMiningStatus, $GUI_SHOW)
- GUICtrlSetState($lPool, $GUI_SHOW)
- GUICtrlSetState($lHashrate, $GUI_SHOW)
- GUICtrlSetState($lMoneroMade, $GUI_HIDE)
- GUICtrlSetState($eConsole, $GUI_HIDE)
- If ProcessExists("minerd.exe") Then
- GUICtrlSetData($lMiningStatus, "Status: Mining ")
- GUICtrlSetColor($lMiningStatus, $COLOR_GREEN)
- Else
- GUICtrlSetData($lMiningStatus, "Status: Stopped ")
- GUICtrlSetColor($lMiningStatus, $COLOR_YELLOW)
- EndIf
- $Address = FileReadLine($mineconf, 2)
- GUICtrlSetData($lHashrate, "Your address: " & $Address)
- $URL = FileReadLine($mineconf, 3)
- GUICtrlSetData($lPool, "Your pool: " & $URL)
- EndFunc
- Func _Start()
- ConsoleWrite("you are in start" & @CRLF)
- If ProcessExists("minerd.exe") Then
- MsgBox(0, "Already mining", "You are already mining")
- Else
- If FileExists(@ScriptDir & "\cpuminer\minerd.exe") Then
- If FileExists($mineconf) Then
- $data = FileRead($mineconf)
- Else
- GUICtrlSetData($lMiningStatus, "Status: Error: minerdconf.txt not found at " & @ScriptDir & "\cpuminer")
- GUICtrlSetColor($lMiningStatus, $COLOR_RED)
- _Mine()
- EndIf
- $Threads = FileReadLine($mineconf, 1)
- If $Threads = "" Then
- $Threads = InputBox("Threads", "Home many CPU threads whould you like to mine?", "1", "", 250, 130)
- _FileWriteToLine($mineconf, 1, $Threads, 1)
- EndIf
- $Address = FileReadLine($mineconf, 2)
- If $Address = "" Then
- $Address = InputBox("Address", "Please provide your address", "49UVJ7trbssXWdRiuhoADB2Ud9i8MtfEtCstP4EcWwP4eohrF3dJYgyHuGsZqKWWwEHNr24i9Hzv66XMUrq8Xkkx9W6spTk", "", 250, 130)
- _FileWriteToLine($mineconf, 2, $Address, 1)
- EndIf
- $URL = FileReadLine($mineconf, 3)
- If $URL = "" Then
- $URL = InputBox("Pool", "Please provide your pool", "stratum.backup-pool.com:9333", "", 250, 130)
- _FileWriteToLine($mineconf, 3, $URL, 1)
- EndIf
- ConsoleWrite(@ScriptDir & "\cpuminer\minerd.exe -a cryptonight -o stratum+tcp://" & $URL & " -u " & $Address & " -p x -t " & $Threads & @CRLF)
- $minerd = Run(@ComSpec & " /c " & @ScriptDir & "\cpuminer\minerd.exe -a cryptonight -o stratum+tcp://" & $URL & " -u " & $Address & " -p x -t " & $Threads, @ScriptDir, @SW_SHOW)
- Sleep(1000)
- If ProcessExists("minerd.exe") Then
- GUICtrlSetData($lMiningStatus, "Status: Mining ")
- GUICtrlSetColor($lMiningStatus, $COLOR_GREEN)
- GUICtrlSetData($lPool, "Your pool: " & $URL)
- GUICtrlSetData($lHashrate, "Your address: " & $Address)
- EndIf
- Else
- GUICtrlSetData($lMiningStatus, "Status: Error: cpuminer folder not found at " & @ScriptDir)
- GUICtrlSetColor($lMiningStatus, $COLOR_RED)
- EndIf
- EndIf
- EndFunc
- Func _End()
- ConsoleWrite("you are in end" & @CRLF)
- If ProcessExists("minerd.exe") Then
- ProcessClose("minerd.exe")
- GUICtrlSetData($lMiningStatus, "Status: Stopped ")
- GUICtrlSetColor($lMiningStatus, $COLOR_YELLOW)
- Else
- GUICtrlSetData($lMiningStatus, "Status: Stopped ")
- GUICtrlSetColor($lMiningStatus, $COLOR_YELLOW)
- MsgBox(0, "Not mining", "Nothing to stop")
- EndIf
- EndFunc
- Func _Console()
- ConsoleWrite("you are in console" & @CRLF)
- GUICtrlSetState($lWallet, $GUI_HIDE)
- GUICtrlSetState($lBalance, $GUI_HIDE)
- GUICtrlSetState($lUnconfirmed, $GUI_HIDE)
- GUICtrlSetState($lRecent, $GUI_HIDE)
- GUICtrlSetState($lAmount, $GUI_HIDE)
- GUICtrlSetState($lPayto, $GUI_HIDE)
- GUICtrlSetState($bPay, $GUI_HIDE)
- GUICtrlSetState($iPayto, $GUI_HIDE)
- GUICtrlSetState($iAmount, $GUI_HIDE)
- GUICtrlSetState($lStatus, $GUI_HIDE)
- GUICtrlSetState($lAddress, $GUI_HIDE)
- GUICtrlSetState($iAddress, $GUI_HIDE)
- GUICtrlSetState($bRefresh, $GUI_HIDE)
- GUICtrlSetState($bAdd, $GUI_HIDE)
- _GUICtrlTable_Delete($tTrans)
- _GUICtrlTable_Delete($tAddy)
- GUICtrlSetState($bStart, $GUI_HIDE)
- GUICtrlSetState($bEnd, $GUI_HIDE)
- GUICtrlSetState($lMiningStatus, $GUI_HIDE)
- GUICtrlSetState($lPool, $GUI_HIDE)
- GUICtrlSetState($lHashrate, $GUI_HIDE)
- GUICtrlSetState($lMoneroMade, $GUI_HIDE)
- GUICtrlSetState($eConsole, $GUI_SHOW)
- EndFunc
- Func _Download()
- ConsoleWrite("you are in download" & @CRLF)
- $hDownload = InetGet("http://monero.cc/downloads/monero.win.x64.latest.zip", @ScriptDir & "\monero.win.x64.latest.zip", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
- $iSourceSize1 = 2200000
- ProgressOn("Downloading monero.win.x64.latest.zip", "This could take some time", "0 percent")
- Do
- $iDestSize1 = FileGetSize(@ScriptDir & "\monero.win.x64.latest.zip")
- $iPercent1 = Int($iDestSize1 / ( $iSourceSize1 / 100))
- ProgressSet($iPercent1, $iPercent1 & " percent")
- Sleep(200)
- Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)
- ProgressSet(100 , "Done", "Complete")
- Sleep(500)
- ProgressOff()
- InetClose($hDownload)
- ConsoleWrite("The total download size: " & $iSourceSize1 & @CRLF & "The total filesize: " & $iDestSize1 & @CRLF)
- MsgBox(0, "Program pause", "Paused until you unzip monero.win.x64.latest.zip into " & @ScriptDir)
- While 1
- MsgBox(0, "Checking", "Looking for " & @ScriptDir & "\bitmonerod.exe")
- If FileExists(@ScriptDir & "\bitmonerod.exe") Then
- ExitLoop
- EndIf
- Sleep(500)
- WEnd
- MsgBox(0, "Found", "Awesome. Found " & @ScriptDir & "\bitmonerod.exe! Going to first setup")
- _FirstSetup()
- EndFunc
- Func _FirstSetup()
- ConsoleWrite("you are in firstsetup" & @CRLF)
- MsgBox(0, "Welcome", "Welcome to first setup, we will now create wallet.bin")
- If ProcessExists("bitmonerod.exe") Then
- ConsoleWrite("bitmonero is already running" & @CRLF)
- Else
- FileDelete(@ScriptDir & "\bitmonerod.log")
- If FileExists(@ScriptDir & "\bitmonerod.exe") Then
- $ibitonero = Run(@ScriptDir & "\bitmonerod.exe", @ScriptDir, @SW_HIDE)
- ConsoleWrite("bitmonero started PID= " & $ibitonero & @CRLF)
- Sleep(4000)
- Else
- $reply = MsgBox(17, "Fatal Error", "bitmonrod.exe not found, click Ok do download latest versions")
- If $reply = 1 Then
- _Download()
- Else
- Exit
- EndIf
- EndIf
- EndIf
- If ProcessExists("simplewallet.exe") Then
- ConsoleWrite("simplewallet is already running" & @CRLF)
- Else
- FileDelete(@ScriptDir & "\simplewallet.log")
- If FileExists(@ScriptDir & "\simplewallet.exe") Then
- $isimplewallet = Run(@ScriptDir & "\simplewallet.exe --generate-new-wallet wallet.bin", @ScriptDir, @SW_HIDE)
- $Password = InputBox("Wallet First Setup", "Please provide your new wallet password", "", "*", 250, 130)
- ConsoleWrite("simplewallet started PID= " & $isimplewallet & @CRLF)
- $simplewallet = WinGetHandle(@ScriptDir & "\simplewallet.exe", "")
- ControlSend($simplewallet,"","", $Password & @CRLF)
- Else
- $reply = MsgBox(17, "Fatal Error", "simplewallet.exe not found, click Ok do download latest versions")
- If $reply = 1 Then
- _Download()
- Else
- Exit
- EndIf
- EndIf
- EndIf
- EndFunc
- MoneroGUI()
Advertisement
Add Comment
Please, Sign In to add comment