 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Stefan14 Guest
|
Posted: Fri Nov 10, 2006 11:55 pm Post subject: |
|
|
i still do not know how to get my avi movie "intro.avi" to get it working all times on the gui...
please help.... |
|
| Back to top |
|
 |
Stefan14 Guest
|
Posted: Sat Nov 11, 2006 12:11 am Post subject: |
|
|
sorry, forgot to provide my script...
this is my script that i want to make all automatic on the push of a button (i would like to add more buttons for firefox etc.). example opera. i have now only a pic in the gui as you see "gui.jpg. i would like to put a small animated movie on the gui & remove this gui picture "gui.jpg" but how can this be done???
my script:
Gui, Add, Picture, x-4 y10 w770 h490, C:\gui.jpg
Gui, Add, Button, x526 y420 w200 h30, START_OPERA
Gui, Show, x15 y21 h494 w759,
START_OPERA:
Run, C:\Programme\Opera\Opera.exe
Return
ButtonEXIT:
GuiClose:
ExitApp |
|
| Back to top |
|
 |
dave_k Guest
|
Posted: Sat Nov 11, 2006 5:16 pm Post subject: |
|
|
No one seems to know about |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Nov 12, 2006 9:46 pm Post subject: |
|
|
| Just for curiosity I would like to know it also. Thanks Steve. |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Mon Nov 13, 2006 4:35 pm Post subject: |
|
|
I have isolated the functionality in three functions. You have now just to #Include CreateWindow_AVI.ahk in your script, follow the example given at the end (you can remove it!) and you are done.
One test use the G.avi file, one I made out of some test PNG images...
Of course, you have to make some work yourself: find the size of the AVI and create the control to this size (or greater). Unlike other controls, the GUI won't resize itself to accommodate this new control...
I must admit it wasn't so obvious to wrap this up, I fall in various traps.
I wanted to pass the options in one string, parsing it with regex, but I think I found a bug. At least, it didn't worked.
| Quote: | // File/Project history:
1.02.000 -- 2007/05/25 (PL) -- Improved encapsulation.
1.01.000 -- 2007/05/16 (PL) -- Changed API for consistency with CreateWindow_AniGif.
1.00.000 -- 2006/11/13 (PL) -- Creation.
|
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Last edited by PhiLho on Mon May 28, 2007 11:01 am; edited 2 times in total |
|
| Back to top |
|
 |
Stefan16 Guest
|
Posted: Mon Nov 13, 2006 5:59 pm Post subject: |
|
|
WOW PhiLho a great demo!!! thanks for your time!!!! your script work here...
ok, so now i have put it in my script like that and downloaded your small avi, just testing if i see the avi..but i think there is something wrong..
| Code: | Gui, Add, Picture, x-4 y10 w770 h490, C:\gui.jpg
Gui, Add, Button, x526 y420 w200 h30, START_OPERA
Gui, Show, x15 y21 h494 w759,
START_OPERA:
Run, C:\Programme\Opera\Opera.exe
Return
Gui +LastFound
guiID := WinExist()
width := 300
h1 := GuiAddAVI(guiID, 10, 10, width, 130, 165)
If h1 is not integer
MsgBox %h1%
Gui Add, Button, x10 y150 w50 v11 gCreateWindow_AVI_Control, Start
Gui Add, Button, x70 y150 w50 v01 gCreateWindow_AVI_Control, Stop
h2 := GuiAddAVI(guiID, 350, 10, width, 130, 1006, "WIADefUI.dll")
If h2 is not integer
MsgBox %h2%
Gui Add, Button, x350 y150 w50 v12 gCreateWindow_AVI_Control, Start
Gui Add, Button, x420 y150 w50 v02 gCreateWindow_AVI_Control, Stop
;~ h3 := GuiAddAVI(guiID, 650, 10, width, 130, A_WinDir . "\Clock.avi")
;~ h3 := GuiAddAVI(guiID, 650, 10, width, 130, A_ScriptDir . "\CtrlAltDel.avi")
h3 := GuiAddAVI(guiID, 650, 10, width, 130, A_ScriptDir . "\G.avi")
If h3 is not integer
MsgBox %h3%
Gui Add, Button, x650 y150 w50 v13 gCreateWindow_AVI_Control, Start
Gui Add, Button, x720 y150 w50 v03 gCreateWindow_AVI_Control, Stop
Gui Add, Button, x10 y200 w50 gCreateWindow_AVI_Exit, End
Gui Show, w960, AVI Demo
Return
CreateWindow_AVI_Control:
StringLeft action, A_GuiControl, 1
StringRight control, A_GuiControl, 1
If (action = 1)
GuiControlStartAVI(h%control%)
Else If (action = 0)
GuiControlStopAVI(h%control%)
Return
CreateWindow_AVI_Exit:
ExitApp
}
ButtonEXIT:
GuiClose:
ExitApp |
|
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Mon Nov 13, 2006 6:32 pm Post subject: |
|
|
If that's all your code:
1) Remove the trailing closing brace.
2) Remember to #Include my file! At start of your code, to be sure the global vars are set. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Stefan16 Guest
|
Posted: Mon Nov 13, 2006 7:10 pm Post subject: |
|
|
OK... I give up. anthing i do, i get only error. |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Mon Nov 13, 2006 7:19 pm Post subject: |
|
|
Actually, I didn't noticed, but it couldn't work at all, indeed... Wrong order of instructions, among other problems.
| Code: | #Include CreateWindow_AVI.ahk
Gui +LastFound
guiID := WinExist()
Gui, Add, Picture, x-4 y10 w770 h490, Dots.bmp
hAVI := GuiAddAVI(guiID, 100, 50, 100, 100, A_ScriptDir . "\G.avi")
If hAVI is not integer
MsgBox %h1%
Gui, Add, Button, x526 y420 w200 h30 gSTART_OPERA, Start Opera
Gui, Show, x15 y21 h494 w759
Return
START_OPERA:
Run, C:\Programme\Opera\Opera.exe
Return
ButtonEXIT:
GuiClose:
ExitApp
| BTW, you can have Dots.bmp, it shows how to make a nice gradient background with only two pixels... _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Stefan16 Guest
|
Posted: Mon Nov 13, 2006 7:34 pm Post subject: |
|
|
PhiLho it WORKS!!!!
now i have understand it...the "CreateWindow_AVI.ahk" must be presented in the same directory, am i right????
and with your script, it works PERFEKT!!!!
THANK YOU SO MUCH!!! THANK YOU!
is this code only for winxp??? and why must the "CreateWindow_AVI.ahk" be presented??..is it like a dll?? |
|
| Back to top |
|
 |
