Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i want to shutoff 1 function need some help
#1
ok you have shown me how to make a 2 functions work 1 on calc 1 and another on calc 2 the only problem im getting now is i want to stop the function on window 1 but not window 2 and i have no idea how to do that
#2
Create 2 functions and use

shutdown -6 0 "FunctionName"
#3
ok the problem is i have a few diff functions i want to run i have like 15 of them and sometimes the same function will be running in 2 windows but i only need to stop 1 not both of them
#4
let me add to that if i put that code in and i have the stop button on the toolbar for that window if i shut off the function on that window it stops all of the functions on both windows
#5
How many windows can be where the function runs? Is it 2 or can be more?
#6
IT CAN RUN UP TO 4
#7
The function can repeatedly check for some condition that you set from outside, and exit itself when it is true. I could help you, but I need to see the code.
#8
ok heres is a simple code im working with

first i have a tollbar that is attached to the window
it has 10 diff functions on it and and the functions go like this
function 1
spe -1
int w1
w1=win("Notepad")
out w1
rep
key "55"
wait 3



function 2

spe -1
int w1
w1=win("Notepad")
out w1
rep
key "some word"
wait 5

function 3
spe -1
int w1
w1=win("Notepad")
out w1
rep
key "78662"
wait 7


and so on and they are on a toolbar so it gets the window handle i just need to get a window handle to shut it off or some thing
#9
Can use SetProp/GetProp.

spe -1
int w1
w1=win("Notepad")
out w1
SetProp(w1 "running" 1)
rep
if(!GetProp(w1 "running")) end
key "55"
wait 3

To stop from other function or toolbar, use

SetProp(hwnd "running" 0)

Here hwnd is Notepad handle. To get toolbar owner window handle in a toolbar or in a function called from a toolbar, use

int hwnd=GetWindow(TriggerWindow GW_OWNER)

For example, toolbar button code can be

Stop Func :SetProp(GetWindow(TriggerWindow GW_OWNER) "running" 0)
#10
ok 1 last thing is there a way to make my buttons on the toolbar shrink when i make the window smaller cause right now the toolbar moves but dont get smaller so i have to keep moving it when i shrink the window so i can still see everything and if thats possable can i make it stay in the same loction on the window so when i make window smaller it stays in the same spot on that window cause right now it will move with the window but i want it to move with the window but not move from the spot i have it set o yeah thanks alot your a great help
#11
ok and on that code you just wrote up i just want the toolbar to only shutdown the runnig functions on just that window so i would use


Stop Func :

SetProp(GetWindow(TriggerWindow GW_OWNER) "running" 0)
#12
To make shrink - no. To not move - in toolbar's right-click menu uncheck Auto Select and check Top-Left.
#13
ok i really not getting this all the way on the stop the function i think i am missing it somewhere ok so my stop functions should be what if i use the code you have given i only want the toolbar that called the function to shut it that function down no others
#14
It stops only function started from that toolbar.

Toolbar:
Start Func: mac "FuncName" "" GetWindow(TriggerWindow GW_OWNER)
Stop Func :SetProp(GetWindow(TriggerWindow GW_OWNER) "running" 0)

Function:
function w1
SetProp(w1 "running" 1)
rep
if(!GetProp(w1 "running")) end
key "55"
wait 3
#15
is there also a way so that when you run the same macro on 2 or more windows that you wont freeze your computer up?


Forum Jump:


Users browsing this thread: 1 Guest(s)