Jump to content
Sign in to follow this  
ricky

Translate VBS to autoit

Recommended Posts

ricky

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

Share this post


Link to post
Share on other sites
FireFox

Hi,

It's really simple, take a look at the forum you will have plenty of examples.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
JLogan3o13

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.


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
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
Sign in to follow this  

×