 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
charliemopps
Joined: 09 Feb 2006 Posts: 117
|
Posted: Thu Dec 11, 2008 4:30 pm Post subject: Help me improve this script... |
|
|
I posted this earlier but forgot to log in... lol
| Code: | #SingleInstance Ignore
Run Uniphi Connect CM05
Loop,
{
ControlGetText, OutputVar, ThunderRT6TextBox4, Aspect Uniphi Connect
If OutputVar = Type WrapUp Code, press ENTER
{
WinActivate Aspect Uniphi Connect
Gui, +AlwaysOnTop
Gui, Font, S24 CDefault Bold, Verdana
Gui, Add, Text, x6 y0 w310 h40, Get Out of Wrap!
Gui, Font, S8 CDefault, Verdana
Gui, Show, x171 y222 h40 w316, You're in Wrap!
Return
}
If OutputVar = WRAP UP
{
WinActivate Aspect Uniphi Connect
Gui, +AlwaysOnTop
Gui, Font, S24 CDefault Bold, Verdana
Gui, Add, Text, x6 y0 w310 h40, Get Out of Wrap!
Gui, Font, S8 CDefault, Verdana
Gui, Show, x171 y222 h40 w316, You're in Wrap!
Return
}
Sleep, 120000
} |
Basically, I would like it a little more efficiant. Also, it checks the application at 2min intervals... Any ideas on how I could make it check, see that the person is in the wrong state, wait to min, check again, and then warn them?
Also, is there an If/or statement? So I could make that 1 check rather than 2?
Thanks!
P.S. Anyways to make the pop-up window more annoying would be appretiated... blinking or whatever.
[Deleted double post. ~jaco0646] |
|
| Back to top |
|
 |
Dra_Gon
Joined: 25 May 2007 Posts: 373
|
Posted: Thu Dec 11, 2008 5:08 pm Post subject: |
|
|
There is an If...Else {search the docs}. As for the "annoying" you can use:
Which is also in the docs. I know it's annoying whenever I see it flashing on the Task Bar.
I'd put something like this:
| Code: | #SingleInstance Ignore
Run Uniphi Connect CM05
Loop,
{
ControlGetText, OutputVar, ThunderRT6TextBox4, Aspect Uniphi Connect
If(OutputVar = "Type WrapUp Code, press ENTER", OutputVar = "WRAP UP")
{
WinActivate Aspect Uniphi Connect
Gui, +AlwaysOnTop
Gui, Font, S24 CDefault Bold, Verdana
Gui, Add, Text, x6 y0 w310 h40, Get Out of Wrap!
Gui, Font, S8 CDefault, Verdana
Gui, Show, x171 y222 h40 w316, You're in Wrap!
Gui Flash
Return
}
Sleep, 120000
} |
It can probably be done a bit neater, but I'm not all that sophisticated.
Ciao,
Dra'Gon _________________
For a good laugh {hopefully} >> megamatts.50megs.com
My WritersCafe profile>>
http://www.writerscafe.org/writers/BlueDragonFire/ |
|
| Back to top |
|
 |
silveredge78
Joined: 25 Jul 2006 Posts: 481 Location: Midwest, USA
|
Posted: Thu Dec 11, 2008 5:15 pm Post subject: |
|
|
I don't know if it will help your efficiency or not, but I would do what you're wanting using a SetTimer at the appropriate interval and the contents of the Loop as a subroutine. _________________ SilverEdge78 |
|
| Back to top |
|
 |
charliemopps
Joined: 09 Feb 2006 Posts: 117
|
Posted: Thu Dec 11, 2008 5:57 pm Post subject: |
|
|
| silveredge78 wrote: | | I don't know if it will help your efficiency or not, but I would do what you're wanting using a SetTimer at the appropriate interval and the contents of the Loop as a subroutine. |
Could you give me an example? I've not used that before. |
|
| Back to top |
|
 |
