Using micromacro with smartphone app via PC?

Ask questions about cheating in any games you would like. Does not need to pertain to MicroMacro.
Message
Author
Atlas123
Posts: 37
Joined: Wed Jul 13, 2011 8:31 pm

Using micromacro with smartphone app via PC?

#1 Post by Atlas123 » Thu Aug 30, 2012 9:36 pm

Hello,

So there is an app I would like to use a macro on for farming.

First of all, I know initial requirements are: Free&jailbreak smartphone, use app to link/use smartphone from PC (via a window)

Now, my question is: Can I build something for farming in this scenario with micromacro Or should I use something else?

I know I could use something like "easy macro recorder" but there is a very long refresh period between farming respawns therefore not sure it would work out (i think the macro would be "lost" as soon as the first farming item was not there. Also I would feel more comfortable using micromacro.

Any initial thoughts? (please do not be too harsh)

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Using micromacro with smartphone app via PC?

#2 Post by Administrator » Fri Aug 31, 2012 12:31 am

So, you want to run MicroMacro on your PC, but able to control it with your phone? Or did I misunderstand you?

If that's the case, you might be able to just use TeamViewer or something to control your PC.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Using micromacro with smartphone app via PC?

#3 Post by lisa » Fri Aug 31, 2012 3:04 am

the way I understand it they want to do this.

PC has micromacro
Iphone has an App
PC and Iphone are linked up together

they want to use micromacro to automate doing something in the app.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Atlas123
Posts: 37
Joined: Wed Jul 13, 2011 8:31 pm

Re: Using micromacro with smartphone app via PC?

#4 Post by Atlas123 » Sat Sep 01, 2012 3:20 am

Yes that is correct Lisa :)

I guess the "no go" is that the visualisation of the app in the PC is probably just a picture (therefore I am guessing no addresses etc?)

It is maybe a long shot, just asking :)

A key reason I was thinking about micromacro was hoping that micromacro would detect that the item to farm (on the screen) is not there and jump to the next section of the macro with the right instructions.

I know I know, a bit of a noob, if it is too far fetched that is fine, just asking in case i was missing something obvious (what you have already done with Micromacro and ROM is fantastic thanks lol)

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Using micromacro with smartphone app via PC?

#5 Post by lisa » Sat Sep 01, 2012 5:51 am

I think it would all come down to how windows interacts with the app, if it is purely showing an image and can't control the app in any way then it probably won't be possible.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Atlas123
Posts: 37
Joined: Wed Jul 13, 2011 8:31 pm

Re: Using micromacro with smartphone app via PC?

#6 Post by Atlas123 » Sun Sep 30, 2012 4:02 am

lisa wrote:I think it would all come down to how windows interacts with the app, if it is purely showing an image and can't control the app in any way then it probably won't be possible.
Hello again, I was trying to find some options but the solutions I have been finding are very manual, this means I tried macro recorders but I did not have edit options via text editors (which makes the task very tedious and prone to errors). Therefore I am coming back for another try with Micromacro due to its edit macros flexibility.

So... When viewing the app from the PC it is NOT ONLY an image as I can do whatever I can do in the iPhone FROM the PC (via mouse and keyboard strokes).

My plan is to have a series of actions, then copy and paste them in the text editor, then change some coordinates for each paste (or do this with word such as when u do a mailing list link to a template letter with a long list of addresses?).

I will play a bit with Micromacro, although I am not sure if i will have problems such as the window not being in the "right" place when running the repeat actions. Any thoughts are welcome :)

Thank again.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Using micromacro with smartphone app via PC?

#7 Post by lisa » Sun Sep 30, 2012 4:24 am

well if you can interact with the app with keypresses there is a very good chance you can get MM to do those keypresses for you, obviously since I don't have the setup I won't be to much help with it.

The tricky part usually is getting it to attach to the programme, I still haven't been able to attach to something in a webpage.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Atlas123
Posts: 37
Joined: Wed Jul 13, 2011 8:31 pm

Re: Using micromacro with smartphone app via PC?

