KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Scripting fun
Topic Summary: I basically have no idea what I'm doing
Created On: 03/24/2012 06:42 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 Scripting fun   - jmmra - 03/24/2012 06:42 PM  
 Scripting fun   - monkey8 - 03/26/2012 04:17 PM  
 Scripting fun   - jmmra - 03/27/2012 11:17 AM  
 Scripting fun   - Lunis Orcutt - 03/27/2012 12:06 PM  
 Scripting fun   - monkey8 - 03/27/2012 12:56 PM  
 Scripting fun   - jmmra - 03/27/2012 02:39 PM  
 Scripting fun   - monkey8 - 03/27/2012 02:02 PM  
 Scripting fun   - R. Wilke - 03/27/2012 02:24 PM  
 Scripting fun   - monkey8 - 03/27/2012 02:32 PM  
 Scripting fun   - R. Wilke - 03/27/2012 02:55 PM  
 Scripting fun   - monkey8 - 03/28/2012 06:19 AM  
 Scripting fun   - hmyer - 03/28/2012 07:26 AM  
 Scripting fun   - monkey8 - 03/28/2012 10:44 AM  
 Scripting fun   - R. Wilke - 03/28/2012 08:09 AM  
 Scripting fun   - jmmra - 03/27/2012 02:43 PM  
Keyword
 03/24/2012 06:42 PM
User is offline View Users Profile Print this message


jmmra
New Member

Posts: 19
Joined: 03/02/2012

Hi, everyone --

Has anyone successfully used the "RememberPoint" and "DragToPoint" commands while scripting? I'm trying to use the commands to drag a window from one point on my screen to another, and it's not cooperating at all. Here is what I've written:

 Sub Main
 SetMousePosition 0, 1000, 400
 Rememberpoint

 SetMousePosition 1, 100, 16
 Dragtopoint

End Sub

If I can get it working, I'm hoping to be able to change the "1000" value to "2000" to quickly and easily drag windows from one monitor to another.

I'd really appreciate any help!

Thanks,
John



-------------------------
 03/26/2012 04:17 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 1990
Joined: 01/14/2008

You need to do this:

Sub Main
 SetMousePosition 0, 1000, 400
 Wait 0.1
 RememberPoint
 Wait 0.1
 SetMousePosition 0, 100, 16
 Wait 0.1
 DragToPoint 1
End Sub

You might also want to look at this for window positioning:

http://www.knowbrainer.com/PubForum/index.cfm?page=viewForumTopic&topicId=4624

Lindsay



-------------------------


www.pcbyvoice.com
www.pcbyvoice.co.uk

 03/27/2012 11:17 AM
User is offline View Users Profile Print this message


jmmra
New Member

Posts: 19
Joined: 03/02/2012

Thanks for the response, Lindsay.

I'm still not having any luck with the command. It doesn't seem to want to drag the window for some reason.

I looked at the API threads, and it seems to be a little bit out of my league. I might just put this project on hiatus for the summer when I have more time to tinker.

Thanks for your help!



-------------------------
 03/27/2012 12:06 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 22624
Joined: 10/01/2006

You might try increasing your wait times from Wait 0.1 to Wait .5 or even Wait 1. Note that Wait 0.1 and Wait .1 are identical. Wait .1 = a 1/10 of a second pause while Wait .5 = a 1\2 second pause.

-------------------------


Click KB 2012 REV D to Download a 30 Day Evaluation of KnowBrainer 2012 


 


 


 

 03/27/2012 12:56 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 1990
Joined: 01/14/2008

John I think Lunis has probably pointed you in the right direction with the wait times.  The other thing to note is at the end of the DragToPoint line there is the numeral '1'which is the part that tells the script to hold down the left-hand mouse button while dragging.  I noticed that you did not have this in your original script, it may default without it anyway but I can't remember so best just check that it is included.

Lindsay

-------------------------


www.pcbyvoice.com
www.pcbyvoice.co.uk

 03/27/2012 02:39 PM
User is offline View Users Profile Print this message


jmmra
New Member