scriptmonkey
Joined: 19 May 2006 Posts: 112
|
Posted: Mon Nov 13, 2006 10:47 pm Post subject: |
|
|
How can I add this functionality to an existing script? I have a script that searches a folder for a PDF file. The user inputs a filename, and it searches predefined folders for all versions of that file. I have a simple text box that pops up that says "Searching". It would be nice ot have the flashlight AVI popup.
How can I do this? _________________ Zak M. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Tue Nov 14, 2006 4:54 am Post subject: |
|
|
Dear PhiLho, : Many thanks for the easy to use wrapper.
| Zak. M wrote: | | How can I add this functionality to an existing script? |
Maybe you can use this as an example:
| Code: | #Include CreateWindow_AVI.ahk
Gui +LastFound
guiID := WinExist()
Gui, Font, S10, Verdana
Gui, Add, Edit, x10 y10 Limit30 w300 h20 vSearchFileName, Readme.txt
Gui, Add, Button, x+5 y10 w75 h20 gSearch vB1 , Search
Gui, Add, Button, x+5 y10 w75 h20 +Disabled gCancel vB2 , Cancel
Gui, Add, StatusBar,,
Gui, Show, h75,File Search
Return
Search:
StopSearch=0
Gui, Submit, NoHide
GuiControl, Hide, B1
GuiControl, -Disabled, B2
FileDelete, FL.txt
hAVI := GuiAddAVI(guiID, 310, 5, 80, 40, 150)
Loop, C:\%SearchFileName%, 0, 1
{
IfEqual, StopSearch,1, Break
SplitPath, A_LoopFileLongPath, OutFileName, OutDir
SB_SetText(A_Space OutDir)
IfEqual, A_LoopFileName, %SearchFileName%
FileAppend, %A_LoopFileLongPath%`n, FL.txt
}
GuiControlDestroyAVI(hAVI)
GuiControl, Show, B1
IfExist, FL.txt, Run, FL.txt
GuiControl, +Disabled, B2
SB_SetText("Done!")
Return
Cancel:
StopSearch=1
Return
GuiClose:
ExitApp |
 _________________ SKAN - Suresh Kumar A N |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Tue Nov 14, 2006 11:07 am Post subject: |
|
|
Excellent example!
And you even found an use for my GuiControlDestroyAVI function...
On my system, the search loop ran "too" fast, the animation was slow to show up and to move...
Stefan16, I haven't tested it yet on Win98, but basically it should work there too, and on Win2k too (Goyyah's default system).
The list of DLLs and AVIs in them can change from one system to the other, of course.
CreateWindow_AVI.ahk is not "like a dll", but it is a wrapper around system's DLLs, that's why it is needed. It hides the gory details of the WinAPI...
| Chris wrote: | | if anyone would like to package this up into something more succinct and easy-to-use (assuming that's feasible), I could include it as an example on the GuiControls page. | Feel free to do so. I routinely put a zlib/libpng licence in the header of the major scripts I write, but you can drop it (probably making it more or less public domain) if you want to include it in the doc. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Stefan16 Guest
|
Posted: Tue Nov 14, 2006 11:36 am Post subject: |
|
|
PhiLho, first thank you for all this again. allone i would not get anything to work.
only one question, where can i cahnge the bakround for the avi. i would like to make it black. how to change the position i have found but not the backround cocolr for the avi. |
|
| Back to top |
|
 |
Stefan16 Guest
|
Posted: Tue Nov 14, 2006 12:06 pm Post subject: |
|
|
i menas the avi backround is now transparent and i would like to get it black. so if i look in CreateWindow_AVI.ahk i found:
; WinAPI constants
WS_CHILD := 0x40000000
WS_VISIBLE := 0x10000000
GWL_HINSTANCE := -6
WM_USER := 0x400
ACS_AUTOPLAY := 0x0004
ACS_TRANSPARENT := 0x0002
ACS_CENTER := 0x0001
ACM_OPEN := WM_USER + 100
ACM_PLAY := WM_USER + 101
ACM_STOP := WM_USER + 102
so i think i need to change ACS_TRANSPARENT := 0x0002 to something else? |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|