#8 Post by Atlas123 » Sun Sep 30, 2012 5:00 am

lisa wrote:well if you can interact with the app with keypresses there is a very good chance you can get MM to do those keypresses for you, obviously since I don't have the setup I won't be to much help with it.

The tricky part usually is getting it to attach to the programme, I still haven't been able to attach to something in a webpage.
Yes, I was going through the MM manual about (x,y) and I thought... "How do I link it to the game window or determine the coordinates on the window?" (Not sure if it makes a difference but it is an application window rather than a webpage).

But if MM can be used with other games, there must be a way to link it to the window coordinates (lack of knowing what the correct term would be here), will continue looking at the manual see if I am jumping a step ^^

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Using micromacro with smartphone app via PC?

#9 Post by lisa » Sun Sep 30, 2012 5:27 am

Ok well you should look at learning to use cheat enguine, you will find it very useful if you can manage to use it.

Secondly there is a function, which escapes my memory at the moment which will do a print of all processes and their names, this makes it much easier to determine the name of the class, which you will need.

Secondly you will need to start writing your own little scripts for it and just start small by doing prints, especially to check if it is getting the right process.

Lol I secondly twice.

Anyway.
So make a new folder in scripts/ and call it what ever you want.
In that folder make a new .lua file, you will need to get an editor like notepad++ to help write the code.

put at the top of the file

Code: Select all

local windowList = findWindowList("*","ArenaNet_Dx_Window_Class");
if( #windowList == 0 ) then
	print("You need to run Some App first!");
	return 0;
end

function getWin()
	if( __WIN == nil ) then
  		__WIN = windowList[1]
	end

	return __WIN;
end	

function getProc()
	if( __PROC == nil or not windowValid(__WIN) ) then
		if( __PROC ) then closeProcess(__PROC) end;
		__PROC = openProcess( findProcessByWindow(getWin()) );
	end

	return __PROC;
end
the ArenaNet_Dx_Window_Class is where you need to put the class for your programme you use(I'll have a look for the function which will make it easier). Basically when you run that file it will look for the window, if you have the name wrong it will print to MM
You need to run Some App first!
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Using micromacro with smartphone app via PC?

#10 Post by lisa » Sun Sep 30, 2012 6:11 am

I couldn't find the function, I might have even added in my own at the time I remember using it *shrug*

Anyway to get the class name you can do it this way.
Google winspector and download + install it

start up your thingy and then start winspector, at the top of winspector there is a cross hair, drag it to the thingy you use and then let go. You will get something like this pic.
winspect1.jpg
In this example I used Guild wars 2, so it auto expands the right spot and has it "highlighted"

You can see the executable name as GW2 and also the window name as "Guild Wars 2" the bit next to window name is class name, in this case the ArenaNet_Dx_Window_Class which i mentioned in the last post.

After that it is pretty much easy sailing, lol not really but it's a start.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Atlas123
Posts: 37
Joined: Wed Jul 13, 2011 8:31 pm

Re: Using micromacro with smartphone app via PC?

#11 Post by Atlas123 » Sun Sep 30, 2012 4:31 pm

Hoookeey... Sorry brains just a bit overloaded lol...

So I started to look into cheat engine and the tutorial but still struggling there on how it fits in.

I guess that Winspector replaces what I think you where initially suggesting to do with cheat engine.

I got the information from Winspector and used your .lua file with the new Class. When running the .lua file I did not get any errors and the script stopped (which I guess is good).

When you say build the script I guess you mean use the MM functions in the .lua file (e.g. mouse control () )? Maybe obvious but getting introduced to a new world of tools :)

For the coordinates for each action (e.g. mouse control) I was thinking about using the size available from Winspector as a basis for the coordinates. So if the measures are: 320,481 then I guess coords 320,481 is top right and 1,1 is bottom left?
Maybe this is when you say the cheat engine kicks in? But would this coords approach work?

Thank you and I hope I am not pushing it ;)

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Using micromacro with smartphone app via PC?

#12 Post by lisa » Sun Sep 30, 2012 10:56 pm