Posts: 19
Joined: 03/02/2012

Lunis and Lindsay,

With your help, I figured it out. The command "DragToHere" is counterintuitive. It should actually be "DragFromHere" because that's what it actually does. I never would have noticed it had you not recommended slowing down the macro with wait times. Below is the finished product which simply drags an open window from one monitor to the next.

Sub Main
 SetMousePosition 1, 50, 20
 Wait 0.5
 RememberPoint
 Wait 0.5
 SetMousePosition 0, 2000, 200
 Wait 0.5
 DragToPoint 1

End Sub

I arbitrarily chose the coordinates 2000, 200. I usually maximize the windows that I work out of, so it doesn't make any difference where they are on the monitor.

 Thanks again for all of your help! I was close to shelving this project for a little while; your persistence is inspiring!



-------------------------
 03/27/2012 02:02 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 1990
Joined: 01/14/2008

Quote:
I looked at the API threads, and it seems to be a little bit out of my league. I might just put this project on hiatus for the summer when I have more time to tinker.


I wouldn't worry about the Windows positioning commands being out of your league but instead just enjoy the benefits of them.  If you follow the procedure below the following commands will be added to your armoury:

top left of display
top right of display
right half of display
left half of display
middle of display
bottom left of display
bottom right of display
bottom half of display
top half of display

you can do the following by voice:

"start Command Browser"
"switch to manage mode"
"click manage"
"click import"

point to the file, e.g. on your desktop, after downloading it below and then just follow the prompts and this commands will be added.  They are easily modified to move stuff onto your second display as well in similar positions.

Lindsay





-------------------------


www.pcbyvoice.com
www.pcbyvoice.co.uk

 03/27/2012 02:24 PM
User is offline View Users Profile Print this message

Author Icon
R. Wilke
Top-Tier Member

Posts: 4392
Joined: 03/04/2007

Quote:
I wouldn't worry about the Windows positioning commands being out of your league but instead just enjoy the benefits of them.

What I worry about is those command being under patent somehow. Or am I wrong?

Rüdiger

 



-------------------------

Well, it's past the point where we can make any changes in the code, but we can still make changes to the Easter Egg!

 03/27/2012 02:32 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 1990
Joined: 01/14/2008

Without doubt using these commands on a Wednesday night, in the summertime, while wearing an orange jumper and yellow socks would be in clear breach of a PCByVoice patent.

Lindsay

-------------------------


www.pcbyvoice.com
www.pcbyvoice.co.uk

 03/27/2012 02:55 PM
User is offline View Users Profile Print this message

Author Icon
R. Wilke
Top-Tier Member

Posts: 4392
Joined: 03/04/2007

Quote:
Without doubt using these commands on a Wednesday night, in the summertime, while wearing an orange jumper and yellow socks would be in clear breach of a PCByVoice patent.

Thanks for pointing it out, as I am fully aware that PCByVoice has only the best lawyers available, so I can take care of it. However, just a while ago, I implemented the same functionality into the Vocola project (although it has never gone public for a couple of reasons), and I discovered that doing this is as easy as taking candy from a baby - if you are familiar with some basic coding, and thanks to Microsoft who delivered all the technology behind it freely available.

But this doesn't mean trying to dispute your efforts and achievements in that area, or anyone else's.

Rüdiger

 



-------------------------

Well, it's past the point where we can make any changes in the code, but we can still make changes to the Easter Egg!

 03/28/2012 06:19 AM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 1990
Joined: 01/14/2008

Quote:
I implemented the same functionality into the Vocola project (although it has never gone public for a couple of reasons), and I discovered that doing this is as easy as taking candy from a baby - if you are familiar with some basic coding, and thanks to Microsoft who delivered all the technology behind it freely available. But this doesn't mean trying to dispute your efforts and achievements in that area, or anyone else's


Yes I remember it well because you were trying to position a window just above the system tray.  So when you decided it was like taking candy from a baby was that before or after I suggested to you using SystemParametersInfo with the SPI_GETWORKAREA.

