Macro to exit Msn Messenger

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
dom
Newbie
Posts: 2
Joined: Tue Jan 17, 2006 10:59 am

Macro to exit Msn Messenger

Post by dom » Tue Jan 17, 2006 11:02 am

Can someone please tell me what I need to write inorder to run a script that closes (exits) msn messenger - note - Close only puts this application to the taskbar.

I know that to run a program its simply 'run program' but what about exit program?

Many thanks

P.S. New to the whole Macro Scheduler - Does the program have to be running in the taskbar (little cog) in order for scheduled macros to run?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jan 17, 2006 11:14 am

Hi,

This script will kill the Messenger process:

VBSTART
Sub killProcess(pgm)
set wmi = getobject("winmgmts:")
sQuery = "select * from win32_process " & "where name='" & pgm & "'"
set processes = wmi.execquery(sQuery)
for each process in processes
process.terminate
next
End Sub
VBEND
VBRun>KillProcess,msmsgs.exe

If you have version 8.0 you can enable the Scheduler Service which means Macro Scheduler does not have to be running in order for scheduled macros to run .. i.e. the little cog does not have to be in the system tray.

To enable the Scheduler Service go into Options (Tools/Options) and enable the option "Keep Scheduling on Exit (Starts Scheduler Service)".

Enjoy.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

dom
Newbie
Posts: 2
Joined: Tue Jan 17, 2006 10:59 am

Post by dom » Tue Jan 17, 2006 12:11 pm

Many thanks mtettmar!!

Very helpful and precise!

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Thu Oct 26, 2006 2:53 am

Ok I Love This Script As It Am Using It At Work As We Have 3 Processes Which Have A Habit Of Getting Stuck. At The Moment I Am Having To Run The Exe On The Persons PC.

What I Would Like To Know Is If There Is A Way I Could Remotely Connect To Another PC On The Lan. I Have Admin Access. What I Am Wanting Is To Create A Dialog That I Enter Username (Domain), Password & Host Name & Would Like To Remotely Kill The Processes.

Any Ideas.
FIREFIGHTER

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Oct 26, 2006 3:40 am

Macro Scheduler does not have the inherent ability to remotely connect. It has no functions or commands to do that. But it can perform the same keystrokes that you would use with most Remote Access utilities.

Depending on the OS on the machines you may be able to use RemoteDesktop, NetMeeting, Remote Administrator, pcAnyWhere, GoToMyPC, LogMeIn or some other remote access utility.

Once connected, you could then use normal KILL commands. There are a number of utilities to do that, and some OS have built in KILL functions. You can redirect them to text files and parse them for the program(s) you need.

(It will also be easier for everyone to read your posts if you turn off Initial Caps Mode and use normal lower case for most of the words).
Last edited by Bob Hansen on Fri Oct 27, 2006 2:44 am, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Thu Oct 26, 2006 4:46 am

Its My Text Sig, Always Done It For Forum Posts & IM. There Is More To That Story Though.

I Know MS Can't Do It But I Was Thinking Support With The VB Scripting But I Don't Know My VB Very Well.

Did Have A Similar Script Ages Ago But Can't Find It Now.
FIREFIGHTER

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Oct 26, 2006 1:04 pm

Actually you can do that with Macro Scheduler if you use the msNet module. You'd need Macro Scheduler installed on the remote machine along with msNet. Then you can remotely run the script which kills the process.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Oct 26, 2006 2:07 pm

If you're running XP you might be able to use "tasklist.exe" and "taskkill.exe". I have not tried using these but I've thought about it. Consequently, I have no advice regarding limitations or usefulness particularly on a network. If you open a command prompt and type in tasklist /? or taskkill /?you'll get a listing of how to use it.

If you get something working please post it. I too could use something like this but haven't taken the time to develop it.

Later,
Dick

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Fri Oct 27, 2006 12:43 am

Hello Marcus,

Thanks For The Suggestion, However This Is Not A Viable Option Due To The Amount Of PC's That Would Require The Deployment.

While Working For EDS We Had A Script That Used To Do This Using WSHOST I Think.

I Will Try & Contact Someone That Might Be Able To Access The Script For Me.

If I Get The Script I Will Post It & See If Someone Can Implement It Into MS.

I Looked At Using PSKill However That Kills Via PID Not Name.

Thanks For The TaskList & Kill I Will Check It Out.

Will Post Anything I Develop.
FIREFIGHTER

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Fri Oct 27, 2006 2:05 am

I Had An Old Script On Here On How To Mask The Input Of Passwords In A Dialog But I Can't Find It. Anyone Got A Suggestion.

Never Mind I Found It

