Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting Speed from a Dialog
#1
Ok i Have made a dialog, and it has a drop down menu with 6 speed Options in which to run a macro. How do i make it so that whatever speed is chosen from the drop down menu in the dialog, it will run my macro at that Speed.
#2
can you post the code for your dropdown list? i think i know how to tell you but it would be easier to show you.
A new blog on QM coding and automation.

The Macro Hook
#3
Code:
Copy      Help
str controls = "4 5 7 8 9 10 11 14 15"
str cb4 cb5 cb7 o8Sit o9Sit o10Sit cb11 e14Swi sb15
o8Sit = 1
cb4 = "&0.00001[]0.00002[]0.00003"
cb5 = "&SuperFast[]Fast[]Average[]Slow"
cb7 = "0.1[]0.2[]0.3[]&0.4[]0.5[]0.8"
sb15 = "Dialog2.bmp"
cb11 = "5min[]10min[]&15min[]20min[]35min"
if(!ShowDialog("Master" &Master2 &controls)) ret

Is that what u need? If not let me know ..
#4
I dont mean to be a hassle, But Can anyone help me?
#5
just getting back to this one.

can you post the reference dialog?
A new blog on QM coding and automation.

The Macro Hook
#6
Hi ken im tipsys Friend Ben nice to meet you..we are both working on the same QM.exe and ran into a problem that we couldnt figure out and have been readiing a lot, but have no indication of where to read Sad so this is our code for the dialog..what we would like to do is make it so that we cand change the Speed of a certain macro from a Combo list with a drop down menu, so when u click on the differnt speed it will change the speed on a certain macro, TY for your time You guys are great at what u do and i love the Quick Macros Program your the bomb Wink

Ben on behalf of Tipsy




\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

BEGIN DIALOG
0 "" 0x90CA0A44 0x100 0 0 229 125 "Macro"
4 ComboBox 0x54230243 0x0 6 70 96 213 ""
5 ComboBox 0x54230243 0x0 112 48 50 213 ""
7 ComboBox 0x54230243 0x0 112 64 50 213 ""
12 Static 0x54000000 0x0 166 48 48 13 "Speed "
13 Static 0x54000000 0x0 166 64 48 12 "Wait"
8 Button 0x54002009 0x0 6 16 48 12 "Change Function"
9 Button 0x54002009 0x0 6 32 48 12 "Miata"
10 Button 0x54002009 0x0 6 48 48 12 "Handle"
11 ComboBox 0x54230243 0x0 112 28 96 213 ""
14 Edit 0x54030880 0x200 112 12 96 14 "Stop Macro Times"
15 Static 0x5400100E 0x20000 4 88 98 16 ""
16 Button 0x54032000 0x0 4 106 220 18 "RUN"
17 Button 0x54032000 0x0 106 88 48 14 "EnableAway"
18 Button 0x54032000 0x0 160 88 48 14 "DisableAway"
3 Button 0x54020007 0x0 108 0 108 84 "Speeds/Options"
6 Button 0x54020007 0x0 0 0 108 84 " Speeds/Options"
END DIALOG
DIALOG EDITOR: "" 0x2010900 "" ""

ret
messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
int param=DT_GetParam(hDlg)

sel message
case WM_INITDIALOG
ret 1
case WM_DESTROY DT_DeleteData(hDlg)
case WM_COMMAND goto messages2
ret
messages2
sel wParam
case 18
mac "dis"
case 17
mac "Away"
case EN_KILLFOCUS<<16|18
case 16
mac "Internet"
case IDOK DT_Ok hDlg
case IDCANCEL DT_Cancel hDlg
ret 1
#7
Thanks Ben, lmfao ye what he said :lol:
#8
EXAMPLE

