AutoHotkey Community

It is currently May 26th, 2012, 11:06 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 257 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 18  Next
Author Message
 Post subject:
PostPosted: September 17th, 2009, 9:32 am 
Offline

Joined: May 23rd, 2009, 4:48 am
Posts: 361
Location: north bay, california
thanks... so there basically is no standard... hmm... oh well...

could yuo clarify the naming convention you mentioned, labels? _NotifyLabel: or Notify_Label:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 17th, 2009, 10:01 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
I meant _NotifyLabel. Somewhere someone says that helper functions in a lib should start with a _ and also global lib vars with a _ so to be consistent labels should probably also start with an _ :?: (but what do I know)

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 18th, 2009, 9:02 am 
Offline

Joined: May 23rd, 2009, 4:48 am
Posts: 361
Location: north bay, california
i guess that makes sense, and i'll probably make the changes, but don't really like underscores all over the code... but with a name like notify, conflicts could arise... no helper functions or globals needed, so labels are easy enough

new version in first post, 0.43, cleaned up code some, made "_" change, fixing AT (action on timeout instead of click) now, changed Reset option functionality (!!)...

code needs a lot of optimizing (the ShowToolTip() thread has some tips i may try for having a single timer instead of one for each notification) but after AT i think all functionality i want is in there,

tho i may add a sound option (wav file, soundbeep, TTS()) but not sure if that should be handled scriptside or functionside (feedback??)


-gwarble


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 20th, 2009, 7:08 pm 
Offline

Joined: May 23rd, 2009, 4:48 am
Posts: 361
Location: north bay, california
compiling a simple script like:
Code:
#SingleInstance Off
;#NoTrayIcon
 If %0%
 {
  Loop %0% ;= not sure how to put %1% into the function call
   CL%A_Index% := %A_Index%
  If (CL3)
   CL3 := -Abs(CL3)    ;= negative to exitapp after notification
  Notify(CL1,CL2,CL3,CL4,CL5)
 }
 Else
  Notify("Notify Command Line:", "Notify.exe ''Title'' ''Message'' Seconds ''Options'' ''Image''",-30,"",44)
Return
#Include Notify.ahk
yields Notify.exe, which is a useful command line tool (for batch files) to display notifications (without conflicting from those in any scipt using Notify()!) this could easily be expanded to run an application or something on AC or AT...

A dll option would be equally great; Notify.dll... I don't want to bother the AutoHotKey.dll thread since i don't think it is one of the goals of that project yet, but it'd be sweet to be able to compile an AHK function(s) into a .dll, which could then be called from any language

- gwarble

Edit: using the above in a batch file (.cmd, .bat):
Code:
notify.exe waiting...
start /wait notify.exe also waiting
start notify no waiting
notify waiting
can be a good replacement for "pause" or delays or simple UI if nothing else, especially if the command prompt window is not visible... and of course copying notify.exe to your path (win\system32) allows you to use it in any batch file as just "notify x x x"

Edit: to make Notify a better MsgBox equivalent, i'm planning to add a pause script option (or an integrated notification and wait call), and an easier way to use the 4 msgbox icons, probably in the options parameter (like how reset is now?) basically a shortcut to using IN=1-5 and user32.dll as the image (i was wondering where those icons were)


Last edited by gwarble on December 29th, 2011, 10:32 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 31st, 2009, 8:24 pm 
Offline

Joined: May 23rd, 2009, 4:48 am
Posts: 361
Location: north bay, california
i'm not sure if anyone uses this (hugov?), but i'm finding it very useful, and have some plans for implementing options in 2 fashions, the current way, and also without the equals sign to:
show the same modified notification, but not change the static setting... so you could run a colored notification and then the following would revert to the defaults (or statics set with = options)


also planning to clean up the syntax for this functionality, one of the common ways i use it:

Code:
NotifyID := Notify("Title","Msg",0)
Sleep, 5000 ;do something useful and time consuming
Notify("","",0,"Wait",NotifyID)
Notify("Finished!","",3)


or to simulate a paused thread like msgbox (until clicked):
Code:
Notify("","","","Wait",Notify("Pause"))


let me know what you think...

oh also, i need to remove the gui, #:default line so it doesnt effect the running script... anyone know how to detect the notifications without changing the last found window??

- gwarble


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 10:49 am 
Offline

Joined: November 14th, 2007, 2:47 pm
Posts: 335
Location: London, England
Very, very, nice function gwarble.

And sleek design too.

I'm still absorbing how it works, so forgive me if my question is stupid.

I work on multiple monitors and sometimes it would be good to create a Notify() on a monitor that is not the default. (i.e One that does not have the taskbar.)

Is this something that is possible? Could I make the change easily myself, or is it more complicated?

Thanks again!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 6:19 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Yes I use it 8)

