Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can i run the same macro on multiple PC's remotely?
#1
How can I make a dialog box that has an editable listbox to put pc names in and runs the same macro one 1 pc from the list box then goes to the next one? I made a macro to open remote desktop connection and run the commands I need I just cant get it to go from one pc on the list to the next.
#2
Macro Macro2840
Code:
Copy      Help
str pcs=
;
;ONE
;TWO
;THREE
if(!inp(pcs "" "" pcs)) ret
pcs.trim
str pc
foreach pc pcs
,sub.Macro pc


#sub Macro
function str'pc
spe -1
mes pc
#3
Not quite what I was looking for. The goal is to enter in PC names into each line and then run a series of commands on the first line then once that is done go to the second one on the list. I've been trying to get this to work so I can enter 1 number then {enter} {enter}r then 2 {enter} {enter} then 3 {enter} {enter} in a notepad and this is what I got so far and I am stumped.


\Dialog_Editor

str dd=
BEGIN DIALOG
0 "" 0x90C80AC8 0x0 0 0 146 116 "Dialog"
3 Edit 0x54231044 0x200 24 40 96 48 ""
100 Button 0x54030001 0x4 20 92 48 14 "OK"
2 Button 0x54030000 0x4 80 92 48 14 "Cancel"
END DIALOG
DIALOG EDITOR: "" 0x2040202 "*" "" "" ""

str controls = "3"
str e3
str pc
foreach pc e3
mac "sub.Macro" pc

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 e3.getwintext(id(3 hDlg))
mac "sub.Macro" e3
case IDCANCEL

ret 1


#sub Macro
function str'e3
opt err 1 ;;on error continue
spe 1000 ;;wait 1 second after commands
Wait for Notepad window max 5 s
wait 2.5 WA "Notepad"
Wait 1.5 s
1.0

run "NOTEPAD"

key F"{e3}"
key Y
key Y
#4
Macro Macro2884
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 146 116 "Dialog"
;100 Button 0x54030001 0x4 20 92 48 14 "OK"
;2 Button 0x54030000 0x4 80 92 48 14 "Cancel"
;3 Edit 0x54231044 0x200 24 40 96 48 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""

str controls = "3"
str e3
e3=
;ONE
;TWO
;THREE
;
if(!ShowDialog(dd &sub.DlgProc &controls )) ret

#sub DlgProc
function# hDlg message wParam lParam

opt keysync 1 ;;don't need key synchronization for sending keys to windows of this thread

sel message
,case WM_INITDIALOG
,act id(3 hDlg) ;;focus the edit control. Note: in the dialog definition it must not be the first control.
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 100
,act id(3 hDlg) ;;focus the edit control
,key H SE ;;select current line
,str pc.getsel ;;get its text
,if(pc.len=0) ret
,key HD ;;next line
,
,;run macro and wait
,opt waitmsg 1 ;;keep the dialog responsive
,wait 0 H mac("sub.Macro" "" pc)

ret 1


#sub Macro
function str'pc
spe -1
mes pc
#5
This is great. How would I get it to continue through the list automatically rather than having to go back after the macro is ran?


Forum Jump:


Users browsing this thread: 1 Guest(s)