Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Asking For Your Guys' Help
#1
To start off, I have minimal programming skills. I have knowledge of VB.NET and Java, but I'm having a really hard time trying to pick up QMscript from reading the manual.

Anyways, I was wondering if somebody could make me a sample program that I could study. My objective here is to understand how to create a user defined function and call that function throughout a macro. I want to understand how to start and stop a macro from a user created dialogue window, which has textboxes that affect the macro itself.

Could somebody here please take the time to help me learn and understand this language? I would really appreciate it. Other than asking for your guys' help, I'm trying to study things on this forum and the sample stuff from the program, I'm just having a really hard time.
#2
Quote:how to create a user defined function and call that function throughout a macro
menu File -> New -> Function.
Set its name in the list (not in code), unless it is a sub-function.
This function has two parameters and returns an integer number:
Function Function292
Code:
Copy      Help
function'int str'param1 int'param2

sel mes(F"param1={param1}[]param2={param2}" "" "OC")
,case 'O'
,ret 1
Call it and assign the return value to a variable:
Macro Macro2467
Code:
Copy      Help
int x
x=Function292("test" 5)
out x

---------
Quote:how to start and stop a macro from a user created dialogue window, which has textboxes that affect the macro itself
Function Dialog155
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Static 0x54000000 0x0 8 8 48 12 "Macro"
;4 Edit 0x54030080 0x200 64 8 96 12 ""
;5 Button 0x54032000 0x0 8 24 48 14 "Start"
;6 Button 0x54032000 0x0 8 44 48 14 "Stop"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""

str controls = "4"
str e4
e4="Function292"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
str s
s.getwintext(id(4 hDlg))
sel wParam
,case IDOK
,case IDCANCEL
,case 5 ;;Start
,mac s
,
,case 6 ;;Stop
,EndThread s
,
ret 1

;To create a dialog:
;Menu File -> New -> Dialog -> Smart dialog.
;In the Dialog Editor add controls.
;If need, in the Dialog Editor use the Events button to add case statements for events (Windows messages). Here you see case 5 and case 6.
;Save, Close.
;Then add your code under the case statements and in other places.
;By default the Run button opens the Dialog Editor. To run the dialog instead, remove the space before \Dialog_Editor. You can also do it in Properties.


Forum Jump:


Users browsing this thread: 2 Guest(s)