Atlas123 wrote:I did not get any errors and the script stopped (which I guess is good).
yup no errors is good.

ok so if it didn't do the print I mentioned then you should have the correct class name.

Next step is to add code to that file now, after the other stuff, just assume anything I post you add to that file at the end.

Code: Select all

local wx, wy, ww, wh = windowRect(getWin());
printf("X: %d, Y:%d, Width: %d, Height: %d\n" wx,wy,ww,wh)
That should print the location of the window and it's width and height, in pixels (i think).

Taking it slow now you have that part going =)

CE will help if you want to read info from memory, you may or may not need/want to. So you can just work on key presses and such first.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Atlas123
Posts: 37
Joined: Wed Jul 13, 2011 8:31 pm

Re: Using micromacro with smartphone app via PC?

#13 Post by Atlas123 » Mon Oct 01, 2012 12:57 pm

mmm... did play around with that and searched around but I get:

')' expected near 'wx'
:S

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Using micromacro with smartphone app via PC?

#14 Post by lisa » Tue Oct 02, 2012 2:30 am

I missed a ,

Code: Select all

printf("X: %d, Y:%d, Width: %d, Height: %d\n", wx,wy,ww,wh)
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Atlas123
Posts: 37
Joined: Wed Jul 13, 2011 8:31 pm

Re: Using micromacro with smartphone app via PC?

#15 Post by Atlas123 » Wed Oct 03, 2012 3:04 am

Yes that worked great thank you :)

I got the X the Y the width and the height. If i change the location of the window the X/Y changes also (which I guess will not be an issue as the window is attached?)

I started looking at the mouse function and I understand that I cannot see actions of the virtual mouse (although then I have no idea what it is doing and where)

So I tried this code from one of the queries Admin responded to for a different thing:

Code: Select all

function main()
   attach( findWindow("TvnWindowClass") );

   mouseSet(1, 200);
   for j = 0,50 do
      mouseSet(1 + j, 200);
      rest(10);
   end
end
startMacro(main, true);
I know it does not follow the previous code you gave me but I was struggling to add the action into that code so I was trying things...

The result was a visible mouse move on the screen but entirely outside the "TvnWindowClass"... Am I jumping again too many steps? :)

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Using micromacro with smartphone app via PC?

#16 Post by lisa » Wed Oct 03, 2012 3:58 am

I am pretty sure the X/Y is the location of the window on your screen, so yeah moving the window will change those values.

So when doing mouse movements you want to use it as part of the width or height of the window and not a spot on your entire screen.

With that code I am pretty sure it will be at that spot on your screen, not window.

So you would use those values you get from the code I posted earlier.

Code: Select all

local wx, wy, ww, wh = windowRect(getWin());
mouseSet(wx, wy);
So that should make the mouse be at the top left? of the window, might be bottom left, can't remember.
you can then use the width and height to point to specific places on your window.

So for example if you wanted to point at the very middle of your window you would do the position + half the width/height.

Code: Select all

local wx, wy, ww, wh = windowRect(getWin());
mouseSet(wx + ww/2, wy+ wh/2);
Doing the mouse like this will make it work no matter where on screen the window is.

you can also use another function to find where the mouse is pointing.

Code: Select all

local mouseX, mouseY = mouseGetPos()
Some things you might find interesting, some not so much. At the end of the day what you use will be what you want to use ;)

So next question is, what do you want MM to do in your app?
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Using micromacro with smartphone app via PC?

#17 Post by Administrator » Wed Oct 03, 2012 12:00 pm

Code: Select all

   attach( findWindow("TvnWindowClass") );
I'm pretty sure that isn't doing what you think it does. Since the window title is not TvnWindowClass, but the class is, you should use "*" as the first argument and "TvnWindowClass" as the second.

Atlas123
Posts: 37
Joined: Wed Jul 13, 2011 8:31 pm

Re: Using micromacro with smartphone app via PC?

#18 Post by Atlas123 » Wed Oct 03, 2012 6:03 pm

Hello Admi, you are right, the code I used was taken out of context and therefore was missing that, but it is in Lisas code :) Thanks.

