The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Controlling macro from open dialog
#1
Hi, I used your example here and was able to create a dialog that could start and stop another macro
http://www.quickmacros.com/forum/showthr...p?tid=1954
IS it also possible to be able to send and retreive information from the dialog to another macro or function?
I think I need to use function as I want to compile it into an .exe and mac is not supported in this feature?
Here is the basic dialog that is working
Function Dialog3
Code:
Copy      Help
/Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages


;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;3 Button 0x54032000 0x0 6 4 48 14 "Start"
;4 Button 0x54032000 0x0 6 22 48 14 "Stop"
;5 Edit 0x54030080 0x200 72 58 34 16 ""
;6 Static 0x54000000 0x0 6 58 60 16 "Number of times to loop"
;7 Edit 0x54030080 0x200 74 76 96 14 ""
;8 Static 0x54000000 0x0 6 76 60 14 "Success Message"
;2 Button 0x54030000 0x4 6 42 48 14 "Exit"
;END DIALOG
;DIALOG EDITOR: "" 0x2030408 "" "" "" ""

str controls = "5 7"
str e5 e7
if(!ShowDialog("Dialog3" &Dialog3 &controls)) ret
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,    mac "Loop"
,    
,case 4
,    shutdown -6 0 "Loop"
,
,case IDCANCEL
ret 1


And the macro it is controlling, if you click start it outputs the count and stop will stop the count.

Macro Loop1
Code:
Copy      Help
;;simple loop macro
int count
for count 1 10
,wait 1
,out count

What I would like to be able to do, is say have a text box on the dialog and the number entered there is sent to the function for the number of times to loop. And when done a success message is sent back to the dialog from the function, something like this, I am sure the syntax is not correct, but was not sure how to send the shutdown command to the function? When I run the macro and enter a number into the text box, nothing happens when I click start.

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


;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;3 Button 0x54032000 0x0 6 4 48 14 "Start"
;4 Button 0x54032000 0x0 6 22 48 14 "Stop"
;5 Edit 0x54030080 0x200 72 58 34 16 ""
;6 Static 0x54000000 0x0 6 58 60 16 "Number of times to loop"
;7 Edit 0x54030080 0x200 74 76 96 14 ""
;8 Static 0x54000000 0x0 6 76 60 14 "Success Message"
;2 Button 0x54030000 0x4 6 42 48 14 "Exit"
;END DIALOG
;DIALOG EDITOR: "" 0x2030408 "" "" "" ""

str controls = "5 7"
str e5 e7
if(!ShowDialog("Dialog3" &Dialog3 &controls)) ret
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,    mac Loop(0 val(e5))
,    e7=success
,case 4
,    shutdown -6 0 Loop(0 0)
,
,case IDCANCEL
ret 1

Function Loop
Code:
Copy      Help
;;function that accepts argumnents from dialog and returns success message to dialog
/
function int'count int'e5 str'message
message="success!"
for count 1 e5
,wait 1
,out count
ret message

Thanks kindly Matt


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)