http://www.mjtnet.com/usergroup/viewtop ... ord+dialog
FIREFIGHTER

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Fri Oct 27, 2006 2:21 am

Here Is The Code I Have At The Moment But I Have Not Included The Password Masking Yet. I Seriouslly Do Not Like That Code To Mask The Password. Hopeing The New Version Comes Out Soon Which Will Be An Easy Tick Box.

If Anyone Can Include That Bit It Would Be Great.

Code: Select all

Let>APP_TITLE=Knet Remote Process Killer
Dialog>KnetProcessKiller
   Caption=Knet Remote Process Killer
   Width=409
   Height=152
   Top=CENTER
   Left=CENTER
   Max=0
   Min=0
   Close=1
   Resize=0
   Label=Knet Remote Process Killer,8,8,true
   Label=Host Name (COM Number),8,32,true
   Label=Username (Include Domain),208,32,true
   Label=Password,208,72,true
   Edit=HostName,8,48,185,
   Edit=UserName,208,48,185,dtup\
   Edit=Password,208,88,185,
   Button=Kill Processes,8,74,89,37,1
   Button=Exit Program,104,74,91,37,2
   Default=Kill Processes
EndDialog>KnetProcessKiller

Show>KnetProcessKiller

Label>ActionLoop
  GetDialogAction>KnetProcessKiller,r
  if>r=1,Kill
  if>r=2,Exit
Goto>ActionLoop

Label>Kill
Let>RP_WAIT=1
Run Program>cmd /c Taskkill /S %KnetProcessKiller.HostName% /u %KnetProcessKiller.UserName% /p %KnetProcessKiller.Password% /F /IM DM.exe > C:\Output1.txt
ReadFile>C:\Output1.txt,Output1
Run Program>cmd /c Taskkill /S %KnetProcessKiller.HostName% /u %KnetProcessKiller.UserName% /p %KnetProcessKiller.Password% /F /IM Interceptor.exe > C:\Output2.txt
ReadFile>C:\Output2.txt,Output2
Run Program>cmd /c Taskkill /S %KnetProcessKiller.HostName% /u %KnetProcessKiller.UserName% /p %KnetProcessKiller.Password% /F /IM PAPIHost.exe > C:\Output3.txt
ReadFile>C:\Output3.txt,Output3
Let>RP_WAIT=0
Let>MSG_HEIGHT=300
Let>MSG_WIDTH=600
MessageModal>Kill Process Output Of DM.exe%CRLF%%Output1%%CRLF%%CRLF%Kill Process Output Of Interceptor.exe%CRLF%%Output2%%CRLF%%CRLF%Kill Process Output Of PAPIHost.exe%CRLF%%Output3%
DeleteFile>C:\Output1.txt
DeleteFile>C:\Output2.txt
DeleteFile>C:\Output3.txt
Label>Exit
FIREFIGHTER

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Fri Oct 27, 2006 5:06 am

Hi CyberCitizen,

I checked BugTracker Bug #55 - Mask password in dialog box
Date: 8:25 AM 10-03-2006
says "Added in v9"

v9 Help file History says...
Added PasswordChar property to Custom Dialog Edit fields

Just tried it, works nicely in 9.0.029 beta.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Fri Oct 27, 2006 7:25 am

Thanks jpuziano,

I Am Aware Of This One. I Asked Marcus To Add This A While Ago.
FIREFIGHTER

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Oct 27, 2006 12:21 pm

CyberCitizen wrote:I Seriously Do Not Like That Code To Mask The Password. Hopeing The New Version Comes Out Soon Which Will Be An Easy Tick Box.
Version 9 is in Beta and will be coming out soon. In version 9, masking the password in a dialog is as easy as placing a character at the end of your "Edit" line in the dialog. The dialog you just posted will look like this in version 9 with password masking:

Dialog>KnetProcessKiller
Caption=Knet Remote Process Killer
Width=409
Height=152
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Label=Knet Remote Process Killer,8,8,true
Label=Host Name (COM Number),8,32,true
Label=Username (Include Domain),208,32,true
Label=Password,208,72,true
Edit=HostName,8,48,185,
Edit=UserName,208,48,185,dtup\
Edit=Password,208,88,185,
,*
Button=Kill Processes,8,74,89,37,1
Button=Exit Program,104,74,91,37,2
Default=Kill Processes
EndDialog>KnetProcessKiller


The red bits at the end of the password "Edit" line are all that are needed to mask the password.

Note: If you do not have default text that will be inserted into the "Edit" line, be sure to add the comma before adding the character that will show up rather than the typed in text. Otherwise the character that you put in (in the example above it is an asterisk) will show up in the edit box as default text.

Thanks for posting this, I'll try it out as soon as I can.

Later,
Dick

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts