AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

first script - want more :)

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
rgblair11
Guest





PostPosted: Wed Aug 11, 2004 1:16 am    Post subject: first script - want more :) Reply with quote

Hi, very new to this but I did manage to accomplish writing a very simple script to do the following (code is at the end of this message for all who are interested:

Start a VPN connection
Wait until connected
Open Oulook
Select the correct profile

Ok, now I need to tackle how to handle different scenerios. If the VPN connection is already started, for example, how can I skip the "start VPN portion" and just open outlook? I can't figure a way to detect the VPN session.

A quick tutorial to the syntax of the following would be helpful:

Start VPN piece
if VPN piece is started, goto Start Outlook

Start Outlook

Thank you so much. I'm looking forward to enhancing my scripting skills.

CODE

;START VPN CONNECTION
Send, {LWINDOWN}r{LWINUP}
WinWait, Run,
IfWinNotActive, Run, , WinActivate, Run,
WinWaitActive, Run,
Send, rasphone{ENTER}
WinWait, Network Connections,
IfWinNotActive, Network Connections, , WinActivate, Network Connections,
WinWaitActive, Network Connections,
send, {ENTER}
WinWait, Connect Barton Malow,
IfWinNotActive, Connect Barton Malow, , WinActivate, Connect Barton Malow,
WinWaitActive, Connect Barton Malow,
send, {ENTER}
WinWait, Connecting Barton Malow...,
WinWaitClose, Connecting Barton Malow...,
;
;START OUTLOOK AND SELECT PROFILE
Send, {LWINDOWN}r{LWINUP}
WinWait, Run,
IfWinNotActive, Run, , WinActivate, Run,
WinWaitActive, Run,
Send, outlook{ENTER}
WinWait, Choose Profile,
IfWinNotActive, Choose Profile, , WinActivate, Choose Profile,
WinWaitActive, Choose Profile,
Send, {UP}{ENTER}
WinWait, Enter Password,
IfWinNotActive, Enter Password, , WinActivate, Enter Password,
WinWaitActive, Enter Password,
Send, sarael{ENTER}
Back to top
Beastmaster



Joined: 15 Apr 2004
Posts: 182

PostPosted: Wed Aug 11, 2004 6:34 am    Post subject: Reply with quote

/profile profilename

Loads the specified profile. If your profile name contains a space, enclose the profile name in quotation marks.

/c ipm.note

Creates an e-mail message

-----

It looks that there's a chance to have a slight improvement in the Outlook section, based on the above syntax Wink

Code:
Run, outlook /profile sarael /c ipm.note,,Max


Please search the forum, keyphrase: outlook - to get more usefull details/links. Sorry have no clue how to detect an existing --> VPN connection.
To check for an existing dialup connection has already been discussed (and solved) ...
Back to top
View user's profile Send private message
Beastmaster



Joined: 15 Apr 2004
Posts: 182

PostPosted: Wed Aug 11, 2004 6:48 am    Post subject: Reply with quote

What about to run a VPN shutdown and check for a confirmation message/popup ?
Back to top
View user's profile Send private message
Beastmaster



Joined: 15 Apr 2004
Posts: 182

PostPosted: Wed Aug 11, 2004 7:02 am    Post subject: Reply with quote

Idea Check if the running VPN (Client) process is listed (in the TaskManager) using PSList [more...]
Back to top
View user's profile Send private message
Guest






PostPosted: Wed Aug 11, 2004 2:25 pm    Post subject: Reply with quote

Beastmaster wrote:
Idea Check if the running VPN (Client) process is listed (in the TaskManager) using PSList [more...]


I downloaded pslist, but how would I integrate it? I can run pslist.exe from the cmd prompt, see what's running, but I'm not sure how to have my script detect such a thing.

Thanks for you help, this is fun.
Back to top
Beastmaster



Joined: 15 Apr 2004
Posts: 182

PostPosted: Wed Aug 11, 2004 3:15 pm    Post subject: Reply with quote

Get all currently running processes and pipe them to a file e.g.
Run, %COMSPEC% /C pslist > C:\MyRunningProcesses.txt

Try to identify which is the name of your active! VPN Client process.
Based on that you can check specifically for that task/process the next time.

Run, %COMSPEC% /C pslist VPNProcessName > C:\MyRunningProcesses.txt

Then parse/read the outputfile to get the status of that process.
FileReadLine, Line, C:\MyRunningProcesses.txt, 1
MsgBox, %Line%

If the VPN process is active do wathever you want, e.g. send a file
If the process isn't active run the VPN process to get connected
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group