HiNoTora Posted September 29, 2013 Share Posted September 29, 2013 Hi guys, i have script for Forex trade program, it works good, but my question is how i can turne my msgbox into 1 console like thing instead having popup notices all the time. and id love to if it stays ontop, MsgBox(4096, "AutoTrade started", "Press ESC to exit") HotKeySet("{ESC}", "Terminate") while 1 $coord = PixelSearch(17, 753, 37, 765, 0x90F393); wait till positive position MsgBox(4096, "AutoTrade started", "wait till positive position", 2) If Not @error Then MouseClick("left", 1265, 738, 1); closing position MsgBox(4096, "AutoTrade started", "closing position", 2) Sleep ( 3000 ) $coord = PixelSearch(214, 124, 249, 182, 0xFF6060); waiting for sale mark MsgBox(4096, "AutoTrade started", "waiting for sale mark", 2) If Not @error Then MouseClick("left", 306, 148, 1); opening new position MsgBox(4096, "AutoTrade started", "opening new position", 2) EndIf If @error Then Sleep ( 100 ) EndIf EndIf If @error Then Sleep ( 100 ) EndIf wend Func Terminate() Exit EndFunc Link to comment Share on other sites More sharing options...
Gianni Posted September 29, 2013 Share Posted September 29, 2013 if you are running your script from SciTE, then simply replace "MsgBox" MsgBOX(4096, "AutoTrade started", "wait till positive position", 2) with "ConsoleWrite" ConsoleWrite("AutoTrade started wait till positive position" & @crlf) bye Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
HiNoTora Posted September 29, 2013 Author Share Posted September 29, 2013 if you are running your script from SciTE, then simply replace "MsgBox" MsgBOX(4096, "AutoTrade started", "wait till positive position", 2) with "ConsoleWrite" ConsoleWrite("AutoTrade started wait till positive position" & @crlf) bye i want console to be stand alone, like msg box is, but it wont close, instead it keeps showing texts i have entered to autoit Link to comment Share on other sites More sharing options...
HiNoTora Posted September 29, 2013 Author Share Posted September 29, 2013 i want console to be stand alone, like msg box is, but it wont close, instead it keeps showing texts i have entered to autoit like selfextracting install programs are Link to comment Share on other sites More sharing options...
HiNoTora Posted September 29, 2013 Author Share Posted September 29, 2013 i want console to be stand alone, like msg box is, but it wont close, instead it keeps showing texts i have entered to autoit and if script done, id want to make it to exe for easy launch Link to comment Share on other sites More sharing options...
HiNoTora Posted September 29, 2013 Author Share Posted September 29, 2013 (edited) ConsoleWrite("AutoTrade started wait till positive position" & @crlf) i want console to be stand alone, like msg box is, but it wont close, instead it keeps showing texts i have entered to autoit and wit this code it keeps spamm cosole, there sold be like 10-15sec delay Edited September 29, 2013 by HiNoTora Link to comment Share on other sites More sharing options...
HiNoTora Posted September 29, 2013 Author Share Posted September 29, 2013 (edited) so heres new code. #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode GUICreate("Forex Runner By:NerfKitten", 350, 252) GUISetState(@SW_SHOW) GUICtrlCreateLabel("To Exit Press ESC", 20, 25) HotKeySet("{ESC}", "Terminate") while 1 $coord = PixelSearch(17, 753, 37, 765, 0x90F393); wait till positive position If Not @error Then MouseClick("left", 1265, 738, 1); closing position Sleep ( 3000 ) $coord = PixelSearch(214, 124, 249, 182, 0xFF6060); waiting for sale mark If Not @error Then MouseClick("left", 306, 148, 1); opening new position EndIf If @error Then Sleep ( 100 ) EndIf EndIf If @error Then Sleep ( 100 ) EndIf wend so id like to set console kind of thing ito this GUI Edited September 29, 2013 by HiNoTora Link to comment Share on other sites More sharing options...
Gianni Posted September 29, 2013 Share Posted September 29, 2013 you should create a window at the beginning of your script $MyGui = GUICreate("Console", 400, 100,-1,-1,Default,0x00000008) ; always on top $MyConsole = GUICtrlCreateEdit("" , 0, 0, 400, 100) GUISetState() a function to write in that window at the end of your script Func MyConsole($msg) GUICtrlSetData ($MyConsole,GUICtrlRead($MyConsole)&$msg & @CRLF) EndFunc and use the function to print in that window instead of MsgBox MyConsole("message") Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Solution sahsanu Posted September 29, 2013 Solution Share Posted September 29, 2013 Hi guys, i have script for Forex trade program, it works good, but my question is how i can turne my msgbox into 1 console like thing instead having popup notices all the time. and id love to if it stays ontop, I think you need something like this: expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <GUIEdit.au3> #include <ScrollBarConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUICloseOnESC", 1) Opt("GUIOnEventMode", 1) Global $hGUI = GUICreate("AutoTrade", 350, 400, -1, -1, -1, $WS_EX_TOPMOST) Global $hEdit = GUICtrlCreateEdit("", 0, 0, 350, 350, BitOR($ES_READONLY, $ES_AUTOVSCROLL)) GUICtrlSetBkColor($hEdit, 0xFFFFFF) Global $hButton = GUICtrlCreateButton("Start", 0, 350, 175, 50) GUICtrlSetOnEvent($hButton, "_StartProgram") Global $hButton2 = GUICtrlCreateButton("Pause", 175, 350, 175, 50) GUICtrlSetOnEvent($hButton2, "_PauseProgram") GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate") GUISetState(@SW_SHOW, $hGUI) Global $start = 0, $wait = 1 _WriteToEditBox("AutoTrade started. Press ESC or click X to exit") While 1 If $start = 1 Then _MainProgram() Sleep(100) wend Func _StartProgram() _WriteToEditBox("Starting program") $wait = 1 $start = 1 EndFunc ;==>_StartProgram Func _PauseProgram() _WriteToEditBox("Pausing program") $start = 0 EndFunc ;==>_Pauserogram Func _MainProgram() If $wait=1 Then _WriteToEditBox("Wait till positive position") $coord = PixelSearch(17, 753, 37, 765, 0x90F393); wait till positive position If Not @error Then $wait=1 _WriteToEditBox("Closing position") MouseClick("left", 1265, 738, 1); closing position _WriteToEditBox("Waiting for sale mark") Sleep(3000) $coord = PixelSearch(214, 124, 249, 182, 0xFF6060); waiting for sale mark If Not @error Then MouseClick("left", 306, 148, 1); opening new position _WriteToEditBox("Opening new position") EndIf Else $wait=0 Sleep(100) EndIf EndFunc ;==>_MainProgram Func _WriteToEditBox($sText) $iEnd = StringLen(GUICtrlRead($hEdit)) _GUICtrlEdit_SetSel($hEdit, $iEnd, $iEnd) _GUICtrlEdit_Scroll($hEdit, $SB_SCROLLCARET) If $iEnd = 0 Then GUICtrlSetData($hEdit, @HOUR & ":" & @MIN & ":" & @SEC & " :-: " & $sText, 1) Else GUICtrlSetData($hEdit, @CRLF & @HOUR & ":" & @MIN & ":" & @SEC & " :-: " & $sText, 1) EndIf EndFunc ;==>_WriteToEditBox Func Terminate() Exit EndFunc ;==>Terminate I'm pretty sure you will need to change several things but I think you have some start point to get what you are looking for. Cheers, sahsanu Link to comment Share on other sites More sharing options...
HiNoTora Posted September 29, 2013 Author Share Posted September 29, 2013 I think you need something like this: expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <GUIEdit.au3> #include <ScrollBarConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUICloseOnESC", 1) Opt("GUIOnEventMode", 1) Global $hGUI = GUICreate("AutoTrade", 350, 400, -1, -1, -1, $WS_EX_TOPMOST) Global $hEdit = GUICtrlCreateEdit("", 0, 0, 350, 350, BitOR($ES_READONLY, $ES_AUTOVSCROLL)) GUICtrlSetBkColor($hEdit, 0xFFFFFF) Global $hButton = GUICtrlCreateButton("Start", 0, 350, 175, 50) GUICtrlSetOnEvent($hButton, "_StartProgram") Global $hButton2 = GUICtrlCreateButton("Pause", 175, 350, 175, 50) GUICtrlSetOnEvent($hButton2, "_PauseProgram") GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate") GUISetState(@SW_SHOW, $hGUI) Global $start = 0, $wait = 1 _WriteToEditBox("AutoTrade started. Press ESC or click X to exit") While 1 If $start = 1 Then _MainProgram() Sleep(100) wend Func _StartProgram() _WriteToEditBox("Starting program") $wait = 1 $start = 1 EndFunc ;==>_StartProgram Func _PauseProgram() _WriteToEditBox("Pausing program") $start = 0 EndFunc ;==>_Pauserogram Func _MainProgram() If $wait=1 Then _WriteToEditBox("Wait till positive position") $coord = PixelSearch(17, 753, 37, 765, 0x90F393); wait till positive position If Not @error Then $wait=1 _WriteToEditBox("Closing position") MouseClick("left", 1265, 738, 1); closing position _WriteToEditBox("Waiting for sale mark") Sleep(3000) $coord = PixelSearch(214, 124, 249, 182, 0xFF6060); waiting for sale mark If Not @error Then MouseClick("left", 306, 148, 1); opening new position _WriteToEditBox("Opening new position") EndIf Else $wait=0 Sleep(100) EndIf EndFunc ;==>_MainProgram Func _WriteToEditBox($sText) $iEnd = StringLen(GUICtrlRead($hEdit)) _GUICtrlEdit_SetSel($hEdit, $iEnd, $iEnd) _GUICtrlEdit_Scroll($hEdit, $SB_SCROLLCARET) If $iEnd = 0 Then GUICtrlSetData($hEdit, @HOUR & ":" & @MIN & ":" & @SEC & " :-: " & $sText, 1) Else GUICtrlSetData($hEdit, @CRLF & @HOUR & ":" & @MIN & ":" & @SEC & " :-: " & $sText, 1) EndIf EndFunc ;==>_WriteToEditBox Func Terminate() Exit EndFunc ;==>Terminate I'm pretty sure you will need to change several things but I think you have some start point to get what you are looking for. Cheers, sahsanu Great thanks man. that looks promising, ill see what i can do with it. Need to wait til monday until forex are opend Link to comment Share on other sites More sharing options...
HiNoTora Posted September 29, 2013 Author Share Posted September 29, 2013 Great thanks man. that looks promising, ill see what i can do with it. Need to wait til monday until forex are opend one more thing Mind to share how i should add codes for change background color and fonts and font color? Its not necessary but would be bretyer with some design xD Link to comment Share on other sites More sharing options...
HiNoTora Posted September 29, 2013 Author Share Posted September 29, 2013 one more thing Mind to share how i should add codes for change background color and fonts and font color? Its not necessary but would be bretyer with some design xD ok, found myown from code for background. didnt pay attention first enought Link to comment Share on other sites More sharing options...
sahsanu Posted September 29, 2013 Share Posted September 29, 2013 Great thanks man. that looks promising, ill see what i can do with it. Need to wait til monday until forex are opend You are welcome ;-). Link to comment Share on other sites More sharing options...
Myicq Posted September 30, 2013 Share Posted September 30, 2013 Heh, game automation for adult business people But nice work. Thanks. I am just a hobby programmer, and nothing great to publish right now. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now