Function Dialog17
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str cb3
cb3="Fast (10 ms)[]Normal (100 ms)[]Slow (1000 ms)"
if(!ShowDialog("Dialog17" &Dialog17 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 220 132 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 ComboBox 0x54230243 0x0 34 6 96 213 ""
;4 Button 0x54032000 0x0 34 24 96 14 "Start Macro327"
;5 Button 0x54032000 0x0 34 42 96 14 "Stop Macro327"
;6 Static 0x54000000 0x0 2 8 28 12 "Speed"
;END DIALOG
;DIALOG EDITOR: "" 0x2010900 "" ""


ret
;messages
double+ g_speed
sel message
,case WM_INITDIALOG
,DT_Init(hDlg lParam) ;;not necessary in QM >= 2.1.9
,
,if(!g_speed) g_speed=0.1
,;select item that match current speed
,_i=g_speed*1000
,sel _i
,,case 10 _i=0
,,case 100 _i=1
,,case 1000 _i=2
,,case else ret 1
,CB_SelectItem(id(3 hDlg) _i)
,
,ret 1 ;;not necessary in QM >= 2.1.9
,case WM_DESTROY DT_DeleteData(hDlg) ;;not necessary in QM >= 2.1.9
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case CBN_SELENDOK<<16|3
,;set speed
,_i=CB_SelectedItem(lParam)
,sel _i
,,case 0 g_speed=0.01
,,case 1 g_speed=0.1
,,case 2 g_speed=1
,
,case 4 mac "Macro327"
,case 5 shutdown -6 0 "Macro327"
,case IDOK
,DT_Ok hDlg ;;not necessary in QM >= 2.1.9
,case IDCANCEL DT_Cancel hDlg ;;not necessary in QM >= 2.1.9
ret 1

Macro Macro327
Code:
Copy      Help
double+ g_speed
if(!g_speed) g_speed=0.1

int i
for i 0 1000000000
,out i
,wait g_speed
,
#9
ty very much guys..so i insert the code into my macro where my speed is saposed to be right? and i can change it from the dialog?...and when i have to code in Macro 3 it out a whole bunch of #s is it saposed to do that?
#10
In macro, insert wait g_speed in all places where you need variable-length delay. When you change speed in dialog, the delay in macro is immediately changed and this way you control macro speed.
#11
tyvm bro your the best
#12
will this work for a function instead of a macro?
#13
Not sure what is this, but any code that works in macros also works in functions.
#14
nvm i got it
#15
Gintaras Wrote:EXAMPLE

Function Dialog17
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str cb3
cb3="Fast (10 ms)[]Normal (100 ms)[]Slow (1000 ms)"
if(!ShowDialog("Dialog17" &Dialog17 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 220 132 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 ComboBox 0x54230243 0x0 34 6 96 213 ""
;4 Button 0x54032000 0x0 34 24 96 14 "Start Macro327"
;5 Button 0x54032000 0x0 34 42 96 14 "Stop Macro327"
;6 Static 0x54000000 0x0 2 8 28 12 "Speed"
;END DIALOG
;DIALOG EDITOR: "" 0x2010900 "" ""


ret
;messages
double+ g_speed
sel message
,case WM_INITDIALOG
,DT_Init(hDlg lParam) ;;not necessary in QM >= 2.1.9
,
,if(!g_speed) g_speed=0.1
,;select item that match current speed
,_i=g_speed*1000
,sel _i
,,case 10 _i=0
,,case 100 _i=1
,,case 1000 _i=2
,,case else ret 1
,CB_SelectItem(id(3 hDlg) _i)
,
,ret 1 ;;not necessary in QM >= 2.1.9
,case WM_DESTROY DT_DeleteData(hDlg) ;;not necessary in QM >= 2.1.9
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case CBN_SELENDOK<<16|3
,;set speed
,_i=CB_SelectedItem(lParam)
,sel _i
,,case 0 g_speed=0.01
,,case 1 g_speed=0.1
,,case 2 g_speed=1
,
,case 4 mac "Macro327"
,case 5 shutdown -6 0 "Macro327"
,case IDOK
,DT_Ok hDlg ;;not necessary in QM >= 2.1.9
,case IDCANCEL DT_Cancel hDlg ;;not necessary in QM >= 2.1.9
ret 1

Macro Macro327
Code:
Copy      Help
double+ g_speed
if(!g_speed) g_speed=0.1

int i
for i 0 1000000000
,out i
,wait g_speed
,


bro i get the rough idea here , and i can make a combo box , but exactly what all would be needed here as far as 1menu 1 macro 1 fuction , and what pieces of code would go into each thing? i understan you would use g_speed to control speeds in certian areas but which piece of code would go into each element


Forum Jump:


Users browsing this thread: 1 Guest(s)