MS v11 - Script help Please

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
PepsiHog
Automation Wizard
Posts: 512
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

MS v11 - Script help Please

Post by PepsiHog » Sun Jul 18, 2010 11:09 pm

Hello Everyone,

The following VBS script works. So I don't any editing done.
But what I need is to know how to convert it to work in MS v11.

Could someone help me out?

Thanks,
PepsiHog

Well....OK, editing is needed per say.

Code: Select all

 Set oWS = WScript.CreateObject("WScript.Shell")
   sLinkFile = "C:\Frozen Throne.LNK"
   Set oLink = oWS.CreateShortcut(sLinkFile)
   
   oLink.TargetPath = "C:\Documents and Settings\Felix The Cat\My Documents\WarCraft III Cheats\WC_Cheater.exe"
   '    oLink.Arguments = ""
   '    oLink.Description = "MyProgram"
   '    oLink.HotKey = "ALT+CTRL+F"
   oLink.IconLocation = "C:\Users\Kyle\Documents\WarCraft III Cheats"
   '    oLink.WindowStyle = "1"
   '    oLink.WorkingDirectory = "C:\Program Files\MyApp"
   oLink.Save
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
PepsiHog
Automation Wizard
Posts: 512
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

====> very sad....

Post by PepsiHog » Tue Aug 10, 2010 6:51 pm

:( Every since v12 release, it is near impossible to get support for v11. Has support been canceled for v11, or is everyone to busy writting v12?

Ofcourse, it is a great means to force upgrades.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Tue Aug 10, 2010 8:22 pm

I wrote this years ago..... should help you.

Code: Select all

// **********************************************************
// ***   NewDesktopShortcut             
// ***                                              
// ***   Author : Alan Droege            
// ***   Date   : 04/06/2007              
// ***   Version: 1.0                         
// ***   Compiled with Macro Scheduler 8.0.1
// ***                                                        
// ***                                                        
// **********************************************************


VBSTART
Sub NewDesktopShortcut(linkfile,targetpath,windowstyle,hotkey,descr)
	Set WshShell = CreateObject("Wscript.Shell")
	strDesktop = WshShell.SpecialFolders("Desktop")
	set ShellLink = WshShell.CreateShortcut(strDesktop & "\" & linkfile)
   	ShellLink.TargetPath = targetpath
    ShellLink.WindowStyle = windowstyle
    ShellLink.Hotkey = hotkey
    ShellLink.Description = descr
    ShellLink.WorkingDirectory = strDesktop
    ShellLink.Save
End Sub
VBEND

// This sets the title of the MessageModal message boxes
Let>APP_TITLE=ShortCut Creator


Let>MSG_HEIGHT=150
Let>MSG_WIDTH=900
Assigned>linkfile,lfExists
Assigned>targetpath,tpExists
Assigned>windowstyle,wsExists
Assigned>hotkey,hkExists
Assigned>descr,dExists
If>{(%lfExists% = "FALSE")}
    Goto>NoParm
Endif
If>{(%tpExists% = "FALSE")}
    Goto>NoParm
Endif
If>{(%wsExists% = "FALSE")}
    Goto>NoParm
Endif
If>{(%hkExists% = "FALSE")}
    Goto>NoParm
Endif
If>{(%dExists% = "FALSE")}
    Goto>NoParm
Endif
IF>{(%linkfile%="") OR (%targetpath%="") OR (%windowstyle%="") OR (%hotkey%="") OR (%descr%="")}
    Goto>NoParm
Endif

VBRun>NewDesktopShortcut,%linkfile%,%targetpath%,%windowstyle%,%hotkey%,%descr%
Goto>End

Label>NoParm
   MessageModal>Usage: NewDesktopShortcut.exe /linkfile=MyApp.lnk /targetpath=t:\somedir\path\pgm.exe /windowstyle=1 /hotkey=CTRL+SHIFT+C /descr=My ShortCut Description

Label>End



User avatar
PepsiHog
Automation Wizard
Posts: 512
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Thanks

Post by PepsiHog » Thu Aug 12, 2010 1:17 am

Thanks adroege!

I can likely use this to re-write my script to work with MS. As well as other future tasks.

Thanks again,
PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts