Jump to content

V3.0.103 Unstable


Jon
 Share

Recommended Posts

hehehe, I'm having fun with the transparent thing. Try this:

while 1
     for $n = -254 to 254 step 5
          WinSetTrans("Program Manager", "", abs($n))
     next
wend

Aparently you can apply transparency to the desktop, altough there's nothing behind it anyway (black, that is).

Oh, it's supposed to go from 0 to 255, right? If I use 255 then it becomes black (in the example the window would blick when reaching 255).

Link to comment
Share on other sites

  • Replies 113
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Administrators

Updated:

- OnAutoItStart() and OnAutoItExit() user functions are called on start/exit

- Default exit function can be changed with Opt("OnExitFunc", "funcname")

- Extra parameter added to ControlCommand

- Last two parameters of ControlCommand are optional

- New "commands" for ControlCommand:

"LV_GetItemCount"

"LV_GetSubItemCount"

"LV_GetItem", Item, SubItem

"LV_GetSelectedCount"

No doc/installer update though as I'm in coding mode...

Link to comment
Share on other sites

Am I missing what's so great about this that you couldn't do before? (and to be fair, I probably am...)

<{POST_SNAPBACK}>

When the user exits my autoit script from the program-tray, I want do close down another program that was started by the script. Couldn't be done before, I think.

/Add: however, I'm not so sure what the purpose is with OnAutoItStart()?

Edited by tylo

blub

Link to comment
Share on other sites

Just want to say that you guys never stop impressing me. I haven't been around for a while, but all the recent new stuff is truly remarkable: Process control, dynamic variable creation/assignment, on-exit callback, etc., let alone the GUI... I can throw away all those small extra tools I needed before. My hat is off. :ph34r:

blub

Link to comment
Share on other sites

@jon - Hey, maybe in the onexit... func a user could return 0 (or 1) if you do not want to exit at the time. I can see many reasons that a script would want to complete the current operation before exiting.

Who else would I be?
Link to comment
Share on other sites

@jon - Hey, maybe in the onexit... func a user could return 0 (or 1) if you do not want to exit at the time. I can see many reasons that a script would want to complete the current operation before exiting.

<{POST_SNAPBACK}>

What you want is to use the Break(n) function to disable and enable the user from exiting the script on critical places. Be careful not to set Break(0) too long - the user is likely to use the old Ctrl-Alt-Del to close down your script...

/btw: The Break() doc says: "If Break is enabled (1), then the user cannot terminate the script this way." - which I believe is wrong.

OnAutoItExit() is like a c++ exception handler - you should take actions needed to clean up, or do emergency handling. A hint is to have a $g_scriptStage variable which you should set to certain values in the different stages of your script. When OnAutoItExit() is called by interrupt from the user, you can check the $g_scriptStage variable, to see which stage the script was in. (A minor issue: OnAutoItExit() has no access to your local varibles in the function that was executed, so you have to rely on globals. The same goes for the Adlib-functions...)

tylo.

Edited by tylo

blub

Link to comment
Share on other sites

I get ya. Only problem I see with this is it changes the way the system tray icon used to work. In my logic, selecting Exit from the system tray icon is a way to quickly kill a script that's gone awry. However, what if it's an OnExit function that's gone awry?

Link to comment
Share on other sites

  • Administrators

Add: however, I'm not so sure what the purpose is with OnAutoItStart()?

Symmetry :ph34r:

Maybe you would like to hide away all your Opt() settings at the start of the script or something. I don't know. Heh.

Link to comment
Share on other sites

In my logic, selecting Exit from the system tray icon is a way to quickly kill a script that's gone awry. However, what if it's an OnExit function that's gone awry?

An analogy: If you contract a deadly disease, and your only doctor has gone completely mad :ph34r:, you're doomed :( - sorry. :lol:

blub

Link to comment
Share on other sites

