Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 07:05

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Colourbot der Sounddatei abspielt.

Discussion on Colourbot der Sounddatei abspielt. within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2008
Posts: 86
Received Thanks: 29
Colourbot der Sounddatei abspielt.

Hi,
wollte mir eigentlich nur nen kleinen Colourbot skripten, der während er die ganze Zeit Leertaste und X drückt einen Bereich nach der Farbei weiß (0xFFFFFF) absucht. Er sollte bei erfolgreichen Fund die Schleife verlassen und eine Sounddatei die sich unter C:\media\sound.wav befindet abspielen.

Hier mein Skript:

Quote:
HotKeySet("{insert}", "_start")
HotKeySet("{delete}", "_stop")
HotKeySet("{end}", "_ende")
HotKeySet("{F8}", "OL")
HotKeySet("{F9}", "UR")

Global $OL
Global $UR


While 1
Sleep(1000)
WEnd



Func OL()
$OL = MouseGetPos()
EndFunc

Func UR()
$UR = MouseGetPos()
EndFunc


Func _start()
Local $pic
While 1
Send("{Space}")
Sleep(250)
Send("x")
$pic = PixelSearch($OL[0], $OL[1], $UR[0], $UR[1], 0xFFFFFF, 5, 1)
If IsArray($pic) Then
ExitLoop
_stop()
; Hier soll der Sound, der sich unter C:\media\sound.wav befindet abgespielt werden
Else
EndIf
WEnd
EndFunc

Func _stop()
While 1
Sleep(1000)
WEnd
EndFunc

Func _ende()
Exit
EndFunc
Bekomms nur nicht hin, wie ich den Sound abspielen lasse. Habs mit Soundplay probiert, aber es hat nicht funktioniert, nur die Schleife wurde durch Exitloop verlassen. Im Fertigen Skrip soll natürlich der Funktionsaufruf _stop() nach Exitloop nicht da sein, hab ich nur schnell eingebaut, da es nich anders ging.
Ich hoffe ihr könnt mir dabei helfen, wie ich den Sound abspielen kann.

Mfg, HipTheHop.

P.S.: Die Soundplay aufforderung hab ich so reingebaut:

Quote:
...
If IsArray($pic) Then
SoundPlay(@WindowsDir & "\media\sound.wav", 1)
Else
...
HipTheHop is offline  
Old 11/09/2009, 18:23   #2
 
| Moep |'s Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,079
Received Thanks: 438
1. Befindet sich in meinem Windows Ordner keine sound.wav Datei, probiers mal mit SoundPlay(@WindowsDir & "\media\tada.wav",1)
2. ExitLoop beendet eine While-, Do- oder For-Schleife. D.h. du müsstest dich nachdem der Pixel gefunden wurde wieder in ersten while schleife befinden.
3. Durch zweitens wird niemals _stop() und soundplay ausgeführt
| Moep | is offline  
Old 11/09/2009, 19:48   #3
 
elite*gold: 0
Join Date: Nov 2008
Posts: 86
Received Thanks: 29
Oh, hab den Fehler gefunden, hatte meinen Sound in C:\Media drin, nachdem ich ihn in C:\WINDOWS\Media gepackt habe gehts. Vielen dank^^

Das ganze sieht jetz so aus:

Quote:
#include <Sound.au3>


HotKeySet("{insert}", "_start")
HotKeySet("{delete}", "_stop")
HotKeySet("{end}", "_ende")
HotKeySet("{F8}", "OL")
HotKeySet("{F9}", "UR")

Global $OL
Global $UR
Global $sound
Global $sound1




While 1
Sleep(1000)
WEnd



Func OL()
$OL = MouseGetPos()
EndFunc

Func UR()
$UR = MouseGetPos()
EndFunc


Func _start()
Local $pic
While 1
Send("{Space}")
Sleep(250)
Send("x")
$pic = PixelSearch($OL[0], $OL[1], $UR[0], $UR[1], 0xFFFFFF, 5, 1)
If IsArray($pic) Then
$sound = _SoundOpen(@WindowsDir & "\media\tada.wav", $sound1)
_SoundPlay($sound, 1)
_SoundStop($sound)
ExitLoop
_stop()
Else
EndIf
WEnd
EndFunc

Func _stop()
While 1
Sleep(1000)
WEnd
EndFunc

Func _ende()
Exit
EndFunc


HipTheHop is offline  
Reply




All times are GMT +2. The time now is 07:05.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.