Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.
Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.
This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
-
ZZZZZ
- Posts: 513
- Joined: Sun Oct 21, 2012 1:42 am
#1
Post
by ZZZZZ » Sat Aug 29, 2015 9:29 pm
Just wondering how do I get the handle proc of the Micromacro window that is executing said code? Trying to use
process.terminate(handle proc) to close MM when the ArcheAge window it is attached to closes.
Tried
Code: Select all
process.terminate(window.getAppHwnd())
but getAppHwnd returns a number and I need userdata which I have no idea how to acquire
Code: Select all
Failed to run init function, err code: 7 (Runtime error)
aatest.lua:38: bad argument #1 to 'terminate' (userdata expected, got number)
stack traceback:
[C]: in field 'terminate'
aatest.lua:38: in function <aatest.lua:31>
Probably some simple function that I havn't seen ^.^
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#2
Post
by rock5 » Sat Aug 29, 2015 9:47 pm
I don't have mm2 installed but from looking at the documentation
open
procHandle process.open(number procId)
Attempt to open and return a handle to a process for reading/writing. Accepts only the process's ID.
Maybe you can use
Code: Select all
handle = process.open(window.getAppHwnd())
process.terminate(handle)
I'm not sure but maybe you can also use
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:
- “They say hard work never hurt anybody, but I figure, why take the chance.”
-
ZZZZZ
- Posts: 513
- Joined: Sun Oct 21, 2012 1:42 am
#3
Post
by ZZZZZ » Sat Aug 29, 2015 9:59 pm
Na no go.
Code: Select all
Failed to run init function, err code: 7 (Runtime error)
aatest.lua:40: bad argument #1 to 'terminate' (userdata expected, got nil)
stack traceback:
[C]: in field 'terminate'
aatest.lua:40: in function <aatest.lua:31>
and
Code: Select all
Failed to run init function, err code: 7 (Runtime error)
aatest.lua:39: attempt to index a nil value (global 'handle')
stack traceback:
aatest.lua:39: in function <aatest.lua:31>
-
Administrator
- Site Admin
- Posts: 5312
- Joined: Sat Jan 05, 2008 4:21 pm
#4
Post
by Administrator » Sat Aug 29, 2015 10:17 pm
Try this:
Code: Select all
local procId = process.findByWindow(window.getAppHwnd());
local proc = process.open(procId);
process.terminate(proc);
-
ZZZZZ
- Posts: 513
- Joined: Sun Oct 21, 2012 1:42 am
#5
Post
by ZZZZZ » Sat Aug 29, 2015 10:25 pm
Woo that worked! Thank you very much, spent way too long trying to figure that out lol
-
Administrator
- Site Admin
- Posts: 5312
- Joined: Sat Jan 05, 2008 4:21 pm
#6
Post
by Administrator » Sat Aug 29, 2015 11:43 pm
Is there a reason you're forcefully terminating like that though? I imagine you could also just do t his:
That should terminate things slightly more gracefully.
Who is online
Users browsing this forum: No registered users and 5 guests