03-31-2017, 06:27 PM
Let the dialog have a dialog procedure. Also known as "smart dialog".
Let the button have other id, not 1.
Move the part of the macro that sends keys etc to a new macro or #sub.
When the button clicked, start the macro using mac. Get edit control values with str.getwintext and pass them to the macro using function parameters.
Macro Macro2842
Let the button have other id, not 1.
Move the part of the macro that sends keys etc to a new macro or #sub.
When the button clicked, start the macro using mac. Get edit control values with str.getwintext and pass them to the macro using function parameters.
Macro Macro2842
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 136 56 "BOX"
;6 Edit 0x54032000 0x200 52 20 32 13 ""
;3 Static 0x54000000 0x0 0 0 140 22 "NUMBER?"
;100 Button 0x54030001 0x4 4 36 48 14 "OK"
;2 Button 0x54030000 0x4 84 36 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""
str controls = "6"
str e6
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
sel wParam
,case 100
,str e6.getwintext(id(6 hDlg))
,mac "sub.Macro" "" e6
,
,case IDCANCEL
ret 1
#sub Macro
function str'e6
;out e6; ret
if getopt(nthreads)>1
,if('O'=mes("Stop the macro?" "" "OC")) EndThread +getopt(itemid)
,ret
AddTrayIcon "$qm$\macro.ico" "My macro is running.[]Ctrl+click this icon to end it."
opt err 1 ;;on error continue
spe 0600 ;;wait 1 second after commands
;;Opens putty on the saved session
run "C:\Program Files (x86)\Putty\PUTTY.exe" ("-load session name")
;Wait for Putty window max 5 s
wait 1 WA "PUTTY"
;Wait 1.0 s
1.0
;key jumpto V -u V users V -s V isp.0(e6).us ;;command that is ran with the info entered into the dialog as (e6)
paste F"jumpto -u users -s isp.0{e6}.us"
key Y ;; enter
key Y ;; enter
key "info"
key Y ;; enter
key F3;; F3
key Y ;; enter
key D ;; down
key Y ;; enter
key D ;; down
key D ;; down
key Y ;; enter
key Y ;; enter
key F12 ;; F12
key Y ;; enter