Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Macro Priority, in a macro
#1
Hi I am new to QM, and have been working on this macro for a while. I have pieced it together from reading other's posts.

What I am trying to do is repeatedly run a macro which has a function that randomly chooses some variables, inserts those variables into the running macro. Then waits the specified time and runs another macro before repeating the whole process over again.

The randomization part works great. The copy and paste part works great. But I wont the program to pick the wait time, then pick a macro name, then run the specified macro. Then repeat the whole process over again.

What is happening right know is that it picks a wait time, then the macro name, it inserts these variables fine, but doesn't run the macro until it goes through that process the specified repeat times.

PS I have tried converting the last macro into a function but it doesn't work. I was thinking that there must be some way of, prioritizing the macros so that when the running macro comes across the embedded macro it pauses then continuous to run.

Any help would be great!!

Code:
Copy      Help
rep 100
,max "Quick Macros"
,ClearOutput
,ARRAY(str) a1 a2 a3 a4
,a1="1[]2[]3[]4"
,a2="0[]1[]2[]3[]4[]5[]6[]7[]8[]9"
,a3="0[]1[]2[]3[]4[]5[]6[]7[]8[]9"
,a4="MacroName1[]MacroName1[]MacroName2[]IMacroName3[]MacroName4"
,str s.from(a1[Uniform(0 a1.ubound)] a2[Uniform(0 a2.ubound)] a3[Uniform(0 a3.ubound)])
,str t.from(a4[Uniform(0 a4.ubound)])
,dou 78 340 id(2203 "Quick Macros")
,outp s
,wait 1
,dou 90 345 id(2203 "Quick Macros")
,outp t
,wait 1
,wait 136
,mac "MacroName#"

Uniform Funiction

;;Uniform: L'Ecuyer Random number generator

;Global (or thread specific) integer variables s1 and s2
;hold the current state of the generator and must be
;initialised with values in the range [1-2147483562]
;and [1-2147483398] respectively. The generator has a
;period of ~ 2.3 x 10^18.

function^ [mn] [mx]
int z k
dll msvcrt clock
int+ s1 s2
if(!s1 || !s2)
,s1 = clock() / (1 << 16)
,s2 = clock() % (1 << 16)
,if(s1 <= 0 || s1 > 2147483562) s1 = 1
,if(s2 <= 0 || s2 > 2147483398) s2 = 2147483398

k = s1/53668
s1 = 40014*(s1-(k*53668))-(k*12211)
if(s1 < 0) s1+2147483563
k = s2 / 52774
s2 = 40692 * (s2-(k*52774))-(k*3791)
if(s2<0) s2=s2+2147483399
z = s1 - s2
if(z<1) z=z+2147483562
double random = z * 4.65661305956E-10

if(mx)
,ret (mn+ ((mx-mn+1)*random))
else ret random
#2
did you change ALL of your macros to functions including the one that has all this code?

also do you have this
Code:
Copy      Help
mac t

where you put this?

Code:
Copy      Help
mac "MacroName#"
An old blog on QM coding and automation.

The Macro Hook
#3
All "embedded" macros must be functions, or main macro must be function. To run and wait, use this:

wait 0 H mac(t)

To call as function, use this:

call t
#4
Hi Gintaras,

I have tried what you have said to do, but what is happening is the macro isn't waiting it automatically runs the embedded macro and skips the wait process all together. Is there something wrong with code?

Code:
Copy      Help
rep 2
,max "Quick Macros"
,wait 1
,ClearOutput
,ARRAY(str) a1 a2 a3 a4
,a1="1[]2[]3[]4"
,a2="0[]1[]2[]3[]4[]5[]6[]7[]8[]9"
,a3="0[]1[]2[]3[]4[]5[]6[]7[]8[]9"
,a4="Functio1[]Functio2[]Functio3[]Functio4"
,str s.from(a1[Uniform(0 a1.ubound)] a2[Uniform(0 a2.ubound)] a3[Uniform(0 a3.ubound)])
,str t.from(a4[Uniform(0 a4.ubound)])
,dou 78 315 id(2203 "Quick Macros")
,outp s
,wait 0.5
,int Website=call(t)
,wait 115 H Website
,err
#5
Sorry it isn't an embedded macro anymore it is a function.
#6
Thanx for all your advice

I got it to work with your help!! I guess I just needed to eat then come back I found the problem. I was wondering if there is a way to remove the mouse double click command. What I wont to to is insert the specified time into the wait command. Similar to defining the wait 0 H call(t) I would like to remove this part of the command
Code:
Copy      Help
,dou 76 272 id(2203 "Quick Macros")
,outp s
,wait 121

and have something like this:

Code:
Copy      Help
,wait s

How do you do this? Any help would be great. Thanx
#7
s needs to be an "integer" or "double" variable type to so that ie a number.
An old blog on QM coding and automation.

The Macro Hook
#8
wait val(s)
#9
take a look at "spe" and "wait" in the help to figure out how to throttle the actions to what you need.
An old blog on QM coding and automation.

The Macro Hook
#10
Thank you for your help the macro works great!!!


Forum Jump:


Users browsing this thread: 1 Guest(s)