local lastUpdateTime = 0;
while(true) do
if( os.difftime(os.time(), lastUpdateTime) > 60*60*3 ) then
lastUpdateTime = os.time();
logMessage("");
printf("Hello to auto-restart script.\n");
printf("Press SPACE BAR to terminate script.\n");
mouseSet(1310, 101);
mouseLClick();
mouseLClick();
rest( 20000 );
mouseSet(910, 46);
mouseLClick();
rest( 2000 );
mouseSet(1080, 130);
mouseLClick();
rest( 2000 );
mouseSet(264, 94);
mouseLClick();
rest( 2000 );
mouseSet(547, 318);
mouseLClick();
rest( 2000 );
mouseSet(1348, 10);
mouseLClick();
rest( 2000 );
mouseSet(872, 543);
mouseLClick();
if( keyPressedLocal(key.VK_SPACE) ) then
printf("Goodbye!\n");
break;
end
end
yrest(100);
end
Trying to make it better with time.. currently am staring at the lua webpage trying to make it somehow attach to the program and when the process closes to start it.. not on timer.
so2easy wrote:
Trying to make it better with time.. currently am staring at the lua webpage trying to make it somehow attach to the program and when the process closes to start it.. not on timer.
if( string.find(system('tasklist /fi "imagename eq whatever.exe" /NH'), "No tasks are running", true) ) then
-- The program is not running. Do something.
end
You're using an outdated version of MicroMacro. Also, I made an error in the example I gave. You should just get rid of the 'true' from the string.find() call.
And why did you put that where you did? It's a simple check of whether or not the program is running, which is what you asked for. You put the code that you want to run when the program is/is not running inside there, not the whole script.