Jump to content
Sign in to follow this  
Achilles

Ummm... complicated?

Recommended Posts

Achilles

To begin with: I have a program that will play an animation that will open a gui (in a fancy manor) that will cover the whole screen, it will wait a second, then exit (in a fancy manor). This fancy manor is in fact exploding in and imploding out. (See script) However, there is a problem... I have main gui in the background, and when this implodes in the main gui remains all black until the animation is complete. I have solved this problem by making a separate script that manages by gui exploding and imploding. However, I would like to make this into a EXE that you could call with parameters (the parameters containing the entrance/exit style, the background color, and the speed)...

As of now, I have a function with the function doing what I want. But to compile this and be able to run with different parameters is something I am completely new at.

#Include <Misc.au3>
#include <GUIConstants.au3>

GuiCreate('This one is weird!!!', 600, 600) ;Try commenting this line out and running the code: the animation goes completely smooth!
GuiSetState()
Sleep(400)

_Animation(0x00040010, 0x00050010, 1000, 0)

Func _Animation($animationTypeEntrance, $animationTypeExit, $animationSpeed, $animationBkColor)
    $mousePos = MouseGetPos()

    _MouseTrap (@DesktopWidth, @DesktopHeight)
    $gui = GuiCreate('Transition', @DesktopWidth , @DesktopHeight, 0, 0, $WS_POPUP, BitOr($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
        GuiSetBkColor($animationBkColor)

    WinSetOnTop('Transition', '', 1)

    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", $animationSpeed, "long", $animationTypeEntrance)
    GUISetState()

    Sleep(1000)

    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", $animationSpeed, "long", $animationTypeExit)
    GuiDelete($gui) 
    _MouseTrap ()
    MouseMove($mousePos[0], $mousePos[1], 0)
EndFunc

Please let me know if I had not made my problem clear or if there is a different solution then the one I have suggested. (By the way, this will be running on people's computers who don't have autoit so it will not be possible to simply have a script and run it.)

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
The Kandie Man

It would appear that you would need a separate script. I would recommend you compile the above code into an .a3x file and then use a fileinstall. When the program starts, use fileinstall() to place the a3x file in the same directory as the regular executable. Then you can run the a3x by doing the following:

Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & $v_PathToA3XFile & '"')

I hope this helps.

- The Kandie Man ;-)


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites
Valuater

Like, Duh!!!

you have two GUI creates and two gui set states... just comment out one of each

.. uses the function only ( a create and a set state )

#Include <Misc.au3>
#include <GUIConstants.au3>

;GuiCreate('This one is weird!!!', 600, 600) ;Try commenting this line out and running the code: the animation goes completely smooth!
;GuiSetState()
;Sleep(400)

_Animation(0x00040010, 0x00050010, 1000, 0)
Sleep(400)

Func _Animation($animationTypeEntrance, $animationTypeExit, $animationSpeed, $animationBkColor)
    $mousePos = MouseGetPos()

    _MouseTrap (@DesktopWidth, @DesktopHeight)
    $gui = GuiCreate('Transition', @DesktopWidth , @DesktopHeight, 0, 0, $WS_POPUP, BitOr($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
        GuiSetBkColor($animationBkColor)

    WinSetOnTop('Transition', '', 1)

    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", $animationSpeed, "long", $animationTypeEntrance)
    GUISetState()

    Sleep(1000)

    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", $animationSpeed, "long", $animationTypeExit)
    GuiDelete($gui) 
    _MouseTrap ()
    MouseMove($mousePos[0], $mousePos[1], 0)
EndFunc

and you have GuiDelete($gui)

where is $gui defined????

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
Achilles

It would appear that you would need a separate script. I would recommend you compile the above code into an .a3x file and then use a fileinstall. When the program starts, use fileinstall() to place the a3x file in the same directory as the regular executable. Then you can run the a3x by doing the following:

Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & $v_PathToA3XFile & '"')oÝ÷ Øh¥ëaÈ^âØ1©ÿªê-yj.ÛajÜ(®L"¶ayØ}êÞÚZ­©µêìçºÇ­æärh®Ê^yÖ§vÚÚȭڭ覦íj{m¢¯yØ}êÞÓÉ·r¥vf¤y§e좻l#flº·ªº^.)èwß}÷ß*.«Þ·
P+y«^±©Ý·
 º+¶ËZµë#ºË¢iÚ.¶Þ¡÷r¬zËayû§rبåɧ+y«^jwZ±ëlµ«^jëh×6#Include <Misc.au3>
#include <GUIConstants.au3>

;GuiCreate('This one is weird!!!', 600, 600) ;Try commenting this line out and running the code: the animation goes completely smooth!
;GuiSetState()
;Sleep(400)

_Animation(0x00040010, 0x00050010, 1000, 0)
Sleep(400)

Func _Animation($animationTypeEntrance, $animationTypeExit, $animationSpeed, $animationBkColor)
    $mousePos = MouseGetPos()

    _MouseTrap (@DesktopWidth, @DesktopHeight)
    [b]$gui = GuiCreate('Transition', @DesktopWidth , @DesktopHeight, 0, 0, $WS_POPUP, BitOr($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))[/b]
        GuiSetBkColor($animationBkColor)

    WinSetOnTop('Transition', '', 1)

    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", $animationSpeed, "long", $animationTypeEntrance)
    GUISetState()

    Sleep(1000)

    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", $animationSpeed, "long", $animationTypeExit)
    GuiDelete($gui)
    _MouseTrap ()
    MouseMove($mousePos[0], $mousePos[1], 0)
EndFunc

and you have GuiDelete($gui)

where is $gui defined????

8)

I need both Gui's though, the background one contains a "preview" button that will activate the animation.

And Gui is defined the top of the function...


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
The Kandie Man

Would that work with the different parameters? Because the bkcolor, speed, and transition are important to have different... Maybe I could make a dll of sorts, I'm not sure.

I need both Gui's though, the background one contains a "preview" button that will activate the animation.

And Gui is defined the top of the function...

Yes, you can have different parameters:

#include <array.au3>
IF $CmdLine[0] > 0 Then 
    _ArrayDisplay($CmdLine)
Else
    Dim $s_Parameters = "-a -d=260 -t=1000"
    Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptFullPath & '" ' & $s_Parameters)
EndIf

Run that and you will see how a script can pass parameters to another instance of a script using /AutoIt3ExecuteScript.

- The Kandie Man ;-)


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites
Achilles

Yes, you can have different parameters:

#include <array.au3>
IF $CmdLine[0] > 0 Then 
    _ArrayDispl^J   ÌÍÐÛY[JB[ÙB[H  ÌÍÜ×Ô[Y]ÈH    ][ÝËXHYL]LL   V÷C°¢'VâWFôDWRfײb33²ôWFôC4WV7WFU67&BgV÷C²b33²f×MÉ¥ÁÑÕ±±AÑ µÀìÌäìÅÕ½ÐìÌäìµÀìÀÌØíÍ}AɵÑÉ̤)¹%

Run that and you will see how a script can pass parameters to another instance of a script using /AutoIt3ExecuteScript.

- The Kandie Man ;-)

Although it's very late, thanks! I'm just using this now for my code... :rolleyes:

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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  

×