Open iTunes / request song

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
aboredprogrammer
Junior Coder
Posts: 40
Joined: Wed Jan 27, 2010 6:31 am

Open iTunes / request song

Post by aboredprogrammer » Thu Jan 28, 2010 2:19 am

Hello,

I am trying to figure out a way I can make this program work, if possible. What I would like to do is have a dialog box with an option to type in a song that is located in the users iTunes library, and after typing the song in they hit "Search" and it will open iTunes, type the song in, and play it. Is this possible? If so how would I go about doing this?

Thanks!

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Post by gdyvig » Thu Jan 28, 2010 3:59 am

Hi aboredprogrammer,

It is not necessary to move the game to the 0,0 location. As long as the game is fully displayed it can be anywhere on the screen.

The window commands GetActiveWindow, GetWindowPos, and GetWindowSize will tell you the location of the window without moving the cursor. Also, a "window" can also be a control such as a button.

The FindImagePos command will tell you the location(s) of images representing buttons and other controls, also without moving the cursor.

Of course, to actually play the game you must activate the game window and move cursor (whether visible or not) and click the mouse.


How do you prevent boredom while the script plays the game for you?


Gale

User avatar
aboredprogrammer
Junior Coder
Posts: 40
Joined: Wed Jan 27, 2010 6:31 am

Post by aboredprogrammer » Thu Jan 28, 2010 4:48 am

Hello,

I believe you posted on the wrong thread of mine, but that's perfectly fine. I was looking for this answer as well! This is what I exactly want to do. I am writing a program that will automatically play an online game for you. Instead of moving the screen to 0,0. I haven't used Macro Sched since 2004, so I'm kinda back at the beginning with everything. So how exactly would I be able to find the game screen/button? I'm sorry for any inconveniences.

aboredprogrammer

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Post by gdyvig » Thu Jan 28, 2010 5:16 am

My favoritye method that almost always works is Image Recognition, introduced in version 9, so you may need to upgrade.

This might get you started:

http://www.mjtnet.com/blog/2007/02/20/h ... cognition/

The GetWindowPos and GetWindowSize methods depend on the the availablility of the Windows properties for the control in question. Once you get the coordinates you use the same methods as outlined in the image recognition article.

If the game is web based and windows properties are not available, you may need to use the web recorder.

JRL wrote a lot of articles on your question concerning dialogs. Try searching the forums for the word "dialog".


Gale

User avatar
aboredprogrammer
Junior Coder
Posts: 40
Joined: Wed Jan 27, 2010 6:31 am

Post by aboredprogrammer » Thu Jan 28, 2010 5:50 am

Thanks a lot Gale! I watched some of the video tutorials and they helped a lot. One more question though.. I plan on distributing my finished products to customers. In order for the image recognition to be successful, wouldn't my customers have to have (ex.) image.bmp on their computers? Therefore, if they don't it will only work on mine, correct? What would be a way to have this work on their computers?

aboredprogrammer

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts