Jump to content

Piano AutoPlayer !!


Alshaikh
 Share

Recommended Posts

Hello.

Piano Auto Player

This script repeat a previous instructions!

I wrote this just for fun !!

Steps:-

1) Open virtualpiano.net

2) Wait for it to be ready.

3) Run Piano AutoPlayer then activate your browser

4) Let it play !!!

;Piano Auto Player is working on virtualpiano.net
;Piano Auto Player made by : Ahmad Alshaikh -- Just for fun

;========== Examples ==============================
;--- A. L. Webber - Memory------------------------
;Letters by :Giianlux (Youtube Acount)
;YouTube Link for original Vid : http://w ww.youtube.com/watch?v=dI5D5khur70
;Converted to Piano Auto Player syntax By Ahmad Alshaikh
$1 = ':1s:1.6s:1a:2.7s:2.7d:2.7s:2.6p:1{us}:1.3{us}:1a:2.7s:2.7d:2.7s:2.6p:1.4{tp}:1.2{tp}:1i:2.7o:2.7p:2.7o:2.6i:2.3{wu}:1u:2.4o:3{eo}:1y:1.8u:2.4{iy}:1.7o:1{yip}:2.4a:2.4{us}:2.4{ua}:2.4p:2.4o:1{uo}:2.4u:2.4u:2.4t:2.4{ro}:1e:2.4e:2.4r:2.4t:1w:2.4u'
$1 &= $1
;--------------------------------------------------

_AttMessage()
_PianoPlay($1)



#Include <Misc.au3>
;===============================================================================
;
; Function Name:    _PianoPlay
; Description::     Play directions for virtualpiano.net
; Parameter(s):     Piece (string)
;                   Piece is tow things:
;                       1) Keys : There are tou kinds of keys
;                           One key: Just write it (eg: s )  , Note: s is Not S !!
;                           Many keys : If you want to click many keys at one time wrate it into a {} (eg: {sfw} )
;                       2) Time : it's a numbers placed after : (eg:  :5 or :1.6 )
;                           Note : Time is (1/number) so , half second is 2
;                           Note : You can write numbers with one number after Decimal point , whatever 1.2 is okay but 1.23 is not .
;                           To rest:
;                               1 second    = :1
;                               2 seconds   = :0.5
;                               1/2 second  = :2
;                               1/5.4 second= :5.4
; Example:          s:2.6p:1{us}:1.3{us}:1a
; Attention:        This UDF is sending a keyboard letter please don't activate any thing before It ends or you exit.
; Note:             Press 1B to exit at any time
; Requirement(s):   Intetnet Connection !! and access to virtualpiano.net
; Author(s):        Ahmad Alshaikh
;
;===============================================================================
;
Func _PianoPlay($Piece)
    $SS = StringSplit($Piece, '')
    $ChrN = 0
    Do

        $T = 0
        $ChrN += 1
        If $SS[$ChrN] = ':' Then
            $ChrN += 1
            If $SS[$ChrN + 1] = '.' Then
                $T = _PrsTime($SS[$ChrN] & $SS[$ChrN + 1] & $SS[$ChrN + 2])
                $ChrN += 2
            Else
                $T = _PrsTime($SS[$ChrN])
            EndIf
            $ChrN += 1
        EndIf
        If _IsPressed('1B') Then Exit
        If $SS[$ChrN] = '{' Then
            $SS1 = StringSplit(StringTrimLeft($Piece, $ChrN - 1), '')
            $y = 0
            $Key = ''
            Do
                If _IsPressed('1B') Then Exit
                $y += 1
                If $SS1[$y] = '{' Then
                    ContinueLoop
                ElseIf $SS1[$y] = '}' Then
                    ExitLoop
                Else
                    $Key &= $SS1[$y]
                EndIf
            Until $y = UBound($SS1) - 1
            $ChrN += $y - 1
        Else
            $Key = $SS[$ChrN]
        EndIf
        _PianoSend(($T, $Key)
        If _IsPressed('1B') Then Exit
    Until $ChrN = UBound($SS) - 1
EndFunc   ;==>_PianoPlay
Func _AttMessage()
    MsgBox (64,'','Please open virtualpiano.net at your browser and wait to get ready.')
    SplashTextOn ( "Piano Automation", "You have a 3 seconds to activate browser window" ,Default,50)
    Sleep(1000)
    SplashTextOn ( "Piano Automation", "You have a 2 seconds to activate browser window" ,Default,50)
    Sleep(1000)
    SplashTextOn ( "Piano Automation", "You have a 1 second to activate browser window" ,Default,50)
    Sleep(1000)
    SplashOff()
EndFunc
Func _PianoSend($TimeMS, $Key)
    Local $SS
    Sleep($TimeMS)
    Send($Key)
EndFunc   ;==>_SentTime

Func _PrsTime($N)
    Return Round(1 / Number($N) * 1000, 0)
EndFunc   ;==>_PrsTime

Let me know your impression :huh2:

Thank you

Alshaikh

Link to comment
Share on other sites

at: http://www.virtualpiano.net/

Service Unavailable

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

Very nice. a couple of suggestions, with rough implementations of...

1) test for the window being active rather than a countdown

