Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] - Getting UserInput
#1
I'm trying to create a macro with a dialog box that accepts 2 text box fields, and uses those as output in the macro

Dialog code (named Dialog2):
Function Dialog2
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Edit 0x54030080 0x200 84 8 96 12 "NewJobNo[]"
;4 Edit 0x54030080 0x200 84 32 96 12 "OldJobNo"
;5 Static 0x54000000 0x0 16 8 48 12 "New Job No"
;6 Static 0x54000000 0x0 16 32 48 12 "Old Job No"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040304 "*" "" "" ""

str controls = "3 4"
str e3New e4Old

if(!ShowDialog(dd 0 &controls)) ret

out e3New
out e4Old

and the Macro (example):
Macro Macro1
Code:
Copy      Help
Dialog2
'Wr             ;; Win+R
int w2=wait(15 win("Run" "#32770"))
'"notepad" Y    ;; "notepad" Enter
int w3=wait(18 win("Untitled - Notepad" "Notepad"))


;;; e3New should output here
;;; e4Old should output here

How do I pull the info, am I calling the dialog correctly to use the user input as output elsewhere, etc?
#2
In most cases don't need a separate function for dialog. Move the dialog code to the macro or vice versa.
But if need a separate function for dialog, use parameters:

dialog function
Function Dialog194
Code:
Copy      Help
function! str&_e3New str&_e4Old

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Edit 0x54030080 0x200 84 8 96 12 "NewJobNo[]"
;4 Edit 0x54030080 0x200 84 32 96 12 "OldJobNo"
;5 Static 0x54000000 0x0 16 8 48 12 "New Job No"
;6 Static 0x54000000 0x0 16 32 48 12 "Old Job No"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040304 "*" "" "" ""

str controls = "3 4"
str e3New e4Old

if(!ShowDialog(dd 0 &controls)) ret

_e3New=e3New; _e4Old=e4Old
ret 1
macro
Macro Macro2756
Code:
Copy      Help
;...
str e3New e4Old
if(!Dialog194(e3New e4Old)) ret
out e3New
out e4Old
;...
#3
Ah ha --

so, I see the output in the debugger now, but how do I get it to output that on screen (eg, in a notepad document)?
#4
To learn, use the Text dialog, the first button in the floating toolbar. Select "Variable...".
#5
Fantastic - Thanks a ton.


Forum Jump:


Users browsing this thread: 2 Guest(s)