Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > Other Topics > Programming

Notices

Programming Discussions about computer programming

Reply
 
Thread Tools Display Modes
Old 08-04-2012, 12:06 AM   #1
veteran
 
LazyAce's Avatar
 
Join Date: Jul 2010
Posts: 2,115
Where to find more info on WSR Macros?

Hey first off, I am completely new to programming. I've learned a few extremely basic things in Java, CSS, HTML in the past but that's about it.

WSR(Windows Speech Recognition) Macros is a recent fascination of mine. I started experimenting with it because I play a lot of poker and spend a lot of hours doing it and thought it would be cool to start using speech recognition to automate some things.

I use Table Ninja and play on Poker Stars, so life is pretty easy already in terms of being able to control tables and rarely ever having to use my mouse during a session.

There are some macros that I would like to create but need some more advanced and detailed instruction on how to code things properly. Google doesn't bring up much. There is a guide written but I was hoping to find something for free. I was surprised at how hard it is to find anything on the net considering how useful speech macros can be and how long these tools have been available.

I even checked my local library and there was nothing

Should I just try and learn everything I can about XML and apply it to <speechMacros>?
LazyAce is offline   Reply With Quote
Old 08-04-2012, 06:32 PM   #2
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK
Posts: 9,147
Re: Where to find more info on WSR Macros?

Pretty sure you can hook WSR up to AHK and use it to trigger AHK functions "on Speech", opening up all manner of powerful macroing options. here's the

initial stuff: http://www.autohotkey.com/community/...d630c&start=30 (there's also a python example in the OP of this thread)

more recent (use this version): http://www.autohotkey.com/community/...ic.php?t=26841

of course if you aren't too familiar with AHK this might not help much lol, but we can help with that
_dave_ is offline   Reply With Quote
Old 08-05-2012, 01:29 AM   #3
veteran
 
LazyAce's Avatar
 
Join Date: Jul 2010
Posts: 2,115
Re: Where to find more info on WSR Macros?

Hey Dave, thanks for the info. Just downloaded AHK and am working through the quick start tutorial. I knew a little bit about AHK scripts before but not sure why I never thought about using them in conjunction with the WSR Macros. Thanks again, and I'm sure you'll see me around with lots of questions itf.
LazyAce is offline   Reply With Quote
Old 08-05-2012, 01:50 PM   #4
Carpal \'Tunnel
 
jukofyork's Avatar
 
Join Date: Sep 2004
Posts: 10,213
Re: Where to find more info on WSR Macros?

Yeah, I think AHK is the way to go too. I was looking at the WSR macros the other day (possibly it was for you in the other thread?) and they look fairly limited in what you can do.

Juk
jukofyork is offline   Reply With Quote
Old 08-05-2012, 05:31 PM   #5
veteran
 
LazyAce's Avatar
 
Join Date: Jul 2010
Posts: 2,115
Re: Where to find more info on WSR Macros?

Just wanna say thanks again. I'm really getting into this a lot. Its strangely addicting.

Since starting out yesterday with AHK i've created scripts that send my mouse to a specific seat on a fullring table, and copy the players name to clipboard and append that to a buddy list. That was easy, but I'm having a hard time trying to get my head around how to execute the list so that it searches for each player in the Stars client one at a time.

I know that there is probably already a script out there that does this but was just enjoying creating something on my own.

The way I'm going about it is using the Loop, Read command. From what I understand this makes it read each line in the designated file one at a time.

Quote:
The built-in variable A_LoopReadLine exists within any file-reading loop. It contains the contents of the current line excluding the carriage return and linefeed (`r`n) that marks the end of the line. If an inner file-reading loop is enclosed by an outer file-reading loop, the innermost loop's file-line will take precedence.
^This is from the AHK help. If I understand this correctly, the A_LoopReadLine variable doesn't need to be defined by me since it says its build in right? I want to make the clipboard = A_LoopReadLine but keep getting errors because I don't know how to write it out correctly.

Can somebody help me out with how to properly go about this?

Thanks!

Edit: I'm using Notepad to code everything. As a complete newb, should I look into getting a (free) AHK editor? Will that help me out with correct syntax?
LazyAce is offline   Reply With Quote
Old 08-05-2012, 05:50 PM   #6
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK
Posts: 9,147
Re: Where to find more info on WSR Macros?

I use PSPad, it's free and after changing a few settings it colour codes AHK syntax and makes things much easier to read/write.

your example would be either of:
Code:
clipboard := A_LoopReadLine
clipboard = %A_LoopReadLine%
I go for the first, use := all the time so you rarely have to use % signs and literal strings are always "quoted"

