Sign in to follow this  
Followers 0
daywalkereg

cool way to exit

11 posts in this topic

Can Any One Give Me The Code When That Program Exit Please {Program in the attachment} :)


1 £0\\/3 |-|3® $0 |\\/|µ(|-|

Share this post


Link to post
Share on other sites



Can Any One Give Me The Code When That Program Exit Please {Program in the attachment} :)

I don't want to try the program but can't you use ProcessExists?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Can Any One Give Me The Code When That Program Exit Please {Program in the attachment} :)

What code? What does your attachment do?

Share this post


Link to post
Share on other sites

Can Any One Give Me The Code When That Program Exit Please {Program in the attachment} :)

@all

Great utility to help you run unknown/suspicious programs without worrying about screwing up your system: Sandboxie

His program has a window roll-up type effect where the window shrinks vertically and when only the title bar is left, it shrinks in from either side until there's nothing left.

@daywalkereg

Check this out: AnimateWindow UDF Doesn't have exactly the same effect, but might give you something you can use. Other than that, I would suggest coding some kind of a loop with WinMove to constantly resize/reposition your GUI until you reach the smallest size possible, then GuiDelete it or GuiSetState(@SW_HIDE) it.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Can Any One Give Me The Code When That Program Exit Please {Program in the attachment} :)

Ok, I got to playing and came up with this. The window action isn't as smooth as it could be and I think there's a GUI style you can set to reduce the flickering if that's a problem for you. I'm sure somebody else has probably done this better, but hey, I like to play now and again just to know I can work it out on my own. Hope it helps.

#include <GuiConstants.au3>
Global $GuiX, $GuiY, $GuiW, $GuiH
$gui = GUICreate("My Gui")
$rollup = GUICtrlCreateButton("RollItUp", 50, 200, 100, 20);
GUISetState()

While 1
  $Msg = GUIGetMsg()
  Switch $Msg
    Case $GUI_EVENT_CLOSE
      Exit
    Case $rollup
      _RollUpGui($gui, 10)
  EndSwitch
WEnd


Func _RollUpGui($hWnd, $step, $delay = "default")
  Local $GuiClientH, $MinH
  $GuiClientSize = WinGetClientSize($hWnd)
  $GuiClientH = $GuiClientSize[1]
  _GuiGetPos($hWnd)
  $MinH = $GuiH - $GuiClientH
  While $GuiW > 0;$GuiPos[3]
    _GuiGetPos($hWnd)
    If $GuiH > ($MinH) Then
      $GuiH -= $step
      $GuiY += $step / 2
    Else
      $GuiH = $GuiH
      $GuiY = $GuiY
      $GuiW -= $step
      $GuiX += $step / 2
    EndIf
    WinMove($hWnd, "", $GuiX, $GuiY, $GuiW, $GuiH)
    If $delay = "default" Then $delay = ($step * 2) + ($step / 2)
    Sleep($delay)
  WEnd
  GUIDelete($hWnd)
  Exit
EndFunc   ;==>_RollUpGui


Func _GuiGetPos($hWnd)
  $GuiPos = WinGetPos($hWnd)
  $GuiX = $GuiPos[0]
  $GuiY = $GuiPos[1]
  $GuiW = $GuiPos[2]
  $GuiH = $GuiPos[3]
EndFunc   ;==>_GuiGetPos

You can play with the parameters of the _RollUpGui() function, increasing or decreasing the steps and delay between steps

Edit: Changed some "$gui" references in the function to "$hWnd", as that's what function is called with.

Edited by ResNullius

Share this post


Link to post
Share on other sites

Ok, I got to playing and came up with this. The window action isn't as smooth as it could be and I think there's a GUI style you can set to reduce the flickering if that's a problem for you. I'm sure somebody else has probably done this better, but hey, I like to play now and again just to know I can work it out on my own. Hope it helps.

#include <GuiConstants.au3>
Global $GuiX, $GuiY, $GuiW, $GuiH
$gui = GUICreate("My Gui")
$rollup = GUICtrlCreateButton("RollItUp", 50, 200, 100, 20);
GUISetState()

While 1
  $Msg = GUIGetMsg()
  Switch $Msg
    Case $GUI_EVENT_CLOSE
      Exit
    Case $rollup
      _RollUpGui($gui, 10)
  EndSwitch
