See the top rated post in this thread. Click here

Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: VBS send key commands do not appear to work on a locked computer

  1. #1
    All AUGI, all the time bbapties's Avatar
    Join Date
    2003-12
    Location
    Palm Harbor, FL
    Posts
    537
    Login to Give a bone
    0

    Default VBS send key commands do not appear to work on a locked computer

    My first question is....."is VBS is the same as VBA correct?, Isn't it all visual basics?"

    I think it is, which is why i posted this in here.


    Now to my real question at hand.

    For starters let me explain the result I'm after. I need to have a specific computer, which has acad LT on it, have a scheduled task which starts at midnight which does the following task. Open acad LT run a publish command using a specific dsd file (sheet-list). then close acad LT.

    With the help of Opie and a few others I have a VBS file that works great! It works with out flaws every time i run it...The vbs runs fine if you initialize it yourself, or even if i schedule a task to run in 2 minutes and I sit back and watch it....works fine.

    but....when i schedule it to run at night, (the pc is running windows XP pro) when the computer is locked and in sleep mode it does not work. I have double checked the options of my scheduled task and they all are set to wake the computer and I even have the login info in the task.

    When I login in the morning on that PC it has Acad LT open but none of the send key command have ran....

    I believe it has something to do with send key not being able to work on a locked computer...if it is how can I use vbs to login or unlock the pc, do all my tasks, and then re-lock it?



    sorry for the long winded question...i just figured id try to answer the obvious questions people may ask.

  2. #2
    All AUGI, all the time zoomharis's Avatar
    Join Date
    2005-02
    Location
    Abu Dhabi (Native-India)
    Posts
    506
    Login to Give a bone
    0

    Default Re: VBS send key commands do not appear to work on a locked computer

    I doubt the sendkeys are not working because the AutoCAD application is not active. Just try including this code to you VBScript file before sendkeys commands.

    Code:
     
    objShell.AppActivate ("AutoCAD")
    I am not sure about that. But I think so because you have mentioned that AutoCAD application works, not the sendkeys. Give a try. If not, we shall check for other options.

  3. #3
    All AUGI, all the time bbapties's Avatar
    Join Date
    2003-12
    Location
    Palm Harbor, FL
    Posts
    537
    Login to Give a bone
    0

    Default Re: VBS send key commands do not appear to work on a locked computer

    Im gonna have to add "LT" to this correct? Im running this on a machine that has "AutoCAD LT 2005"
    Code:
     
    objShell.AppActivate ("AutoCAD")
     
    or
     
    objShell.AppActivate ("AutoCAD LT")

  4. #4
    All AUGI, all the time zoomharis's Avatar
    Join Date
    2005-02
    Location
    Abu Dhabi (Native-India)
    Posts
    506
    Login to Give a bone
    0

    Default Re: VBS send key commands do not appear to work on a locked computer

    I don't have LT. Try with both and use the successful one.


  5. #5
    All AUGI, all the time bbapties's Avatar
    Join Date
    2003-12
    Location
    Palm Harbor, FL
    Posts
    537
    Login to Give a bone
    0

    Default Re: VBS send key commands do not appear to work on a locked computer

    both ways still does not work..... although when i log in the computer acad is the active program. so it doesnt appear to be that.

    any other thoughts?...

  6. #6
    All AUGI, all the time zoomharis's Avatar
    Join Date
    2005-02
    Location
    Abu Dhabi (Native-India)
    Posts
    506
    Login to Give a bone
    0

    Default Re: VBS send key commands do not appear to work on a locked computer

    Can you post your VBS file here as an attachment?

  7. #7
    All AUGI, all the time zoomharis's Avatar
    Join Date
    2005-02
    Location
    Abu Dhabi (Native-India)
    Posts
    506
    Login to Give a bone
    0

    Default Re: VBS send key commands do not appear to work on a locked computer

    Quote Originally Posted by bbapties
    any other thoughts?...
    Ok, Let us try another way. Instead of using sendkeys command, let us use AutoCAD native function sendcommand. Just see what happens
    Code:
    set objACAD=getObject(,"AutoCAD.Application.17")
    objACAD.activedocument.sendcommand "YourCommandGoesHere" & vbcr
    The class name provided is for AutoCAD 2007 (in red colour). You have to replace it with your AutoCAD LT Version class name. I don't have LT installed over here. So I am sorry that I can not provide you that information.

    If you don't know how to do that, just post your VBS file.

  8. #8
    All AUGI, all the time bbapties's Avatar
    Join Date
    2003-12
    Location
    Palm Harbor, FL
    Posts
    537
    Login to Give a bone
    0

    Default Re: VBS send key commands do not appear to work on a locked computer

    I don't think that will work because im running LT....I can not supress the dialog box. When selecting the dsd file. Which is why I had to use sendKey. because of using LT I had to manually set everything...here is my VBS so far

    Code:
     'PLOT to DWF for intranet
    '-------------------------------------------'
    Option Explicit
    Dim objShell
    Set objShell = CreateObject("WScript.Shell")
     
    'wait for computer to wake from sleep mode
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
     
    'open ACAD
    objShell.Run Chr(34) & "%PROGRAMFILES%\AutoCAD LT 2005\aclt.exe" & Chr(34)
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
     
    'run publish command using plot setup
    objShell.SendKeys "publish"
    objShell.SendKeys "{enter}"
    Wscript.Sleep 2000
    objShell.SendKeys "{tab}"
    objShell.SendKeys "{tab}"
    objShell.SendKeys "{enter}"
    Wscript.Sleep 2000
    objShell.SendKeys "N:\Publish_script\intranet_plot_setup.dsd"
    objShell.SendKeys "{enter}"
     
    'verify publish settings
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    objShell.SendKeys "%o"
    objShell.SendKeys "%s"
    objShell.SendKeys "{enter}"
    Wscript.Sleep 500
    objShell.SendKeys "%p"
     
    'waiting for all pages to plot
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
    Wscript.Sleep 30000
     
    'close acad without saving
    objShell.SendKeys "quit"
    objShell.SendKeys "{enter}"
    objShell.SendKeys "n"
    objShell.SendKeys "{enter}"
     
    'end of script
    WScript.Quit
    Last edited by bbapties; 2007-03-20 at 02:36 PM.

  9. #9
    All AUGI, all the time bbapties's Avatar
    Join Date
    2003-12
    Location
    Palm Harbor, FL
    Posts
    537
    Login to Give a bone
    0

    Default Re: VBS send key commands do not appear to work on a locked computer

    I'm still playing with this trying to get it to work.

    No success yet


    How do I know if this is correct for my version of LT
    Code:
     objShell.AppActivate ("AutoCAD LT")



    I was gonna test this
    Code:
    set objACAD=getObject(,"AutoCAD.Application.17")
    Code:
    objACAD.activedocument.sendcommand "line" & vbcr


    Just to see if it started the line command when i log back in. How do i find out what to replace the red text with?...I have AutoCAD LT 2005 on that machine.

  10. #10
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,419
    Login to Give a bone
    0

    Default Re: VBS send key commands do not appear to work on a locked computer

    Quote Originally Posted by bbapties
    How do i find out what to replace the red text with?...I have AutoCAD LT 2005 on that machine.
    It is the class name. Look in the registry. Start Menu>Run>regedit. Navigate to HKEY_CLASSES and scroll down till you find it.
    C:> ED WORKING....


    LinkedIn

Page 1 of 3 123 LastLast

Similar Threads

  1. DDE to send AutoCAD LT commands from Excel not passing file name
    By apitcher799568 in forum VBA/COM Interop
    Replies: 1
    Last Post: 2012-07-28, 07:00 PM
  2. Replies: 7
    Last Post: 2012-02-07, 02:43 AM
  3. Commands w/ dialogue box don't work
    By aport in forum AutoCAD General
    Replies: 7
    Last Post: 2008-10-02, 08:40 PM
  4. Some commands need to be hit twice to work...
    By mboyer in forum AutoCAD General
    Replies: 6
    Last Post: 2008-03-03, 12:06 PM

Posting Permissions

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