Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_icon=miner.ico
- #AutoIt3Wrapper_outfile=mINe.exe
- #AutoIt3Wrapper_UseX64=n
- #AutoIt3Wrapper_Res_Comment=For generating bitcoins in the Imagine Nation UO Pool
- #AutoIt3Wrapper_Res_Description=Automatially sets up the .bat and .exe files to mine @ Deepbit.net for IN-UO
- #AutoIt3Wrapper_Res_Fileversion=1.0.0.6
- #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
- #AutoIt3Wrapper_Res_LegalCopyright=eru@in-uo.com
- #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
- #cs ----------------------------------------------------------------------------
- AutoIt Version: 3.3.6.1
- Author: myName
- Script Function:
- Template AutoIt script.
- #ce ----------------------------------------------------------------------------
- ; Script Start - Add your code below here
- #include <GUIConstantsEX.au3>
- #include <WindowsConstants.au3>
- #include <Constants.au3>
- AutoItSetOption("TrayAutoPause",0)
- AutoItSetOption("TrayMenuMode",1)
- AutoItSetOption("TrayOnEventMode",1)
- TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN,"Toggle")
- TraySetState()
- Global $SourcePath = "C:\Users\Eremite\Dropbox\Imagine Nation\mining\"
- Global $BatFile = @TempDir & "\mINe.bat"
- Global $GUIStyle = BitOr($WS_POPUP,$WS_MINIMIZEBOX)
- Global $Running = False, $Minimized = False
- Global $IniFile = @ScriptDir & "\Settings.ini"
- $GUI = GUICreate("mINer",200,100,-1,-1,$GUIStyle,0x00000008)
- GUISetBkColor(0x000000,$GUI)
- FileInstall("C:\Users\Eremite\Dropbox\Imagine Nation\mining\inlogo.gif",@TempDir & "\inlogo.gif")
- GUICtrlCreatePic(@TempDir & "\inlogo.gif",147,10,53,53,-1,0x00100000)
- $INLabel = GUICtrlCreateLabel("Imagine Nation",1,1,135,20)
- GUICtrlSetColor($INLabel,0xF5EC95)
- GUICtrlSetFont($INLabel,14,1000,-1,"Lucida")
- $WorkerStatus = GUICtrlCreateLabel("Updating Worker Stats",1,21,147,12)
- GUICtrlSetColor($WorkerStatus,0xF5EC95)
- $PayoutStatus = GUICtrlCreateLabel("Updating Payout Stats",1,33,147,12)
- GUICtrlSetColor($PayoutStatus,0xF5EC95)
- $HSpacer = GUICtrlCreateLabel("",1,46,147,3)
- GUICtrlSetBkColor($HSpacer,0xF5EC95)
- $GPUCPU = GUICtrlCreateRadio("",1,51,12,12)
- $CPUGPULabel = GUICtrlCreateLabel("GPU+CPU",15,50,57,12)
- GUICtrlSetColor($CPUGPULabel,0xF5EC95)
- $GPUOnly = GUICtrlCreateRadio("",1,63,12,12)
- $GPUOnlyLabel = GUICtrlCreateLabel("GPU Only",15,62,57,12)
- GUICtrlSetColor($GPUOnlyLabel,0xF5EC95)
- $CPUOnly = GUICtrlCreateRadio("",1,75,12,12)
- $CPUOnlyLabel = GUICtrlCreateLabel("CPU Only",15,74,57,12)
- GUICtrlSetColor($CPUOnlyLabel,0xF5EC95)
- $CPUCoreLabel1 = GUICtrlCreateLabel("Use",1,87,18,12)
- GUICtrlSetColor($CPUCoreLabel1,0xF5EC95)
- $CPUCores = GUICtrlCreateInput(IniRead($IniFile,"Settings","CPUCores",""),20,85,22,15)
- GUICtrlSetColor($CPUCores,0x000000)
- GUICtrlSetBkColor($CPUCores,0xF5EC95)
- $CPUCoreLabel2 = GUICtrlCreateLabel("cores",42,87,25,12)
- GUICtrlSetColor($CPUCoreLabel2,0xF5EC95)
- $VSpace = GUICtrlCreateLabel("",78,49,3,50)
- GUICtrlSetBkColor($VSpace,0xF5EC95)
- $MiningStart = GUICtrlCreateButton("mINe",83,51,67,30)
- GUICtrlSetColor($MiningStart,0x000000)
- GUICtrlSetBkColor($MiningStart,0xF5EC95)
- $Hidden = GUICtrlCreateCheckbox("",83,81,15,19)
- $HiddenLabel = GUICtrlCreateLabel("Hidden",98,83,52,19)
- GUICtrlSetColor($HiddenLabel,0xF5EC95)
- $User = GUICtrlCreateInput(IniRead($IniFile,"Settings","User","anon"),150,61,47,18)
- GUICtrlSetBkColor($User,0xF5EC95)
- GUICtrlSetColor($User,0x000000)
- $Help = GUICtrlCreateButton("Help",150,80,50,20)
- GUICtrlSetBkColor($Help,0xF5EC95)
- GUICtrlSetColor($Help,0x000000)
- $Exit = GUICtrlCreateButton("X",185,0,15,10)
- GUICtrlSetBkColor($Exit,0xF5EC95)
- GUICtrlSetColor($Exit,0x000000)
- $Minimize = GUICtrlCreateButton("-",170,0,15,10)
- GUICtrlSetColor($Minimize,0x000000)
- GUICtrlSetBkColor($Minimize,0xF5EC95)
- $Mode = IniRead($IniFile,"Settings","Mode","GPUCPU")
- If $Mode = "GPUCPU" Then
- GUICtrlSetState($GPUCPU,$GUI_Checked)
- ElseIf $Mode = "GPUOnly" Then
- GUICtrlSetState($GPUOnly,$GUI_Checked)
- Else
- GUICtrlSetState($CPUOnly,$GUI_Checked)
- EndIf
- If IniRead($IniFile,"Settings","Hidden","False") = "True" Then GUICtrlSetState($Hidden,$GUI_Checked)
- If ProcessExists("bitcoin-miner.exe") Then
- GUICtrlSetData($MiningStart,"STOP")
- $Running = True
- EndIf
- GUISetState(@SW_SHOW)
- $Update = Timerinit()
- UpdateStats()
- While 1
- $Msg = GUIGetMsg()
- Select
- Case $Msg = $GUI_Event_Close Or $Msg = $Exit
- IniWrite($IniFile,"Settings","User",GUICtrlRead($User))
- If GUICtrlRead($GPUCPU) = 1 Then $Mode = "GPUCPU"
- If GUICtrlRead($GPUOnly) = 1 Then $Mode = "GPUOnly"
- If GUICtrlRead($CPUOnly) = 1 Then $Mode = "CPUOnly"
- IniWrite($IniFile,"Settings","Mode",$Mode)
- If GUICtrlRead($Hidden) = 1 Then
- IniWrite($IniFile,"Settings","Hidden","True")
- Else
- IniWrite($IniFile,"Settings","Hidden","False")
- EndIf
- IniWrite($IniFile,"Settings","CPUCores",GUICtrlRead($CPUCores))
- Exit
- Case $Msg = $Minimize
- GUISetState(@SW_HIDE,$GUI)
- Case $Msg = $MiningStart
- If $Running = False Then
- StartMiner()
- Else
- StopMiner()
- EndIf
- Case $Msg = $Help
- MsgBox(0,"What do?!","This will automatically create the batch file and add the programs you need to start mining. Files are placed in the %temp% directory and are overwritten every time you start the program." & @CRLF & @CRLF & _
- "Select whether you want to use CPU, GPU or both on the left. GPU gives much higher returns usually." & @CRLF & "If you are using CPU, you can set the number of cores to use at the bottom left." & @CRLF & _
- "If you check the 'Hidden' checkbox, then it will run the miner in the background without a console window." & @CRLF & @CRLF & "Enter your miner's username in the right-hand side above help." & @CRLF & _
- "If you don't have a username, PM Eru on the forums to get one added." & @CRLF & @CRLF & "Once everything is configured, press the 'mINe' button to start, then 'STOP' to quit mining." & @CRLF & @CRLF & _
- "Stats are displayed at the top of the screen and update once per minute." & @CRLF & @CRLF & " Happy Mining!" & @CRLF & " -eru")
- EndSelect
- Sleep(100)
- If TimerDiff($Update) > 60000 Then UpdateStats()
- WEnd
- Func StartMiner() ; active = 1 inactive = 4
- FileInstall("C:\Users\Eremite\Dropbox\Imagine Nation\mining\bitcoin-miner.exe",@TempDir & "\bitcoin-miner.exe")
- FileDelete($BatFile)
- Local $Variables = '-a 5 -o http://[email protected]_' & GUICtrlRead($User) & ':[email protected]:8332'
- If GUICtrlRead($GPUCPU) = 1 And GUICtrlRead($CPUCores) <> "" Then $Variables = $Variables & " -t " & GUICtrlread($CPUCores)
- If GUICtrlRead($CPUOnly) = 1 Then
- $Variables = $Variables & " -g no"
- If GUICtrlRead($CPUCores) <> "" Then
- $Variables = $Variables & " -t " & GUICtrlRead($CPUCores)
- EndIf
- EndIf
- If GUICtrlRead($GPUOnly) = 1 Then $Variables = $Variables & " -t 0"
- If GUICtrlRead($Hidden) = 1 Then
- FileInstall("C:\Users\Eremite\Dropbox\Imagine Nation\mining\hide.exe",@TempDir & "\hide.exe")
- FileWrite($BatFile,'start /D "' & @TempDir & '\" hide "' & @TempDir & '\bitcoin-miner.exe ' & $Variables & '"')
- Else
- FileWrite($BatFile,'start /D "' & @TempDir & '\" bitcoin-miner.exe ' & $Variables)
- EndIf
- ShellExecute($BatFile)
- GUICtrlSetData($MiningStart,"STOP")
- $Running = True
- EndFunc
- Func StopMiner()
- Do
- ProcessClose("bitcoin-miner.exe")
- Sleep(500)
- Until Not ProcessExists("bitcoin-miner.exe")
- GUICtrlSetData($MiningStart,"mINe")
- $Running = False
- EndFunc
- Func Toggle()
- If $Minimized = False Then
- GUISetState(@SW_HIDE,$GUI)
- $Minimized = True
- Else
- GUISetState(@SW_SHOW,$GUI)
- $Minimized = False
- EndIf
- EndFunc
- Func UpdateStats()
- $JSON = GetJSON()
- $TotalReward = StringRegExpReplace($JSON,'{"confirmed_reward":([0-9]*\.[0-9]*).*',"$1")
- $TotalPayouts = StringRegExpReplace($JSON,'.*,"payout_history":(.*),"workers":.*',"$1")
- $HashRate = StringRegExpReplace($JSON,'.*hashrate":(.*),"ipa":.*',"$1")
- $JSON = StringRegExpReplace($JSON,'{"confirmed.*workers":{(.*)}}',",$1")
- Global $TotalWorkers = StringSplit($JSON,"|")
- Global $ActiveWorkers = 0
- For $i = 1 To UBound($TotalWorkers) - 1 Step 1
- If StringRegExpReplace($TotalWorkers[$i],'.*{"alive":(.*),"shares.*}',"$1") = "true" Then $ActiveWorkers = $ActiveWorkers + 1
- Next
- GUICtrlSetData($WorkerStatus,$ActiveWorkers & "/" & $TotalWorkers[0] & " @ " & $HashRate & " Mhash/s")
- GUICtrlSetData($PayoutStatus,"Gen:"& StringTrimRight($TotalReward,4) & " -=- Paid" & $TotalPayouts)
- $Update = Timerinit()
- EndFunc
- Func GetJSON()
- InetGet("http://deepbit.net/api/4e9b6b9b06917228d7000000_667F4B01C3",@TempDir & "\JSON.txt",1)
- Local $Return = FileReadLine(@TempDir & "\JSON.txt",1)
- FileDelete(@TempDir & "\JSON.txt")
- Return $Return
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment