Results 1 to 13 of 13

Thread: How to separate code blocks in vbs

Threaded View

  1. #6

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    7

    Re: How to separate code blocks in vbs

    I changed my code to this and now I get an error.

    Code:
    ' Make sure variables are declared.
    option explicit
    ' Program starts running here.
    call CreateShortCut()
    
    
    sub CreateShortCut()
      dim objShell, strEnvironment, objLink
      set objShell = CreateObject("WScript.Shell")
      strEnvironment = objShell.ExpandEnvironmentStrings("%USERPROFILE%\Start Menu\Programs\Accessories")
      CurrentDirectory = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
      set objLink = objShell.CreateShortcut(strEnvironment & "\downIt.lnk")
      objLink.Description = "Shortcut to downIt"
      TargetPath = CurrentDirectory & "\downIt.bat"
      objLink.WindowStyle = 1
      WorkingDirectory = CurrentDirectory
      objLink.Hotkey = "CTRL+SHIFT+ALT+U"
      objLink.Description = "This will update the scanner from the internet."
      objLink.Save
    end sub
    Last edited by papayrus; Apr 5th, 2012 at 12:08 AM.

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