charliemopps
Joined: 09 Feb 2006 Posts: 117
|
Posted: Thu Dec 11, 2008 6:02 pm Post subject: |
|
|
| Dra_Gon wrote: | There is an If...Else {search the docs}. As for the "annoying" you can use:
Which is also in the docs. I know it's annoying whenever I see it flashing on the Task Bar.
I'd put something like this:
| Code: | #SingleInstance Ignore
Run Uniphi Connect CM05
Loop,
{
ControlGetText, OutputVar, ThunderRT6TextBox4, Aspect Uniphi Connect
If(OutputVar = "Type WrapUp Code, press ENTER", OutputVar = "WRAP UP")
{
WinActivate Aspect Uniphi Connect
Gui, +AlwaysOnTop
Gui, Font, S24 CDefault Bold, Verdana
Gui, Add, Text, x6 y0 w310 h40, Get Out of Wrap!
Gui, Font, S8 CDefault, Verdana
Gui, Show, x171 y222 h40 w316, You're in Wrap!
Gui Flash
Return
}
Sleep, 120000
} |
It can probably be done a bit neater, but I'm not all that sophisticated.
Ciao,
Dra'Gon |
For some reason, this doesnt work at all. it never triggers. hmm |
|
| Back to top |
|
 |
silveredge78
Joined: 25 Jul 2006 Posts: 481 Location: Midwest, USA
|
Posted: Thu Dec 11, 2008 6:02 pm Post subject: |
|
|
Look at the documention for SetTimer. As for an example, perhaps something like (not tested):
| Code: |
#SingleInstance Force
#Persistent
SetTimer, VarCheck, 120000
Return
VarCheck:
ControlGetText, OutputVar, ThunderRT6TextBox4, Aspect Uniphi Connect
If(OutputVar = "Type WrapUp Code, press ENTER", OutputVar = "WRAP UP")
{
WinActivate Aspect Uniphi Connect
Gui, +AlwaysOnTop
Gui, Font, S24 CDefault Bold, Verdana
Gui, Add, Text, x6 y0 w310 h40, Get Out of Wrap!
Gui, Font, S8 CDefault, Verdana
Gui, Show, x171 y222 h40 w316, You're in Wrap!
Gui Flash
Return
}
Return
|
_________________ SilverEdge78 |
|
| Back to top |
|
 |
charliemopps
Joined: 09 Feb 2006 Posts: 117
|
Posted: Fri Dec 12, 2008 1:58 pm Post subject: |
|
|
again, this doesn't seem to detect the state.
Somethings wrong with that IF statement. |
|
| Back to top |
|
 |
silveredge78
Joined: 25 Jul 2006 Posts: 481 Location: Midwest, USA
|
Posted: Fri Dec 12, 2008 3:55 pm Post subject: |
|
|
I'm not sure what is wrong with the If. I was merely demonstrating how to use a SetTimer. Best of luck.
Perhaps redo | Code: | | If(OutputVar = "Type WrapUp Code, press ENTER", OutputVar = "WRAP UP") | to | Code: | | If (OutputVar = "Type WrapUp Code, press ENTER", OutputVar = "WRAP UP") | which included a space between the If and the (. Or perhaps | Code: | | If ((OutputVar = "Type WrapUp Code, press ENTER") Or (OutputVar = "WRAP UP")) | which is a compound expression. _________________ SilverEdge78 |
|
| Back to top |
|
 |
Dra_Gon
Joined: 25 May 2007 Posts: 373
|
Posted: Fri Dec 12, 2008 5:13 pm Post subject: |
|
|
Another thing, how did you find out the control you want is "ThunderRT6TextBox4"? If this isn't in an AHK script {Aspect Uniphi Connect} you can use the AU3_Spy.exe to find out EXACTLY what that control is called and what your script needs to look for. This could be the reason your script isn't working.
Put this after your ControlGetText line:
| Code: | | msgbox, %outputvar% |
You will see what you're getting in the Outputvar.
I'm not saying that you need to tell us absolutely everything about your program or what it's used for, but the more info we have, the better we can help you get your script going. Otherwise we'd just have to keep making guesses and that gets a bit old after a while.
Ciao,
Dra'Gon _________________
For a good laugh {hopefully} >> megamatts.50megs.com
My WritersCafe profile>>
http://www.writerscafe.org/writers/BlueDragonFire/ |
|
| Back to top |
|
 |
charliemopps
Joined: 09 Feb 2006 Posts: 117
|
Posted: Fri Dec 12, 2008 8:16 pm Post subject: |
|
|
| Dra_Gon wrote: | | you can use the AU3_Spy.exe to find out EXACTLY what that control is called and what your script needs to look for. |
That's what I did. =)
The script works fine until I try the compound expression. Anyways, this whole things on hold for the moment. The non-fancy version is working for the moment. |
|
| 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
|