Jump to content

Translate VBS to autoit


ricky
 Share

Recommended Posts

Hello,

who can translate a script from vbs to autoit?

The script below, Pin.vbs :

Set objShell = CreateObject("Shell.Application")
Set filesystem = CreateObject("scripting.Filesystemobject")
If filesystem.FileExists(Wscript.Arguments(0)) Then
 Set objFolder = objShell.Namespace(filesystem.GetParentFolderName(Wscript.Arguments(0)))
 Set objFolderItem = objFolder.ParseName(filesystem.GetFileName(WScript.Arguments(0)))
 Set colVerbs = objFolderItem.Verbs
 
 Select case WScript.Arguments(1)
  case 0
   For Each objVerb in colVerbs
    If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
   Next
  case 1
   For Each objVerb in colVerbs
    If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
   Next
  case 2
   For Each objVerb in colVerbs
    If Replace(objVerb.name, "&", "") = "Install" Then objVerb.DoIt
   Next
 End Select
End If

MyExplorerLnk.vbs :

Set WshShell = WScript.CreateObject("WScript.Shell" )

' Shortcut Name (Special Folders)
' strLocation = WshShell.SpecialFolders("AllUsersDesktop" )
' Set oShellLink = WshShell.CreateShortcut(strLocation & "\Windows Explorer.lnk" )

' Shortcut Name (Environment Variables)
strLocation = WshShell.ExpandEnvironmentStrings("%APPDATA%" )
set oShellLink = WshShell.CreateShortcut(strLocation & "\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Windows Explorer.lnk" )

' Shortcut Name (Normal Path)
' Set oShellLink = WshShell.CreateShortcut("C:\Windows Explorer.lnk" )

' Path to application
oShellLink.TargetPath = "%Windir%\explorer.exe"

' Command line arguments
oShellLink.Arguments = " shell:MyComputerFolder"

' Window Style
oShellLink.WindowStyle = 1

' Hotkey
oShellLink.Hotkey = ""

' Icon for Shortcut
oShellLink.IconLocation = "%windir%\explorer.exe"

' Shortcut Comment
oShellLink.Description = "Windows Explorer"

' Working Directory
oShellLink.WorkingDirectory = ""

oShellLink.Save

Thanks in advance

Link to comment
Share on other sites

  • Moderators

Hello,

who can translate a script from vbs to autoit?

 

With a little effort, YOU CAN :) AutoIt and VBS are very close in syntax. As a suggestion, start with cracking the help file and looking at ObjCreate (the equivalent of CreateObject). From there, it should be pretty easy.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...