Results 1 to 9 of 9

Thread: running an executable (to lock workstation) from Outlook script

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2005
    Posts
    27

    Question running an executable (to lock workstation) from Outlook script

    How can I run an executable or lock the workstation from Outlook script ?
    Last edited by snir; Jun 23rd, 2005 at 04:37 AM.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: running an executable (to lock workstation) from Outlook script

    by outlook script, do you mean vba?
    if so you can use the shell function

    RetVal = Shell("C:\WINDOWS\CALC.EXE", 1)

    pete

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2005
    Posts
    27

    Re: running an executable (to lock workstation) from Outlook script

    I get the error :"Type mismatch: 'shell' "

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: running an executable (to lock workstation) from Outlook script

    what is your code?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jun 2005
    Posts
    27

    Re: running an executable (to lock workstation) from Outlook script

    VB Code:
    1. Function Item_CustomAction(ByVal MyAction,ByVal Response)Select Case MyAction.Name
    2. Case "Approve"
    3. RetVal = Shell("C:\WINNT\system32\rundll32 user32.dll,LockWorkStation", 1)
    4. Msgbox "Test"
    5. End Select
    6. End Function

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: running an executable (to lock workstation) from Outlook script

    user32 is not an executable, you will need to use an api call, here is a sample from allapi

    Private Declare Function LockWorkStation Lib "user32.dll" () As Long
    Private Sub Form_Load()
    'KPD-Team 2000
    'URL: http://www.allapi.net/
    'E-Mail: [email protected]
    LockWorkStation
    End Sub


    the first line has to go in the general area of the code at the top

    pete

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jun 2005
    Posts
    27

    Re: running an executable (to lock workstation) from Outlook script

    I tried these and I get the error:"expected end of statement" on the first line.

    I have to mention that the script editor I have in the Outlook looks like a notepad.

  8. #8
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: running an executable (to lock workstation) from Outlook script

    yeah it looks like it is vb script so i don't know if you can, i would have thought you would have vba. in outlook under tools do you have macros, if so you can go into the visual basic editor there

    pete

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Jun 2005
    Posts
    27

    Re: running an executable (to lock workstation) from Outlook script

    o.k. I can open the editor, but how do I generate here events according to the happening in the form, like I did with Item_CustomAction .
    It looks like the Outlook form responds to the simple script editor.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width