opt ("wintitlematchmode" , 2)

_test()

Func _test()

If winactive("Virtual Piano") Then
_PianoPlay($1)
Else
    sleep (50)
    _test()
Endif

EndFunc

2) prevents the script from writing text all over my editor when i click back over without a 1B, maybe just a character or two gets thrown over before it exits

If _IsPressed('1B') or not winactive("Virtual Piano") Then Exit

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Maffe811

This happens sometimes because of the large number of visitors

Wait a bit, then refresh the page and you will reach

I refreshed the page 5 times, no luck.

But I'll try now! :-)

Edit:

Line 81:

_PianoSend(($T, $Key)
one too many paranthesises...

Other than that, great work!

Nice melody.

You should make some sort of creation program.

But keyloggers arent allowed on the forum so i dont know what you could do...

Edited by Maffe811

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

Thanks guys !

Now, It will detect the window

New script :

;Piano Auto Player is working on virtualpiano.net
;Piano Auto Player made by : Ahmad Alshaikh -- Just for fun
;Detect window function by: iamtheky
;       Thank you iamtheky

;========== Examples ==============================
;--- A. L. Webber - Memory ------------------------
;Letters by :Giianlux (Youtube Acount)
;YouTube Link for original Vid : http://w ww.youtube.com/watch?v=dI5D5khur70
;Converted to Piano Auto Player syntax By Ahmad Alshaikh
$1 = ':1s:1.4s:1a:2.7s:2.7d:2.7s:2.6p:1.5{us}:1.3{us}:1.2a:2.7s:2.7d:2.7s:2.6p:1.4{tp}:1.2{tp}:1i:2.7o:2.7p:2.7o:2.6i:2.3{wu}:1u:2.4o:3{eo}:1y:1.8u:2.4{iy}:1.7o:1{yip}:2.4a:2.4{us}:2.4{ua}:2.4p:2.4o:1{uo}:2.4u:2.4u:2.4t:2.4{ro}:1e:2.4e:2.4r:2.4t:1w:2.4u'
$1 &= $1
;--------------------------------------------------
;------------- Some Of Für Elise ------------------
;Letters by : virtualpiano.net
$2 ='f:2.8D:2.8f:2.8D:2.8f:2.8a:2.8d:2.8s:2.8p:1.5t:2.8u:2.8p:2.8a:1.5u:2.8O:2.8a:2.8s:1.5u:2.8f:2.8D:2.8f:2.8D:2.8f:2.8a:2.8d:2.8s:2.8p:1.5t:2.8u:2.8p:2.8a:1.5u:2.8s:2.8a:2.8p:1.5a:2.8s:2.8d:2.8f:1.5o:2.8g:2.8f:2.8d:1.5i:2.8f:2.8d:2.8s:1.5u:2.8d:2.8s:2.8a u:2.8f:2.8u:2.8f:2.8f:2.8x:2.8D:2.8f:2.8D:2.8f:2.8D:2.8f:2.8D:2.8f:2.8D:2.8f:2.8D:2.8f:2.8a:2.8d:2.8s:2.8p:1.5t:2.8u:2.8p:2.8a:1.5u:2.8O:2.8a:2.8s:1.5u:2.8f:2.8D:2.8f:2.8D:2.8f:2.8a:2.8d:2.8s:2.8p:1.5t:2.8u:2.8p:2.8a:1.5u:2.8s:2.8a:2.8p'
;--------------------------------------------------
;----------------- The Godfather ------------------
;Letters by : virtualpiano.net
$3 = 'o:2.4s:2.4D:2.4d:2.4s:2.4D:2.4s:2.4d:2.4s:2.4O:2.4P:2.4o:1o:2.4s:2.4D:2.4d:2.4s:2.4D:2.4s:2.4d:2.4s:2.4o:2.4I:2.4i:1i:2.4O:2.4a:2.4d:1i:2.4O:2.4a:2.4s:1t:2.4Y:2.4P:2.4O:2.4o:2.4P:2.4O:2.4O:2.4o:2.4o:2.4r:2.4t:1s:2.4s:2.4a:2.4P:2.4d:2.4s:2.4O:2.4o:1o:2.4P:2.4o:2.4i:1i:2.4O:2.4i:2.4o:1P:2.4o:2.4s:2.4D:2.4d:2.4s:2.4D:2.4s:2.4d:2.4s:2.4O:2.4P:2.4o:1o:2.4s:2.4D:2.4d:2.4s:2.4D:2.4s:2.4d:2.4s:2.4o:2.4I:2.4i:1s:2.4s:2.4a:2.4P:2.4d:2.4s:2.4O:2.4o:1t:2.4Y:2.4P:2.4O:2.4o:2.4P:2.4O:2.4O:2.4o:2.4o:2.4r:2.4t:1'
;--------------------------------------------------
Opt("wintitlematchmode", 2)

_Run($2)

Func _Run($p)
    While 1
        Sleep(50)
        If _IsPressed('1B') Then Exit
        If WinActive("Virtual Piano")  Then ExitLoop
    WEnd
    _PianoPlay($p)
EndFunc   ;==>_Run


#include <Misc.au3>
;===============================================================================
;
; Function Name:    _PianoPlay
; Description::     Play directions for virtualpiano.net
; Parameter(s):     Piece (string)
;                   Piece is tow things:
;                       1) Keys : There are tou kinds of keys
;                           One key: Just write it (eg: s )  , Note: s is Not S !!
;                           Many keys : If you want to click many keys at one time wrate it into a {} (eg: {sfw} )
;                       2) Time : it's a numbers placed after : (eg:  :5 or :1.6 )
;                           Note : Time is (1/number) so , half second is 2
;                           Note : You can write numbers with one number after Decimal point , whatever 1.2 is okay but 1.23 is not .
;                           To rest:
;                               1 second    = :1
;                               2 seconds   = :0.5
;                               1/2 second  = :2
;                               1/5.4 second= :5.4
; Example:          s:2.6p:1{us}:1.3{us}:1a
; Note:             Press 1B to exit at any time
; Requirement(s):   Intetnet Connection !! and access to virtualpiano.net
; Author(s):        Ahmad Alshaikh
;
;===============================================================================
;
Func _PianoPlay($Piece)
    $SS = StringSplit($Piece, '')
    $ChrN = 0
    Do

        $T = 0
        $ChrN += 1
        If $SS[$ChrN] = ':' Then
            $ChrN += 1
            If $SS[$ChrN + 1] = '.' Then
                $T = _PrsTime($SS[$ChrN] & $SS[$ChrN + 1] & $SS[$ChrN + 2])
                $ChrN += 2
            Else
                $T = _PrsTime($SS[$ChrN])
            EndIf
            $ChrN += 1
        EndIf
        If _IsPressed('1B') Or Not WinActive("Virtual Piano")  Then Exit
        If $SS[$ChrN] = '{' Then
            $SS1 = StringSplit(StringTrimLeft($Piece, $ChrN - 1), '')
            $y = 0
            $Key = ''
            Do
                If _IsPressed('1B') Or Not WinActive("Virtual Piano") Then Exit
                $y += 1
                If $SS1[$y] = '{' Then
                    ContinueLoop
                ElseIf $SS1[$y] = '}' Then
                    ExitLoop
                Else
                    $Key &= $SS1[$y]
                EndIf
            Until $y = UBound($SS1) - 1
            $ChrN += $y - 1

        Else
            $Key = $SS[$ChrN]
        EndIf
        _PianoSend($T, $Key)
        If _IsPressed('1B') Or Not WinActive("Virtual Piano") Then Exit
    Until $ChrN = UBound($SS) - 1
