Posts: 1,338
Threads: 61
Joined: Jul 2006
what i am trying 2 do is check 2 see how many instances of a function are running and then depeding on that number assign it 2 a global variable.
#1 CHECK to see if function 1 is running
#2 if it is find out how many function1's are running
#3 then for each # of function 1's running assign a variable ex b1,b2,b3,b4 ect
ultimately what i am trying 2 do is pass a up info about mutlipe windows 2 another function
Posts: 1,769
Threads: 410
Joined: Feb 2003
here's how you can get all the threads running.
Display all threads
int i n=EnumQmThreads(0 0 0 0)
ARRAY(QMTHREAD) a.create(n)
for i 0 EnumQmThreads(&a[0] n 0 0)
out _s.getmacro(a[i].qmitemid 1)
but have you thought about this...when you start the function have it add 1 to a global variable; when it ends have it subtract 1 from that variable. then you can always have a count of how many are running.
Posts: 1,338
Threads: 61
Joined: Jul 2006
yeah i could do the global variable but i have alot of functions so that's alot of variables lol
i think it might be easier in my situation if i got all the threads and then lets say it found for example funtion 3 was running twice add 1 to a local variable for each time it was running
cause i am using a global 2 send info 2 another function already.
Posts: 1,769
Threads: 410
Joined: Feb 2003
well, that code will get you to enumerate the threads at least.
Posts: 1,338
Threads: 61
Joined: Jul 2006
have some further questions
i am using this code 2 check
int i n=EnumQmThreads(0 0 0 0)
QMTHREAD* a._new(n)
for i 0 EnumQmThreads(a n 0 0)
,if _s.getmacro(a[i].qmitemid 1)="Function1"
,,int x
,,x+1
if x=1
,str+ cf
,cf=w1
if x=2
,str+ cf2
,cf2=w1
if x=3
,str+ cf3
,cf3=w1
if x=4
,str+ cf4
,cf4=w1
but i need it 2 do 2 more things
#1 when i stop the function reset the global variable used in the function
#2 next time the function is started need it 2 make sure that variable is not in use and if it is go 2 the next Variable
Posts: 1,338
Threads: 61
Joined: Jul 2006
i also am trying this code as well
int i n=EnumQmThreads(0 0 0 0)
QMTHREAD* a._new(n)
for i 0 EnumQmThreads(a n 0 0)
,if _s.getmacro(a[i].qmitemid 1)="Function2"
,,int x
,,x+1
sel x
,case 1
,str+ b
,b=w1
,case 2
,str+ b2
,b2=w1
,case 3
,str+ b3
,b3=w1
,case 4
,str+ b4
,b4=w1
Posts: 4
Threads: 1
Joined: Mar 2007
ok hello guys i am new to the macro stuff i am really intrested in making 1 or 2 for anything at all lmao strange but that is me and i have been intrested in doing 1 for some time now but never got around to asking for help or doing it so i wonder if you could tell me where to go for help on making 1 or if any of you could help me do 1 please thank you
Dragonfire18368 ;D
Posts: 1,338
Threads: 61
Joined: Jul 2006
ok i think i can figure out most of it just can't seem 2 be able 2 reset a global variable when the function ends
Posts: 1,769
Threads: 410
Joined: Feb 2003
you can either clear the var as the last line of code before the function ends. or, have another function end it and have the new function set the gv to whatever you want.
Posts: 1,338
Threads: 61
Joined: Jul 2006
ok can't seem 2 get this 2 work trying atend cf=0
Posts: 1,769
Threads: 410
Joined: Feb 2003
to clear a string var you might try cf="" instead of "0".
Posts: 1,338
Threads: 61
Joined: Jul 2006
i get this no matter what i do
Error in Function1: unexpected character.
Posts: 1,338
Threads: 61
Joined: Jul 2006
ok this is the problem i am facing
i am trying 2 pass a variable 2 another function from a function.this function may be running 4 times or more. what i do is check the threads and see how many instances of the function are running,then assign a local variable for each 1.then i assign a global variable to the local variable so i ca pass it.That all works well.The problem is when i stop one of the function and start it again on another window it takes over a global variable already i use,which in turns causes a problem.
Posts: 1,769
Threads: 410
Joined: Feb 2003
can post the main function code?
Posts: 1,769
Threads: 410
Joined: Feb 2003
well, if it starts over again, it will use the same gv that's initialized at the top of the code.
is there another way to do what you are trying to do?
are you just tryng to keep track of how many are running?
Posts: 1,338
Threads: 61
Joined: Jul 2006
what i am trying 2 do is pass a loca variable fom a function 2 another function.the main function could be running 4 or more times at once.What i am passing is the window handle to another function.
|