Jump to content

duketrapp

Active Members
  • Posts

    35
  • Joined

  • Last visited

duketrapp's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I use a blocking window in my script (to avoid user click on buttons while a wav file plays..) Code looks like that: Func playwav($val,$duration) $winpos = WinGetPos ( $scriptname );<- $scriptname is ur main gui $SAFE = GUICreate('') GUISetState( $WS_EX_TRANSPARENT, $SAFE) $VAULT = GUICreate("avoider", $winpos[2], $winpos[3], $winpos[0], $winpos[1], -1, -1, $SAFE) WinSetOnTop("avoider", "", 1) WinSetTrans("avoider", "", 1) GUISetState() SoundPlay ( $wavsspath & $val & ".wav", $duration) GUIDelete($VAULT) GUIDelete($SAFE) Return EndFunc all works great and perfect..but sometimes when i make a few clicks on the blocking trans window, i see ~500 milliseconds a non trans window with the phrase "no reply" in the header ( the message u get in window title when a program is freezed).. than after the milliseconds all runs normal and window turn back to transparency... i dont know if its an error by the blocking script or a general overflow on input when u clicking on an transparent window when a wav plays... maybe someone knows why this happends or how i can avoid this "no reply" window from coming up... salute...
  2. Simucal ur da man... small,simple,easy to use.. thats what i was searchin for.. ..works perfect... thnks a lot for ur search.. ..all other thnks too for input.. ..salute...
  3. ... i realy dont have a clue on objects... :"> ..but... i looked a bit and try this: $oMedia = ObjGet("","MediaPlayer.MediaPlayer.1") $oMediadur = $oMedia.currentMedia.duration ..and like i expected its not workin ... but i m right that the comand "player.currentMedia.duration" is what i need?... ..maybe i need this "read access to Media Library" or im just to noob to get the right spelling in writing the object code.. ..like i say... im new to this... but i tried ... script give me "Variable must be of type Object" error... ..btw... the videofile i need the length from is open when i try to use this object things... so i thnk i read that u dont need "ObjCreate" when the file is opened...but.. maybe im wrong
  4. ..okido.... just needed a confirmation that its worth to have an eye on this
  5. im not firm in dll handling.. just thought it would be possible to get this .avi info with a simple autoit phrase...
  6. i try find a solution get an avis length... ...i found this in vb script... can i convert the "get length" part in autoit comands?.. VB Code Private Declare Function AVIFileOpen Lib "avifil32" _ Alias "AVIFileOpenA" ( _ ppfile As Long, _ ByVal szFile As String, _ ByVal mode As Long, _ pclsidHandler As Any) As Long Private Declare Function AVIFileRelease Lib "avifil32" ( _ ByVal pfile As Long) As Long Private Declare Function AVIFileInfo Lib "avifil32" _ Alias "AVIFileInfoA" ( _ ByVal pfile As Long, _ pfi As AVIFileInfo, _ ByVal lSize As Long) As Long Private Declare Sub AVIFileInit Lib "avifil32" () Private Declare Sub AVIFileExit Lib "avifil32" () ' AVI Info-Struktur Private Type AVIFileInfo dwMaxBytesPerSec As Long dwFlags As Long dwCaps As Long dwStreams As Long dwSuggestedBufferSize As Long dwWidth As Long dwHeight As Long dwScale As Long dwRate As Long dwLength As Long dwEditCount As Long szFileType As String * 64 End Type ' Länge (Spieldauer) ermitteln ' (Rückgabewert erfolgt in Millisekunden) Public Function AVI_GetLength(ByVal sFile As String) As Long Dim hFile As Long Dim AviInfo As AVIFileInfo Dim nLength As Long ' Fehlerbehandlung aktivieren On Error Resume Next ' Initialisieren AVIFileInit ' AVI öffnen (Handle erstellen) If AVIFileOpen(hFile, sFile, &H20, ByVal 0&) = 0 Then ' Infos lesen If AVIFileInfo(hFile, AviInfo, Len(AviInfo)) = 0 Then <-------I THNK ITS THIS!!! nLength = AviInfo.dwLength End If AVIFileRelease hFile End If ' Beenden AVIFileExit On Error Goto 0 ' Rückgabewert AVI_GetLength = nLength End Function
  7. ..i got it..!!! ..u can check the state of windows media player through :"WinGetState()" ..so if u create a routine like that below u can avoid the user from leave fullscreenmode ... my script example for all want do so: EDIT: changed some code.. tested around works good.... but still need check for avi lenghts EDIT 12.05.2006: now i worked it out perfectly.. runs stable and 100% $file = The AVI file $videotime = Length of AVI (if u need get AVI length past CODE2 BEFORE CODE1 in ur script) CODE1 for Windows Media Player Send Key controlled (Stays in Fullscreenmode until video ends or user close..) BlockInput(1) Run ('C:\Programme\Windows Media Player\wmplayer.exe ' & '"C:\BLABLABLA\' & $file & '"') sleep(1000) WinActivate( "Windows Media Player" ) BlockInput(0) $videotimer = TimerInit() Do If WinExists("Windows Media Player") = 0 Then WinActivate( "MAINGUI" ) Return EndIf $state = WinGetState ( "Windows Media Player" ) If BitAnd($state, 8) Then WinActivate( "Windows Media Player" ) Send ( "!{ENTER}" , 0) EndIf Until TimerDiff($videotimer) >= $videotime BlockInput(1) If WinExists ( "Windows Media Player" ) = 1 Then WinActivate( "Windows Media Player" ) Send ( "!{F4}" , 0) EndIf sleep(100) If WinExists ( "Windows Media Player" ) = 1 Then WinActivate( "Windows Media Player" ) Send ( "!{F4}" , 0) EndIf BlockInput(0) WinActivate( "MAINGUI" ) CODE2 for getting AVI File length (Big Thnks to Simucal) $filepath = "C:\BLABLABLA\" & $file ConsoleWrite($filepath&@CRLF) $vid = StringTrimLeft($filepath,StringInStr($filepath,"\",0,-1)) $dir = StringTrimRight($filepath,(StringLen($filepath)-StringInStr($filepath,"\",0,-1))) $ShellApp = ObjCreate("shell.application") $oDir = $ShellApp.NameSpace($dir) $oVid = $oDir.Parsename($vid) $duration = $oDir.GetDetailsOf($oVid, 21) $videotime = (((StringMid($duration,4,2)*60)+StringRight($duration,2))*1000);<--- Playtime in Milliseconds ..salute...
  8. no other hints or ideas?.. ..meanwhile i found this ...its still the same... plays no divx.avi... and the fullscreenmode with uncompressed .avi files dont work at my tries...
  9. ...folks... .. it isnt that easy.. cause...my posted script is not what i want..its just tryin make it work somehow.. :"> in real case! the comand should not be sleep($videotime).. ..in real case i dont have the video lenght = so i cant set sleep(blablabla) or tell the script when to kill mediaplayer... so.. winactive or winexists are no solutions for this.. the mediaplayer dont close automatic when the file ends... that means... it just stops the file and stay with window open at the desktop... so... both functions will return "mediaplayer is still running the video" to the script cause window is still open, active and exists.... but its not playing anymore..but how can i tell the script?.. ..anythng else?...
  10. salute again... just want to know if it is possible to let the script check the lenght of an .avi file on the hd so that i can pause the script exactly to the time a video is running in mediaplayer?.. ..i want to let the script start mediaplayer with a give file, let player play file in fullscreen..and then close player and jump back to the script.. i make a solution but i thnk its not very professionell.. its somethng like that..: Func playvideo($nr) If $nr = 1 Then $wild = "a" $videotime = 10*60*1000 ElseIf $nr = 2 Then $wild = "b" $videotime = 10*60*1000 EndIf $videolist = _FileListToArray("C:\blablabla\", $wild & "*.avi", 1) If (Not IsArray($videolist)) and (@Error=1) Then Exit Else Do $filenr = Random( 1, $videolist[0], 1) $file = $videolist[$filenr] Until $file <> $fileholder EndIf $fileholder = $file Run ('C:\Programme\Windows Media Player\wmplayer.exe ' & '"C:\blablabla\' & $file & '"') sleep(1000) WinActivate( "Windows Media Player" ) Send ( "!{ENTER}" , 0) sleep($videotime) Send ( "!{F4}" , 0) Send ( "!{F4}" , 0) sleep(500) WinActivate( $scriptname ) Return EndFunc ...this works but the problem is that a user that clicks while the prozess runs, can kill fullscreen of mediaplayer, and if he kills player the script still runs in it paused state... ...the other problem is, that i dont know the .avi length, cause there are different files with different lenght...so i cant get the exactly pause time (in my script its fixed time)... ..i tried workin with some other threads solutions but none of them was be able to play a divx.avi in fullscreenmode... they just stretch the video to fullscreen and that looks horrible blocking... so maybe someone have a clue on that?.. question1: how can my script get the length of an avi file question2: u know a better way to play divx.avi in fullscreen mode? (must be non 3rdparty solution, just xp stuff).. Thanks for ur thoughts.. ..salute..
  11. yeeha... but.. .. i tested a bit now.. it runs fine but i noticed that when i hammer a sequence of near 10 clicks on the blocking trans window, sometimes i see ~10 milliseconds a non trans window with the phrase "no reply" in the header ( the message u get in window title when a program is freezed).. than after the milliseconds all runs normal and nothng to see... i dont know if its an error by the blocking script or a general overflow on input when u clicking verrrry fast on an window when a wav plays... but.. i dont thnk that someone will give the script clicks in that speed and duration when hes not stoned ..or maybe someone knows why this happends... salute...
  12. Valuater ur da man.. BUT.. ive changed just 1 line in ur code for a better result in ur script: $SAFE = GUICreate('') GUISetState( $WS_EX_TRANSPARENT, $SAFE) $VAULT = GUICreate(" *VAULTER*", @DesktopWidth, @DesktopHeight, -1, -1, -1, -1, $SAFE) GUISetState() ToolTip("Protected by, *VAULTER* v" & $VER, 5, 5) WinSetOnTop(" *VAULTER*", "", 1) WinSetTrans(" *VAULTER*", "", 1) ..this result is near perfect cause it blocks all input like we all wish ..but when u look exactly u can see a millisecond of the trans window when its created.. when u change it to this: $SAFE = GUICreate('') GUISetState( $WS_EX_TRANSPARENT, $SAFE) $VAULT = GUICreate(" *VAULTER*", @DesktopWidth, @DesktopHeight, -1, -1, -1, -1, $SAFE) ToolTip("Protected by, *VAULTER* v" & $VER, 5, 5) WinSetOnTop(" *VAULTER*", "", 1) WinSetTrans(" *VAULTER*", "", 1) GUISetState() ; <----just set this at the end and works perfect ..u see nothng when the trans window is created so .. thanks a lot.. this works realy perfect for me ... i just put this code in my soundplay function and it work awsome... .. thnks again.. and thnks to all other users too for brainstorming... for all who are interested in "USER INPUT BLOCKED SOUNDPLAY" here is the workin code for the sound funktion: Func playwav($val,$duration) $winpos = WinGetPos ( $scriptname );<- $scriptname is ur main gui $SAFE = GUICreate('') GUISetState( $WS_EX_TRANSPARENT, $SAFE) $VAULT = GUICreate("avoider", $winpos[2], $winpos[3], $winpos[0], $winpos[1], -1, -1, $SAFE) WinSetOnTop("avoider", "", 1) WinSetTrans("avoider", "", 1) GUISetState() SoundPlay ( $wavsspath & $val & ".wav", $duration) GUIDelete($VAULT) GUIDelete($SAFE) Return EndFunc
  13. ...but.. how must i realize an INVISIBLE blocking window?!?!... i tried some various windows but i dont reach a solution that is invisible and can block input to the buttons same time!!!... always i set to HIDE or TRANSPARENCY = 0 the window dont block input to the buttons under...
  14. ..y.. i thought about somethng like that .. but... still the same problem..like the solution with the DISABLED gui... 1 click on 1button = impossible... ... maybe i dont need the 1 click user interaction during soundplay.... ...until someone got another small simple good solution.. ..thks for ur help til now..
  15. ..its a simple way.. just what im searchin for.. .. BUT.. 1 button click should be possible for the user ... but its a good hint ... maybe i can use this in a different way... ..btw.. if u use the WinSetState solution u get an error beep when u try to click the window... is there a way to kill this sound?.. (not wave volume = 0 ... i need to hear the text wav... )..
×
×
  • Create New...