Perhaps you can clarify this example for me (and others):
Code:
NotifyID := Notify("Title","Msg",0)
Sleep, 5000 ;do something useful and time consuming
Notify("","",0,"Wait",NotifyID)
Notify("Finished!","",3)
Why did you choose to keep the Notify "active", e.g. the script doesn't 'exitapp' after the you click the notify windows, that part of the lib I never quite got. I mainly use it with the "-3" option to close it. I like to use notify to let me know when certain scripts have finished or are closing... or simple reminders (e.g. go home now)

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 6:40 pm 
Offline

Joined: May 23rd, 2009, 4:48 am
Posts: 361
Location: north bay, california
Hey HugoV, thanks for the feedback and i'm glad you're using it... in the case of a script that does something, and only one thing, you're right... thats how i use it as well...

for your reminders, or for the scripts i usually use it in, which are persistent (two applications i wrote use it a lot, and never exit with them (they exit like any normal app, the notify's are there for status updates, like when firefox tells you a download has completed)

thats when i use that example... so the Title-Message notification will show (and flash, which for me means working)... then some work is done by the script (ie processing a large file, or that sleep 5000), then the "Wait" command kills that notification before showing the finished one...


i should write up some real documentation for these possibilities i guess

thanks
- gwarble


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 8:46 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Just to be sure, what I meant was if you run the above script, it remains active in the systray after the script is finished and you have clicked the notifications as well. E.g. if I use notify in my script I either must use "-seconds" OR explicitly add an exit(app) to my script to ... well exit :D Once there are no more notify windows why does if have to remain "active"

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 10:29 pm 
Offline

Joined: May 23rd, 2009, 4:48 am
Posts: 361
Location: north bay, california
well its either or... using -seconds is useful when the script does one thing and then exits itself, as u are using it...

the above is useful for a script that acts as an application, ie: persistent, has an exitapp in a GuiClose: or something... i'll post an example when i'm not at work, but this might make more sense:

Code:
^1:: ;= CTRL-1
NotifyID := Notify("","Parsing emails...",0)
GoSub, ParseEmails
Notify("","",0,"Wait",NotifyID) ;= closes last notification
Notify("email parsing finished","",3)
GoSub, GuiCreate
Return

ParseEmails:
 Sleep 10000 ;= parsing the emails takes n seconds, where n > 0
Return

GuiCreate:
;make a gui that shows the parsed emails
Return

GuiClose:
ExitApp
Return


make any more sense?

another example that just waits for a click:
Quote:
Notify("","","","Wait",Notify("click here"))

but this should allow a -0 for time to exitapp the way u use it but currently "-0" hasnt been fixed


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 11:31 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
No not really (bit is probably just me) :D
I don't understand why notify should keep a script "open" when it is done notifying. The "-seconds" is useful as you as you can use it to exitapp as well, but why does "seconds" keep the script open when the seconds have passed.
(Disclaimer: I haven't looked at the Notify code indepth, I merely use it, if I did it might sink in)

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 12:15 am 
hmm.... i didnt think that was very far fetched... are all of the scripts you write dedicated to one task (never persistent?)


imagine a script that uses Notify() at the beginning to say welcome to the script:
Quote:
Notify("Welcome",A_ScriptName,5)



and then a little more advanced (but still at startup):
Quote:
NotifyID := Notify("loading settings",A_ScriptName,0)
Sleep 5000 ;= pretend to be loading settings or something
Notify("","",0,"Wait",NotifyID) ;= closes last notification
Notify("settings loaded successfully ",A_ScriptName,5)
Sleep 4000
Notify("Goodbye","",-3) ;= this one does exitApp




these examples are using notify() without being involved with the exitapp at all...

make sense?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 3:24 am 
Offline

Joined: May 23rd, 2009, 4:48 am
Posts: 361
Location: north bay, california
hey, i think the confusion may be arising because using Notify() would cause a normally non-persistent script to become persistent without the # directive (because of using gui commands), so thats why a negative duration is used...


what i'm talking about is a script that is persistent (# directive or not) and desired to be, in which you usually have to use an exitapp somewhere anyway... in these cases one can use Notify() all over the place, not wanting to exitapp... except maybe Notify("goodbye","",-3) at the end for the exitapp.

I've written a few applications (that i run and distribute compiled) that use it, some for real time notifications of other equipment, some for "balloon tip" replacements (for multiple simultaneous)...

- gwarble


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 11:57 am 
Offline

Joined: November 14th, 2007, 2:47 pm
Posts: 335
Location: London, England
When Notify()'s are created, do you think it would be possible to Dock them to a window, using Majkinetors Dock() function?

Or are we restricted to where Notifys can appear?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 9:56 pm 
Offline

Joined: May 23rd, 2009, 4:48 am
Posts: 361
Location: north bay, california
sure it would be possible... from what i've seen of Dock()... i think that may merit another aux function, but i was toying with the idea of making the position on the screen optional (ie centered, left side, etc) and docking may be a nice option to include, i'll look into it

part of the purpose of the notifications done like this is to support multiple, from any number or scripts/sources... and not have them interfere/cover eachother... how would you like that handled in the case of docked notifications? probably stack them in the window they are docked to, and ignore ones that are docked to other windows/desktop??

- gwarble

thanks for trying it


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 257 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 18  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot], Stigg and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group