Jump to content

Recommended Posts

Posted

Right now the script will exit immediately if I don't pause it somehow (obvious of course).

I was  curious on people's opinions of how they do it or what option they prefer below? Thanks

Option 1 (I prefer)

#include <MsgBoxConstants.au3>

HotKeySet('^!p', SomeFunc)

ProcessWaitClose(@AutoItPID)

Func SomeFunc()
    MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after 10 seconds or select the OK button.", 10)
EndFunc

Option 2 (in the help file)

#include <MsgBoxConstants.au3>

HotKeySet('^!p', SomeFunc)

While Sleep(100)
WEnd

Func SomeFunc()
    MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after 10 seconds or select the OK button.", 10)
EndFunc

Option 3

#include <MsgBoxConstants.au3>

HotKeySet('^!p', SomeFunc)

While 1
    GUIGetMsg() ; Use the internal sleep
WEnd

Func SomeFunc()
    MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after 10 seconds or select the OK button.", 10)
EndFunc

 

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • Moderators
Posted

guinness,

Nice to see you here.

Personally I always use a mixture of 2 & 3:

While 1
    Sleep(10)
WEnd

But I must say I quite like your preferred version.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

Hey @Melba23,

Yeh, so I was just playing around with the new AutoIt release, and thought to myself why is it that I too have always used option 2 or 3, because option 1 seems like a clearer choice. I did a quick search on the Forum and found that it hadn't really been suggested, so thought I would ask to see if my AutoIt skills were somewhat lacking!

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted
  On 4/22/2018 at 7:04 PM, JohnOne said:

Use both 2 and 3.

No Idea about the poll rate or overhead of 1.

Expand  

It uses the default idle time, which is 10ms

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted
  On 4/22/2018 at 7:58 PM, JohnOne said:

Cheers.

Still probably wouldn't use it myself, just seems a bit wasteful of cpu cycles and of course energy in general.

Expand  

True

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

I've never been a big fan of HotKeySet, so I use Option 4, which uses _IsPressed() ..... opening and closing the DLL of course, and using While...Wend usually.

But it is always nice to see the other options available, so thanks. :D

Trust me to be different hey. :muttley:

The main reason I guess, is because depending on your system I have often found Hotkeys to be slow or unreliable.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

  Reveal hidden contents

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Posted

i had never considered #1.  I imagine I will use it widely as i do fancy a good one liner.

  Reveal hidden contents

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
×
×
  • Create New...