@jon, Does break still work in the onexit function? If so, then that would alleviate the problem I see and allow the script to return to normal operation. In other words, is the break statement tested before, after, or during onexit? Another thing, is onexit called if break is 0 before attempting to close? If so, I vote that the onexit still be called to allow the script to give a messagebox telling the user important information. I also vote for an onpause function. I know this could probably throw a monkeywrench into some things, but I would like to know if the user paused my script so that I can send an email using blat. Is this too much to ask?

Who else would I be?
Link to comment
Share on other sites

  • Administrators

@jon, Does break still work in the onexit function? If so, then that would alleviate the problem I see and allow the script to return to normal operation. In other words, is the break statement tested before, after, or during onexit? Another thing, is onexit called if break is 0 before attempting to close? If so, I vote that the onexit still be called to allow the script to give a messagebox telling the user important information. I also vote for an onpause function. I know this could probably throw a monkeywrench into some things, but I would like to know if the user paused my script so that I can send an email using blat. Is this too much to ask?

When the script is exited the stacks are rolled back (so any functions in progress are exited) until the script is at the normal "global" scope. Then the onexit function is called and works like a normal function - there are no restrictions on what you can do in there. The only thing that _is_ different is that if you exit the onexit function you won't get into problems where onexit is called again. It is only ever called once.

Break has no effect on if the onexit function is called or not. It is always called if it exists. What you choose to do in there is up to you though.

Link to comment
Share on other sites

  • Administrators

Updated:

http://www.autoitscript.com/autoit3/files/unstable/autoit/

Some neato stuff here (no docs though...) let me know how you get on with them. I've only tested them with an explorer window so far but it seems to work pretty well.

- Added: HWND datatype added to variants

- Added: ControlGetHandle()

- Added: ControlCommand(): SysListView32 commands added

Extra listview ControlCommands are:

- LV_GetItemCount

- LV_GetSubItemCount

- LV_GetText, index, subindex

- LV_SelectAll

- LV_SelectClear

- LV_IsSelected, index

- LV_Select, from index, [to index]

- LV_Deselect, from index, [to index]

- LV_GetSelected, [0 = single/first, 1 = multiple delimited by | ]

Tech:

Larry mentioned that to get these control functions to work you had to do shared process memory stuff like in StatusBarGetText. Oh yes. And it is REALLY annoying so i've written a new class that allows you to allocate and write to shared memory without having to worry about the differences between NT and 95 (not to mention the fact that you have to dynamically load the functions to maintain 9x compatibility)

Link to comment
Share on other sites

Jon, I've found two bugs.

1) GUICreate() doesn't appear to return a handle that you can use as is, it still needs to be in the "handle=" & GuiCreate() form.

2) The following code has a problem:

Opt("WinTitleMatchMode", 4)
Opt("TrayIconDebug", 1)
$hwnd = "handle=" & GUICreate("Test", 100, 100)
GUIShow()
While WinExists($hwnd)
    $msg = GUIMsg(0)
    If $msg = -3 Then GUIDelete()
Wend

The problem is, the GUI is properly deleted (Spy++ confirms this), however, the loop is never exited, so the GUI is closed, but the script never exits.

Link to comment
Share on other sites

  • Administrators

Jon, I've found two bugs.

1) GUICreate() doesn't appear to return a handle that you can use as is, it still needs to be in the "handle=" & GuiCreate() form.

2) The following code has a problem:

Opt("WinTitleMatchMode", 4)
Opt("TrayIconDebug", 1)
$hwnd = "handle=" & GUICreate("Test", 100, 100)
GUIShow()
While WinExists($hwnd)
    $msg = GUIMsg(0)
    If $msg = -3 Then GUIDelete()
Wend

The problem is, the GUI is properly deleted (Spy++ confirms this), however, the loop is never exited, so the GUI is closed, but the script never exits.

Heh, I didn't even realize that GuiCreate returned a handle :">

Fixed now.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...