EndFunc   ;==>_PianoPlay
Func _PianoSend($TimeMS, $Key)
    Local $SS
    Sleep($TimeMS)
    Send($Key)
EndFunc   ;==>_PianoSend

Func _PrsTime($N)
    Return Round(1 / Number($N) * 1000, 0)
EndFunc   ;==>_PrsTime
Edited by Alshaikh
Link to comment
Share on other sites

  • 1 year later...
  • 3 years later...

So, is this some sort of download possibly? 'Cause I'm looking for an Autoplayer for the piano just so I can enjoy some piano music once my fingers get tired of pressing keys for an hour. If it is a type of download or something, I'd kind of like to have it and use it.

Link to comment
Share on other sites

  • 2 months later...
  • 6 months later...

If notepad is your browser of choice, then sure copy and paste links in there.  But I would like to watch you when you are computering.

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Oh you don't mean the link, you meant the script.  Go up top to 'autoit resources' --> 'release' and download all that stuff.  Then maybe hit up the Autoit 1-2-3 thread.  you should be pro in about 30-45min

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

  • 5 months later...
  • 4 weeks later...
On 12/31/2016 at 9:47 AM, iamtheky said:

If notepad is your browser of choice, then sure copy and paste links in there.  But I would like to watch you when you are computering.

 