The code I did for doing Windows positioning has been on the forum (Commands and Scripts) for a few years now and that thread was in fact the opening thread of the Commands and Scripts forum.  In terms of its simplicity then yes it is not exactly rocket science and I agree with your main point being that all the work is done by the Windows API functions and therefore to try and patents such an idea as positioning windows by any method is quite laughable when the Windows API functions were designed specifically for that reason.  If any patent is creditable then it should go to Microsoft.

I think the whole patents system is ludicrous and people just put any number of infinite combinations together and claim a patent.  If you look at the Apple/Microsoft situation, Apple spent years suing Microsoft trying to claim that they stole the whole idea of Windows from them.  Needless to say the court found against them and in the end both Steve Jobs and Bill Gates pretty much admitted that they both stole the idea from Xerox anyway.  When the guys at Xerox, who really came up with the idea, were asked to comment on why they did not patented the idea they said something like … I can't believe someone would try to patent something so blatantly obvious…

Lindsay

-------------------------


www.pcbyvoice.com
www.pcbyvoice.co.uk

 03/28/2012 07:26 AM
User is offline View Users Profile Print this message

Author Icon
hmyer
Senior Member

Posts: 147
Joined: 09/09/2008

Quote:
Steve Jobs and Bill Gates pretty much admitted that they both stole the idea from Xerox anyway. When the guys at Xerox, who really came up with the idea, were asked to comment on why they did not patented the idea they said something like … I can't believe someone would try to patent something so blatantly obvious…

 I don't recall Jobs or Gates admitting to stealing ideas, 

but Xerox did try to sue Apple for the same thing but had their case thrown out.

One of the reasons being they waited too long to sue.



-------------------------

----

 .

 .

 .

 .

Help! I can't see vowels!! (and sometimes "y")

 03/28/2012 10:44 AM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 1990
Joined: 01/14/2008

http://deepaksethspeak.blogspot.co.uk/2011/11/xerox-rich-neighbor-of-steve-jobs-and.html

granted it's all hearsay and web talk and I doubt we will ever know what really went on and who stole what from who.



-------------------------


www.pcbyvoice.com
www.pcbyvoice.co.uk

 03/28/2012 08:09 AM
User is offline View Users Profile Print this message

Author Icon
R. Wilke
Top-Tier Member

Posts: 4392
Joined: 03/04/2007

Quote:
So when you decided it was like taking candy from a baby was that before or after I suggested to you using SystemParametersInfo with the SPI_GETWORKAREA.

Actually it was after you had suggested this, and once I found a different approach (using monitor info), also covering multiple monitors at the same time, just like this:

BOOL CDragonCode::getWorkarea()

{

HMONITOR hMonitor;
MONITORINFOEX mi;
// get the nearest monitor to the passed rect
hMonitor = MonitorFromWindow( m_hOutWnd, MONITOR_DEFAULTTONEAREST );
// get the work area
mi.cbSize = sizeof(mi);
GetMonitorInfo(hMonitor, &mi);
RECT rc;
rc = mi.rcWork;
m_rectTop = rc.top;
m_rectRight = rc.right;

and so on and so forth ...

But it's not that I invented it, I found it in a sample coming straight from Microsoft, and there are hundreds of such similar samples all over the Internet.

So much for intellectual property, altough there is a little bit of work involved when putting the pieces together appropriately.

Rüdiger

 



-------------------------

Well, it's past the point where we can make any changes in the code, but we can still make changes to the Easter Egg!

 03/27/2012 02:43 PM
User is offline View Users Profile Print this message


jmmra
New Member

Posts: 19
Joined: 03/02/2012

Sweet! I'm going to tinker with your prefab scripts!

-------------------------
KnowBrainer Speech Recognition » NaturallySpeaking Speech Recognition » Scripting fun

Statistics
27371 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 2 users logged in.
The most users ever online was 2028 on 04/05/2013 at 07:36 PM.
There are currently 131 guests browsing this forum, which makes a total of 133 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2013 FuseTalk™ Inc. All rights reserved.