Jump to content
Sign in to follow this  
HiNoTora

Font change

Recommended Posts

HiNoTora

Hi guys can u show me where and how to add code to change fonts? color, text size

And at right side of my UI is empty area, thought to add there a MP3 player.. is that even possible? and playlist as well?

#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", 650, 400, -1, -1, -1, $WS_EX_TOPMOST)

Global $hEdit = GUICtrlCreateEdit("", 0, 0, 350, 350, BitOR($ES_READONLY, $ES_AUTOVSCROLL))
GUICtrlSetBkColor($hEdit, 0xFFe737)

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("Console")

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
Edited by HiNoTora

Share this post


Link to post
Share on other sites
HiNoTora

 

Hi guys can u show me where and how to add code to change fonts? color, text size

And at right side of my UI is empty area, thought to add there a MP3 player.. is that even possible? and playlist as well?

#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", 650, 400, -1, -1, -1, $WS_EX_TOPMOST)

Global $hEdit = GUICtrlCreateEdit("", 0, 0, 350, 350, BitOR($ES_READONLY, $ES_AUTOVSCROLL))
GUICtrlSetBkColor($hEdit, 0xFFe737)

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("Console")

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 have found 1 code for mp3 from google, How i can but those 2 together. And this mp3 player script starts with file open first. id like more to imposrt folder into player and at right side of my GUI top of it would be player and bottom of player would be list of songs imported and once double klicked song, it starts to play it.

#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <Sound.au3>
;by 1234hotmaster
Global $Fpath = FileOpenDialog("Select Audio file",@WorkingDir,"Sound Files(*.mp3;*.wav)|All Files(*.*)")
Global $Playing = False
Global $SoundHwnd
If Not @error Then $SoundHwnd = _SoundOpen($Fpath)
If Not @error Then
    $MPlayer = GUICreate("Music Player Sample", 243,40, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME), BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
    GUISetBkColor(0x000000)
    $BACK = GUICtrlCreateButton("<<", 44, 8, 35, 25, BitOR($BS_FLAT,$WS_BORDER))
    $STOP = GUICtrlCreateButton("[?¯]", 84, 8, 35, 25, BitOR($BS_FLAT,$WS_BORDER))
    GUICtrlSetFont(-1, 8, 400, 4, "Arial")
    $PLAYORPAUSE = GUICtrlCreateButton("l>", 124, 8, 35, 25, BitOR($BS_FLAT,$WS_BORDER))
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    GUICtrlSetTip(-1, "By 1234hotmaster")
    $FORWARD = GUICtrlCreateButton(">>", 164, 8, 35, 25, BitOR($BS_FLAT,$WS_BORDER))
    GUISetState(@SW_SHOW)
    _SoundPlay($SoundHwnd)
    $Playing = True
    GUICtrlSetData($PLAYORPAUSE,"||")
While 1
    Switch GUIGetMsg()
        Case -3
            _SoundClose($SoundHwnd)
            Exit
        Case $PLAYORPAUSE
            If Not $Playing Then
                _SoundPlay($SoundHwnd)
                GUICtrlSetData($PLAYORPAUSE,"||")
                $Playing = True
            ElseIf $Playing Then
                _SoundPause($SoundHwnd)
                GUICtrlSetData($PLAYORPAUSE,"l>")
                $Playing = False
            EndIf
        Case $BACK
            If $Playing Then
                $HMS = StringSplit(_SoundPos($SoundHwnd,1),":")
                If IsArray($HMS) Then
                    _SoundPause($SoundHwnd)
                    _SoundSeek($SoundHwnd,$HMS[1],$HMS[2],$HMS[3]-10)
                    _SoundPlay($SoundHwnd)
                EndIf
            EndIf
        Case $FORWARD
            If $Playing Then
                $HMS = StringSplit(_SoundPos($SoundHwnd,1),":")
                If IsArray($HMS) Then
                    _SoundPause($SoundHwnd)
                    _SoundSeek($SoundHwnd,$HMS[1],$HMS[2],$HMS[3]+10)
                    _SoundPlay($SoundHwnd)
                EndIf
            EndIf
        Case $STOP
            GUICtrlSetData($PLAYORPAUSE,"l>")
            _SoundStop($SoundHwnd)
EndSwitch
        WinSetTitle(WinGetHandle($MPlayer),"Music Player Sample",_SoundPos($SoundHwnd,1) & " / " & _SoundLength($SoundHwnd,1))
        If _SoundPos($SoundHwnd,1) >= _SoundLength($SoundHwnd,1) Then
            Sleep(500)
            _SoundPlay($SoundHwnd)
        EndIf
WEnd
EndIf

Share this post


Link to post
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
Sign in to follow this  

×