 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
HugoV
Joined: 27 May 2007 Posts: 650
|
Posted: Tue Jan 29, 2008 8:50 am Post subject: |
|
|
Ignore the post above, doesn't work (must be something with global v local vars or something I think) anyway, I've tested the code below and it works for me:
As hotkeys:
| Code: | Hotkey, LWIN & Enter, HotkeyOK
Hotkey, LWIN & !E, HotkeyExit
Hotkey, LWIN & !R, HotkeyRepeat |
And these labels:
| Code: | HotkeyOK:
If !DllCall("IsWindowVisible", "UInt", hwnd)
Return
If !End
{
Gui, 2: Hide
Working := !Working, Time1 := A_TickCount
SetTimer, UpdateTray, 250
SetTimer, EndWorkBreak, % Working ? WorkTime*60*1000 : BreakTime*60*1000
}
Return
HotkeyExit:
If !DllCall("IsWindowVisible", "UInt", hwnd)
Return
;MsgBox Hello Exit
If End
ExitApp
Return
HotkeyRepeat:
If !DllCall("IsWindowVisible", "UInt", hwnd)
Return
;MsgBox Hello Repeat
If End
{
End =
Gui, 2: Hide
GoSub, TrayStart
}
Return |
The only problem that I have is that if I use a hotkey like F11 and press that while the OK/EXIT/REPEAT gui is visible it also sends the keypress to the active program (and I've mapped F11 in most of my programs).
But by using "exotic" keycombos like LWIN & Enter, LWIN & Alt-E, LWIN & Alt-R you can prevent that. Suggestions welcome on how to use a regular ENTER without interfering with the active program.
I tried: | Code: | | Hotkey, ~Enter, HotkeyOK | but that didn't seem to do the trick for me. |
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1375
|
Posted: Tue Jan 29, 2008 9:08 am Post subject: |
|
|
It does work:
| Code: |
Hotkey, ~Enter, HotkeyOK
Return
HotkeyOk:
MsgBox, Enter is showing this msgbox and is sending enter to the active window
Return |
|
|
| Back to top |
|
 |
HugoV
Joined: 27 May 2007 Posts: 650
|
Posted: Tue Jan 29, 2008 9:12 am Post subject: |
|
|
That's what I meant - sorry probably wasn't very clear - but how would
you prevent the Enter being sent to the active window?
If I'm typing notepad and and pressing Enter I just want
the "OK" button pressed in the GUI and not start a newline
in notepad. |
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1375
|
Posted: Tue Jan 29, 2008 9:14 am Post subject: |
|
|
Sorry, I dont think I understand??:
| Code: |
Hotkey, Enter, HotkeyOK
Return
HotkeyOk:
MsgBox, Enter is showing this msgbox and isnt sending enter to the active window
Return |
|
|
| Back to top |
|
 |
HugoV
Joined: 27 May 2007 Posts: 650
|
Posted: Tue Jan 29, 2008 9:29 am Post subject: |
|
|
You're right that does work. But (there is always a but isn't there)
when I do this in WB_Timer.ahk
| Code: | | Hotkey, ~Enter, HotkeyOK | It:
- Presses OK in the GUI
- Sends Enter to the active Window
--> not what I want
If I do this
| Code: | | Hotkey, Enter, HotkeyOK |
I've disable my Enter key for all active windows when WB_Timer.ahk
is running (I'm on W2K)
So what would I need to do to:
- have Enter work in the GUI and not the active window
- Keep my Enter working while the script is running
I must be missing something very obivious  |
|
| Back to top |
|
 |
HugoV
Joined: 27 May 2007 Posts: 650
|
Posted: Tue Jan 29, 2008 9:55 am Post subject: |
|
|
I think I have solved it like so:
| Code: | | Hotkey, Enter, HotkeyOK |
| Code: | HotkeyOK:
If !DllCall("IsWindowVisible", "UInt", hwnd) ; if the GUI isn't visible just send the hotkey, that does mean the hotkey is blocked for all other active windows while the GUI is visible (e.g. you can press Enter in notepad while the GUI is visible, so it is still best to choose the hotkeys wisely)
{
Send, {Enter}
Return
}
If !End
{
Gui, 2: Hide
Working := !Working, Time1 := A_TickCount
SetTimer, UpdateTray, 250
SetTimer, EndWorkBreak, % Working ? WorkTime*60*1000 : BreakTime*60*1000
}
Return |
Perhaps there is another/better way... |
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1375
|
Posted: Tue Jan 29, 2008 10:00 am Post subject: |
|
|
oh i see what you mean. sorry its early for me
maybe something like this would work??
| Code: | Hotkey, IfWinActive, ahk_id %hwnd%
Hotkey, Enter, HotkeyOK
Return
HotkeyOk:
MsgBox, Enter only sent to hwnd
Return |
|
|
| Back to top |
|
 |
HugoV
Joined: 27 May 2007 Posts: 650
|
Posted: Tue Jan 29, 2008 10:11 am Post subject: |
|
|
I actually did try that with IfWinExist, but somehow it didn't work, perhaps because it is a hidden Gui? (I did add DetectHiddenWindows, on). I'll try again later...
You can't use IfWinActive because the GUI isn't active as far as I can tell. |
|
| Back to top |
|
 |
automaticman
Joined: 27 Oct 2006 Posts: 372
|
Posted: Tue Jan 29, 2008 6:39 pm Post subject: |
|
|
Thanks to anyone who put their efforts into this solution. It's great, (when used together with ToDoList). So it's "just" an additional frontend to ToDoList with some extra features like slideshow (to me so far).
What I would change:
ESC for closing the entry windows (rather than Alt-c)
Ctrl-Enter for OK (rather than Alt-s) |
|
| Back to top |
|
 |
automaticman
Joined: 27 Oct 2006 Posts: 372
|
Posted: Tue Jan 29, 2008 6:50 pm Post subject: |
|
|
| automaticman wrote: | What I would change:
ESC for closing the entry windows (rather than Alt-c)
Ctrl-Enter for OK (rather than Alt-s) |
That's what I'm using for it:
| Code: |
;; changing some hotkeys for ToDoList
GroupAdd, ToDoListGrp, Capture Task/Idea List ahk_class AutoHotkeyGUI
GroupAdd, ToDoListGrp, New Active Task ahk_class AutoHotkeyGUI
return
#IfWinActive, ahk_group ToDoListGrp
{
ESC::
{
Send, {altdown}c{altup}
return
}
^Enter::
{
Send, {altdown}s{altup}
return
}
}
|
|
|
| Back to top |
|
 |
baddi1973
Joined: 11 Aug 2007 Posts: 3
|
Posted: Sat Feb 02, 2008 11:02 am Post subject: time tracking with ToDoList5.4.2, db CPUlight_Restart.ahk |
|
|
hi
it togles time recording in ToDoList if you dont
use mouse or keyboard defined time.
its in a alpha version and may you could make it better.
may you know SmartWorkTimeTracker, then you know what it wants to be ... maybe one time in future.
| Code: |
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force
; Stop time tracking with ToDoList
; with trick: restarting tool
; first save the currant:
SetTitleMatchMode,2
t= - ToDoList ® AbstractSpoon
IfWinNotExist, %t%
{
tooltip,not exist
sleep,5000
exitapp
}
WinGetTitle, tFullFirst,%t%
SetTitleMatchMode,3
;ahk_class Afx:400000:b:10013:6:513063d
tooltip,save current 15
; ControlSend [, Control, Keys, WinTitle, WinText, ExcludeTitle, ExcludeText]
; ControlSend, , abc, cmd.exe ; Send directly to a command prompt window.
WinActivate, %tFullFirst%
WinWaitActive, %tFullFirst%, ,2
Loop,90
{
tooltip, save - %tFullFirst%
star=*
if star not in %tFullFirst%
break
ControlSend,, ^s , %tFullFirst%
Sleep,100
WinGetTitle, tFullFirst,%tFullFirst%
}
tooltip, close current 17
ControlSend,, {CTRLDOWN}{ALTDOWN}c{ALTUP}{CTRLUP}, %tFullFirst%
Sleep,800
SetTitleMatchMode,2
WinGetTitle, tFullSecond,%t%
SetTitleMatchMode,3
IfWinNotExist, %tFullSecond%
{
tooltip, %tFullSecond% not exist
sleep,5000
exitapp
}
tooltip, reload last - %tFullFirst% 202
Sleep,600
SetKeyDelay , 5, 5,InputThenPlay
Loop,90
{
WinActivate, %tFullSecond%
WinWaitActive, %tFullSecond%, ,2
SetTitleMatchMode,2
WinGetTitle, tFull2,%t%
SetTitleMatchMode,3
if tFull2=%tFullFirst%
{
;msgbox, nice
break
}
WinActivate, %tFullSecond%
WinWaitActive, %tFullSecond%, ,2
IfWinNotActive,%tFullSecond%
continue
Send,{ALTDOWN}f{ALTUP}
;ControlSend,, {ALTDOWN}rf{ALTUP}, %tFull%
Sleep,500
tooltip, reload last 23
WinActivate, %tFullSecond%
WinWaitActive, %tFullSecond%, ,2
IfWinNotActive,%tFullSecond%
continue
Send, {Down 3}r ; reload last
;ControlSend,, {Down 3}r, %tFull% ; reload last
Sleep,100
tooltip, reload last 26
WinActivate, %tFullSecond%
WinWaitActive, %tFullSecond%, ,2
IfWinNotActive,%tFullSecond%
continue
Send,{right}1 ; reload last
;ControlSend,,1, %tFull% ; reload last
}
;--------------------------------
SetTitleMatchMode, 1
WinGetTitle, guiT,TT
tt=OFF
guiTnew=TT %tt%
SetTitleMatchMode, 1
IfWinExist,TT
{
SetTitleMatchMode, 1
WinSetTitle, TT, , %guiTnew%,
}
;--------------------------------
SetTitleMatchMode, 3
t=dB CPUlight v0089 ahk_class AutoHotkeyGUI
WinClose,%t%
WinWaitClose,%t%
Sleep,200
run, dB_CPUlight_v0150.exe
Sleep,800
WinMinimize , %t%
|
|
|
| Back to top |
|
 |
BlackLight Guest
|
Posted: Sun Feb 10, 2008 1:37 pm Post subject: Screenshots of both monitors |
|
|
Hello and a big thank you for this great script!
Would it be possible to make screenshots from a 2nd monitor as well?
Unfortunately I have no clue about AHK, otherwise I would try myself...
Thanks a lot! |
|
| Back to top |
|
 |
Starbuck Guest
|
Posted: Mon Feb 25, 2008 3:05 am Post subject: Experience so far and Enhancement ideas |
|
|
A few weeks ago I had no idea what this utility was, but now that I've been using it for just a few days I'm addicted. Here is a summary of experience and enhancement ideas so far - right or wrong, this is the way I understand things so far:
The tool is designed to be a work/break timer but for those of us who have never used such a thing it's coming in the door as just an excellent way to track time in conjunction with TDL. However, the way it works compels me to immediately start revising the way that I work so that I can benefit from the work/break concept. So in a way the main purpose sort of infects our work habits - but in a very good way!
Initially, and I'm still fighting this, I don't like some program popping up while I'm working, telling me it's time to take a break. Then again, that's the purpose. As I sit here with sore eyes from staring at a monitor too long I realize I really do need to take more breaks, so I'm starting to follow the cues. It's taking me a while to tune it to my liking - I'm more of a 26-4-16 kind of guy, rather than a 10-2-5 or 48-12-3.
As far as enhancements, here are some ideas so far.
- Allow for a reset on the hour in order to get breaks at regular times as well as regular intervals. I sort of like the idea of knowing exactly when I'll be breaking from one effort or another and letting people know exactly when I'll be able to break.
-When changing the settings, allow the new settings to take effect immediately. As it is I think you need to close down the program or wait for the current cycle to finish before it starts with new settings.
- Add ability to associate time blocks with specific kinds of activity. We don't need to follow this all the time but the guideline can help us to remember what we should be doing at specific times and get us back on track, continuing related activity in the next cycle. Examples of regular activity include:
--- Reading news/forums.
--- Lunch
--- Real work
--- Email
--- Open discussion time
- For time keeping (again, a perhaps unintended but yet primary use of this utility) it would be nice to see the following in the task entry popups:
--- Pulldown for client or department codes - general, not too many. (Yes, I suppose we already have a freeform field for this but I find myself entering non-standard codes almost every time I type something in there.)
--- Checkbox for billable.
These can be added by the code at the back-end of the comments, delimited by pipes: otherdata|comments|code|billable
-Sound for timer should be selectable, with one check for break start and another for break end. We're right at the keyboard so we probably don't need audio for break start, the visual cue is good enough. And we might be away from the keyboard during break, so we probably do need audio for break end.
- Allow playing an audio (WAV, MPEG, AU) file rather than a pre-defined sound. I should get familiar with AHK and add this one for myself.
- Allow for a configurable ASCII character that replaces embedded carriage returns. Multiple lines in comments mess up exports but if we can control the delimiter we can zap that into CRLF later.
I raised a couple points in there, first on the pipe delimiter and then on maintaining my own code.
We can easily just put a pipe into our comments to add new fields for ourselves. So if I want a billable flag all I need to do is put " |b " after the comment. Then when the data is imported into Excel there will be a new column for billable items. Kewl, eh? You guys probably do this all the time.
Finally, I understand that this is open source freeware and while I'm familiar with a ton of programming languages and environments, AHK isn't one of them ... yet. The usefulness of this tool (which I refer to as WBT along with TDL) is compelling enough to make me take interest in this AHK thing so that I can maintain my own code, make my own enhancements, and hopefully give changes back to the group - I just need to find some time, which is why I took interest in WBT in the first place. So as a marketing tool this thing is great. It makes me wonder what else is out there in AHK-land that can be used. I'll definitely be looking at it soon.
Anyway, thanks for your time here. And thanks for some great software!
(sorry for the -- dashes -- the List BBCodes don't seem to be working) |
|
| Back to top |
|
 |
TotalBalance
Joined: 22 Jan 2007 Posts: 180 Location: CO, USA
|
Posted: Mon Feb 25, 2008 5:55 am Post subject: |
|
|
Hi Starbuck,
Thank you, more than you know, for the time and effort put into your comment. My focus of recent has been on family and health matters. I've been very neglect on this forum of recent. However, your post motivates me to re-focus some of my time back to WBT.
I'll address your post, in detail, as my first to do on my daily action list (after my doctor appt) tomorrow. Just wanted to give a quick "thank you" now.
P.S. From your post, I can't help but feel our paths have (or should have) crossed? You signed in as a guest so no way to PM you. Hope you rethink signing up as a member of this forum.
P.S.S. The're other posts, deserving a response, I'll be responding to as well. Thx. in advance to everyone who's taken the time to show interest and support in WBT!! _________________ Lars |
|
| Back to top |
|
 |
TotalBalance
Joined: 22 Jan 2007 Posts: 180 Location: CO, USA
|
Posted: Tue Feb 26, 2008 8:17 am Post subject: Re: Screenshots of both monitors |
|
|
| BlackLight wrote: | | Hello and a big thank you for this great script! |
Thanks, my pleasure.
| BlackLight wrote: | | Would it be possible to make screenshots from a 2nd monitor as well? |
Honestly, I don't know. Tic, or others far more knowledgeable than me, is this possible? _________________ Lars |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|