On 6/12/2011 at 6:19 AM, Alshaikh said:

Thanks guys !

Now, It will detect the window

New script :

 

;Piano Auto Player is working on virtualpiano.net
;Piano Auto Player made by : Ahmad Alshaikh -- Just for fun
;Detect window function by: iamtheky
;       Thank you iamtheky

;========== Examples ==============================
;--- A. L. Webber - Memory ------------------------
;Letters by :Giianlux (Youtube Acount)
;YouTube Link for original Vid : http://w ww.youtube.com/watch?v=dI5D5khur70
;Converted to Piano Auto Player syntax By Ahmad Alshaikh
$1 = ':1s:1.4s:1a:2.7s:2.7d:2.7s:2.6p:1.5{us}:1.3{us}:1.2a:2.7s:2.7d:2.7s:2.6p:1.4{tp}:1.2{tp}:1i:2.7o:2.7p:2.7o:2.6i:2.3{wu}:1u:2.4o:3{eo}:1y:1.8u:2.4{iy}:1.7o:1{yip}:2.4a:2.4{us}:2.4{ua}:2.4p:2.4o:1{uo}:2.4u:2.4u:2.4t:2.4{ro}:1e:2.4e:2.4r:2.4t:1w:2.4u'
$1 &= $1
;--------------------------------------------------
;------------- Some Of Für Elise ------------------
;Letters by : virtualpiano.net
$2 ='f:2.8D:2.8f:2.8D:2.8f:2.8a:2.8d:2.8s:2.8p:1.5t:2.8u:2.8p:2.8a:1.5u:2.8O:2.8a:2.8s:1.5u:2.8f:2.8D:2.8f:2.8D:2.8f:2.8a:2.8d:2.8s:2.8p:1.5t:2.8u:2.8p:2.8a:1.5u:2.8s:2.8a:2.8p:1.5a:2.8s:2.8d:2.8f:1.5o:2.8g:2.8f:2.8d:1.5i:2.8f:2.8d:2.8s:1.5u:2.8d:2.8s:2.8a u:2.8f:2.8u:2.8f:2.8f:2.8x:2.8D:2.8f:2.8D:2.8f:2.8D:2.8f:2.8D:2.8f:2.8D:2.8f:2.8D:2.8f:2.8a:2.8d:2.8s:2.8p:1.5t:2.8u:2.8p:2.8a:1.5u:2.8O:2.8a:2.8s:1.5u:2.8f:2.8D:2.8f:2.8D:2.8f:2.8a:2.8d:2.8s:2.8p:1.5t:2.8u:2.8p:2.8a:1.5u:2.8s:2.8a:2.8p'
;--------------------------------------------------
;----------------- The Godfather ------------------
;Letters by : virtualpiano.net
$3 = 'o:2.4s:2.4D:2.4d:2.4s:2.4D:2.4s:2.4d:2.4s:2.4O:2.4P:2.4o:1o:2.4s:2.4D:2.4d:2.4s:2.4D:2.4s:2.4d:2.4s:2.4o:2.4I:2.4i:1i:2.4O:2.4a:2.4d:1i:2.4O:2.4a:2.4s:1t:2.4Y:2.4P:2.4O:2.4o:2.4P:2.4O:2.4O:2.4o:2.4o:2.4r:2.4t:1s:2.4s:2.4a:2.4P:2.4d:2.4s:2.4O:2.4o:1o:2.4P:2.4o:2.4i:1i:2.4O:2.4i:2.4o:1P:2.4o:2.4s:2.4D:2.4d:2.4s:2.4D:2.4s:2.4d:2.4s:2.4O:2.4P:2.4o:1o:2.4s:2.4D:2.4d:2.4s:2.4D:2.4s:2.4d:2.4s:2.4o:2.4I:2.4i:1s:2.4s:2.4a:2.4P:2.4d:2.4s:2.4O:2.4o:1t:2.4Y:2.4P:2.4O:2.4o:2.4P:2.4O:2.4O:2.4o:2.4o:2.4r:2.4t:1'
;--------------------------------------------------
Opt("wintitlematchmode", 2)