If something is giving you trouble with variables like this, an easy debugging thing to do is replace what you're trying to do with
Code:
MsgBox, %A_LoopReadLine%
to check the actual contents of the variable in question as it spins through the loop
_dave_ is offline   Reply With Quote
Old 08-05-2012, 06:45 PM   #7
veteran
 
LazyAce's Avatar
 
Join Date: Jul 2010
Posts: 2,115
Re: Where to find more info on WSR Macros?

Thanks again, I just tested that out and it works

Is it frowned upon for me to continuously ask random questions? I'm trying and intend to continue working on my own as much as I can with this, but sometimes I just get stumped. If there is a low content/quick newbie question type thread then I'd gladly post my newb questions there.

Hopefully newb questions are all good around here cuz I have a lot.

I'm trying to create this buddy list script to run on Stars. I've got it to the point where it reads the buddylist.txt file, copies the first line to clipboard, opens up the find player dialogue and hits enter.

Now, there are two possible outcomes - the player is either found or now found. In the event that he is found, Stars gives you a pop window whose title is Find a Player, and the contents of the window show you all the tables that player is seated at. If the player is not found, Stars gives you a different pop up saying the player was not found, however, the window title is the same. So how do I differentiate between two windows that have obvious differences but have the same title?

I've just realized that my Add Buddy script is broken:

Code:
^b::
click 2
click 130,475
send ^a^c
FileAppend, %clipboard% `n, C:\Users\James\Documents\BuddyList.txt
MsgBox %clipboard% Added to Buddy List
For some reason, whenever I execute it pastes the contents of the previous player that I tried to add buddy too. Not sure why?? It's as if the FileAppend line is running before send^a^c.

EDIT: I'm guessing that what is happening is that AHK is treating the contents of the clipboard as whatever was on it before the hotkey is pressed?

Last edited by LazyAce; 08-05-2012 at 07:05 PM.
LazyAce is offline   Reply With Quote
Old 08-05-2012, 07:06 PM   #8
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK
Posts: 9,147
Re: Where to find more info on WSR Macros?

Ask as many random questions as you like. here is fine, as is the LC thread in this forum

Add the command
Code:
clipboard := ""
before and
Code:
ClipWait,1
after your Send, ^a^c http://www.autohotkey.com/docs/commands/ClipWait.htm (make it blank, do the copy, wait until it's got data). Clipboard can take a little while to update with new data, enough for your fileappend line to have already executed.

WinGet, , ControlList is good for finding differences between windows of the same title: http://www.autohotkey.com/docs/commands/WinGet.htm or just a WinGetPos to find out it's width/height if they can be relied upon
_dave_ is offline   Reply With Quote
Old 08-05-2012, 09:34 PM   #9
veteran
 
LazyAce's Avatar
 
Join Date: Jul 2010
Posts: 2,115
Re: Where to find more info on WSR Macros?

Quote:
Originally Posted by _dave_ View Post
Ask as many random questions as you like. here is fine, as is the LC thread in this forum

Add the command
Code:
clipboard := ""
before and
Code:
ClipWait,1
after your Send, ^a^c http://www.autohotkey.com/docs/commands/ClipWait.htm (make it blank, do the copy, wait until it's got data). Clipboard can take a little while to update with new data, enough for your fileappend line to have already executed.

WinGet, , ControlList is good for finding differences between windows of the same title: http://www.autohotkey.com/docs/commands/WinGet.htm or just a WinGetPos to find out it's width/height if they can be relied upon
This is so helpful, thank you. The ClipWait worked great.

Now I'm trying too create an IF statement dependant on the value of the width of the active window, but I can't get it working.

Code:
^g::
WinGetPos, X, Y, Width, Height, A
If (%width% = 808)
{
MsgBox, YES!
}
else
{
Msgbox, NO!
}
I've confirmed that the window i'm using does infact have a width of 808, but I always get a NO! here.

What am I doing wrong?

EDIT: Okay I think I've figured this part out

Code:
^g::
WinGetPos, X, Y, Width, Height, A
If ( width = 808 )
{
MsgBox, YES!
}
else
{
Msgbox, NO!
}
Getting confused between the name of the variable and the %value% right?

Last edited by LazyAce; 08-05-2012 at 09:40 PM.
LazyAce is offline   Reply With Quote
Old 08-05-2012, 09:44 PM   #10
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK
Posts: 9,147
Re: Where to find more info on WSR Macros?

it's the % signs - only ever need use them to "unwrap" a variable when the program is expecting an unquoted string (like after a msgbox) Also doesn't matter iirc but for the sake of "normal" I always use == for explicit comparison inside an if.

Code:
^g::
WinGetPos, X, Y, Width, Height, A
If (width == 808)
{
  MsgBox, YES!
}
else
{
  Msgbox, NO!
}
_dave_ is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -4. The time now is 01:45 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.
Copyright © 2008-2010, Two Plus Two Interactive