WEnd
Func _RollUpGui($hWnd, $step, $delay = "default")
  Local $GuiClientH, $MinH
  $GuiClientSize = WinGetClientSize($hWnd)
  $GuiClientH = $GuiClientSize[1]
  _GuiGetPos($hWnd)
  $MinH = $GuiH - $GuiClientH
  While $GuiW > 0;$GuiPos[3]
    _GuiGetPos($hWnd)
    If $GuiH > ($MinH) Then
      $GuiH -= $step
      $GuiY += $step / 2
    Else
      $GuiH = $GuiH
      $GuiY = $GuiY
      $GuiW -= $step
      $GuiX += $step / 2
    EndIf
    WinMove($gui, "", $GuiX, $GuiY, $GuiW, $GuiH)
    If $delay = "default" Then $delay = ($step * 2) + ($step / 2)
    Sleep($delay)
  WEnd
  GUIDelete($gui)
  Exit
EndFunc   ;==>_RollUpGui
Func _GuiGetPos($hWnd)
  $GuiPos = WinGetPos($hWnd)
  $GuiX = $GuiPos[0]
  $GuiY = $GuiPos[1]
  $GuiW = $GuiPos[2]
  $GuiH = $GuiPos[3]
EndFunc   ;==>_GuiGetPos

You can play with the parameters of the _RollUpGui() function, increasing or decreasing the steps and delay between steps

Oooh that's lovely. :)

Very pleasing ResNullius, it's amazing how such little things can make you smile.

If you add the style $WS_SIZEBOX to the gui it all goes wrong so you have to be careful how it's used.

Thanks for the Sandboxie info, - that looks really very clever.

(I'm glad you understood the OP better than I did, I thought he was asking how to know when the program had ended.)


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Great utility to help you run unknown/suspicious programs without worrying about screwing up your system: Sandboxie

Cool. Thanks for that! I would have normally thrown it in a virtual machine, but I'm not on my production machine. And my poor little ole' laptop can't take no surprises!

Here's my take on a quick n' dirty roll-up script.

$parent = GUICreate("Roll-Up!", 200, 200, 0, 0)
GUISetState(@SW_SHOW, $parent)

Sleep(1000)
MsgBox(0, "Here goes nothing...", "About to Roll-Up!  Ready?")

For $i = 200 To 1 Step -1
    WinMove("Roll-Up!", "", 0, 0, $i, $i)
NextoÝ÷ ØÚ-jÊkzÛrj̨º»- }ÈiËnjYrmçè­êh²Ø§Øb²Øhºmªê--ëfz
æjw]¢+[Ê¢ZÛaz|"vØjºE¢»(êÞjÊ'Ùz­«!x&Éçb¶ÛºØ­®éìë-~)Þ²îÁëf§vØ^èeÉø±yØ­jëh×6$parent = GUICreate("Roll-Up!", 400, 400, 0, 0)
GUISetState(@SW_SHOW, $parent)

Sleep(1000)
MsgBox(0, "Here goes nothing...", "About to Roll-Up!  Ready?")

For $i = 400 To 26 Step -1
    WinMove("Roll-Up!", "", 0, 0, 400, $i)
Next
For $j = 400 To 1 Step -1
    WinMove("Roll-Up!", "", 0, 0, $j, $i)
Next

Not bad for an AutoIt'er who just started a few days ago. :)

Share this post


Link to post
Share on other sites

thanks for all of you guys your very helpful :);)


1 £0\\/3 |-|3® $0 |\\/|µ(|-|

Share this post


Link to post
Share on other sites

Oooh that's lovely. ;)

Very pleasing ResNullius, it's amazing how such little things can make you smile.

If you add the style $WS_SIZEBOX to the gui it all goes wrong so you have to be careful how it's used.

Thanks for the Sandboxie info, - that looks really very clever.

(I'm glad you understood the OP better than I did, I thought he was asking how to know when the program had ended.)

Glad you like ;)

Especially nice compliment coming from someone who's coding and creativity on the forums I have always admired!

I didn't really test behaviour with too many different widow styles, so I suppose this could bear some fine tuning with checking etc... Oh well, maybe someday :)

I use Sandboxie all the time, even when surfing to "suspicious" links I've been sent. Great program.

Share this post


Link to post
Share on other sites

Ok, I got to playing and came up with this. The window action isn't as smooth as it could be and I think there's a GUI style you can set to reduce the flickering if that's a problem for you. I'm sure somebody else has probably done this better, but hey, I like to play now and again just to know I can work it out on my own. Hope it helps.

#include <GuiConstants.au3>
Global $GuiX, $GuiY, $GuiW, $GuiH
$gui = GUICreate("My Gui")
$rollup = GUICtrlCreateButton("RollItUp", 50, 200, 100, 20);
GUISetState()
; Cut

You can play with the parameters of the _RollUpGui() function, increasing or decreasing the steps and delay between steps

Edit: Changed some "$gui" references in the function to "$hWnd", as that's what function is called with.

Very Nice :)

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  
Followers 0