_Run($2)

Func _Run($p)
    While 1
        Sleep(50)
        If _IsPressed('1B') Then Exit
        If WinActive("Virtual Piano")  Then ExitLoop
    WEnd
    _PianoPlay($p)
EndFunc   ;==>_Run


#include <Misc.au3>
;===============================================================================
;
; Function Name:    _PianoPlay
; Description::     Play directions for virtualpiano.net
; Parameter(s):     Piece (string)
;                   Piece is tow things:
;                       1) Keys : There are tou kinds of keys
;                           One key: Just write it (eg: s )  , Note: s is Not S !!
;                           Many keys : If you want to click many keys at one time wrate it into a {} (eg: {sfw} )
;                       2) Time : it's a numbers placed after : (eg:  :5 or :1.6 )
;                           Note : Time is (1/number) so , half second is 2
;                           Note : You can write numbers with one number after Decimal point , whatever 1.2 is okay but 1.23 is not .
;                           To rest:
;                               1 second    = :1
;                               2 seconds   = :0.5
;                               1/2 second  = :2
;                               1/5.4 second= :5.4
; Example:          s:2.6p:1{us}:1.3{us}:1a
; Note:             Press 1B to exit at any time
; Requirement(s):   Intetnet Connection !! and access to virtualpiano.net
; Author(s):        Ahmad Alshaikh
;
;===============================================================================
;
Func _PianoPlay($Piece)
    $SS = StringSplit($Piece, '')
    $ChrN = 0
    Do

        $T = 0
        $ChrN += 1
        If $SS[$ChrN] = ':' Then
            $ChrN += 1
            If $SS[$ChrN + 1] = '.' Then
                $T = _PrsTime($SS[$ChrN] & $SS[$ChrN + 1] & $SS[$ChrN + 2])
                $ChrN += 2
            Else
                $T = _PrsTime($SS[$ChrN])
            EndIf
            $ChrN += 1
        EndIf
        If _IsPressed('1B') Or Not WinActive("Virtual Piano")  Then Exit
        If $SS[$ChrN] = '{' Then
            $SS1 = StringSplit(StringTrimLeft($Piece, $ChrN - 1), '')
            $y = 0
            $Key = ''
            Do
                If _IsPressed('1B') Or Not WinActive("Virtual Piano") Then Exit
                $y += 1
                If $SS1[$y] = '{' Then
                    ContinueLoop
                ElseIf $SS1[$y] = '}' Then
                    ExitLoop
                Else
                    $Key &= $SS1[$y]
                EndIf
            Until $y = UBound($SS1) - 1
            $ChrN += $y - 1

        Else
            $Key = $SS[$ChrN]
        EndIf
        _PianoSend($T, $Key)
        If _IsPressed('1B') Or Not WinActive("Virtual Piano") Then Exit
    Until $ChrN = UBound($SS) - 1
EndFunc   ;==>_PianoPlay
Func _PianoSend($TimeMS, $Key)
    Local $SS
    Sleep($TimeMS)
    Send($Key)
EndFunc   ;==>_PianoSend

Func _PrsTime($N)
    Return Round(1 / Number($N) * 1000, 0)
EndFunc   ;==>_PrsTime

Theme of Love.txt Hey guys, I converted "Theme of Love" by Nobuo Uematsu but it's quite long, go to the bottom for the raw paste.

Link to comment
Share on other sites

On 6/17/2016 at 10:07 AM, deving676 said:

Please do add me on skype and help me on how to use this, My skype is the same as my username (deving676)

You use it by downloading AutoIt, then opening Scite and copying and pasting this into there, then you follow the instructions on the script.

Link to comment
Share on other sites

  • 6 years later...

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...