Hello Lisa,
1/ Some successes:
Got to play with cords and making sure they adapted to the window location with ( for example):

Code: Select all

local wx, wy, ww, wh = windowRect(getWin());
mouseSet(wx + ww-300, wy+ wh-270); 
2/ Some challenges:
I may have got a bit mixed up but I could not find coords with the code you gave me:

Code: Select all

 local mouseX, mouseY = mouseGetPos() 
So I managed to find the mouse cords (x,y) with some code from Admin i found:

Code: Select all

local x,y = mouseGetPos();
printf("x: %d, y: %d\n", x, y); 


But I cannot get Width and Height, therefore I tried this:

Code: Select all

local wx, wy, ww, wh = mouseGetPos();
print("X: %d, Y:%d, Width: %d, Height: %d\n", wx,wy,ww,wh);
But I still cannot get Width and Height for the mouse location printed… Any thoughts?

As for what MM will do, that is a series of approx 25 actions for each farming target, I can imagine how cheat engine, a single process template and a table with coordinates could simplify things but better for me to learn how to walk before I try to fly :)

Again thank you for all the help

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Using micromacro with smartphone app via PC?

#19 Post by lisa » Wed Oct 03, 2012 6:09 pm

yeah use this instead

Code: Select all

local windowList = findWindowList("*","TvnWindowClass");
if( #windowList == 0 ) then
   print("You need to run Some App first!");
   return 0;
end

function getWin()
   if( __WIN == nil ) then
        __WIN = windowList[1]
   end

   return __WIN;
end   

function getProc()
   if( __PROC == nil or not windowValid(__WIN) ) then
      if( __PROC ) then closeProcess(__PROC) end;
      __PROC = openProcess( findProcessByWindow(getWin()) );
   end

   return __PROC;
end

attach(getWin())

--add code after here to do what you want.

local wx, wy, ww, wh = windowRect(getWin());
printf("X: %d, Y:%d, Width: %d, Height: %d\n", wx,wy,ww,wh)

local x,y = mouseGetPos();
printf("x: %d, y: %d\n", x, y); 
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Using micromacro with smartphone app via PC?

#20 Post by lisa » Wed Oct 03, 2012 6:16 pm

Atlas123 wrote:Hello Admi, you are right, the code I used was taken out of context and therefore was missing that, but it is in Lisas code :) Thanks.
Actually I hadn't said to use attach yet.
Hello Lisa,
1/ Some successes:
Got to play with cords and making sure they adapted to the window location with ( for example):

Code: Select all

local wx, wy, ww, wh = windowRect(getWin());
mouseSet(wx + ww-300, wy+ wh-270); 
2/ Some challenges:
I may have got a bit mixed up but I could not find coords with the code you gave me:

Code: Select all

 local mouseX, mouseY = mouseGetPos() 
So I managed to find the mouse cords (x,y) with some code from Admin i found:

Code: Select all

local x,y = mouseGetPos();
printf("x: %d, y: %d\n", x, y); 


But I cannot get Width and Height, therefore I tried this:

Code: Select all

local wx, wy, ww, wh = mouseGetPos();
print("X: %d, Y:%d, Width: %d, Height: %d\n", wx,wy,ww,wh);
But I still cannot get Width and Height for the mouse location printed… Any thoughts?
Ok little explanation.
functions return a set number of values,
mouseGetPos() returns 2
when you use a function with

Code: Select all

HGFHGFG, yyhrgfdffj = mouseGetPos()
you are defining those 2 things to be the values returned by the function, their name can be absolutely anything(within limits)

windowRect(getWin()) returns 4 values.

Code: Select all

lollies, fruit, sugar, flour = windowRect(getWin())
printf("X: %d, Y:%d, Width: %d, Height: %d\n", lollies,fruit,sugar,flour)
As for what MM will do, that is a series of approx 25 actions for each farming target, I can imagine how cheat engine, a single process template and a table with coordinates could simplify things but better for me to learn how to walk before I try to fly :)

Again thank you for all the help
yes crawling before walking would be a good start as well =)
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests