Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Macros output in Dialog window ?
#2
I don't know if this is a good approach.
(Make sure the below dialog is a dialog item, which you can create by "File" >> "New" >> "New Dialog".)
Don't put the dialog code in a macro.

Read more about this in:
Having Trouble Setting up Simple User-Defined Function
You should be navigated to the correct response of Gintaras, If you are not automatically navigated to it then do a [CONTROL] + [F] in your browser and search for: Functions can execute the same code as

Function output_test
Code:
Copy      Help
\Dialog_editor
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 396 282 "Dialog"
;10 Edit 0x54030080 0x200 12 152 374 72 ""
;3 Button 0x54032000 0x0 134 29 124 21 "Macro # (PRESS THIS BUTTON!)"
;5 Static 0x54000000 0x0 71 55 272 74 "Each time you press the above button, a small random string should appear in the outputbox below.[][]The random string is:[]- Generated in ''Macro#''[]- Send from ''Macro#'' to THIS outputbox below.[][]Macro#, is the Macro name you assigned to this button to generate and send the string here."
;1 Button 0x54030001 0x4 12 228 156 46 "OK"
;2 Button 0x54030000 0x4 196 228 194 46 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040308 "*" "" "" ""


str controls = "10"
str e10
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 Execution
ret

;Execution
sel wParam
,case 3
,,;; the "hDlg" (dialog control ID) is passed as a STRING parameter to "Macro19"
,,mac "Macro19" hDlg
,case IDOK
,out "Clicked on OK"
,ret
ret 1


Macro Macro19
Code:
Copy      Help
str dlg_id=_command ;; _command is reserved container which always contains arguments send to macro/function/...
int hDlg=val(dlg_id)
str s.RandomString(5 5 "A-Z0-9")
s.setwintext(id(10 hDlg))


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)