Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
|
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 4th, 2011, 06:07 PM
Registered User
 
Join Date: Sep 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Something went wrong and i am getting a error message. 800a03f3

There is my code i wrote :

Dim objfso, colDrivers, objDrive
Set objfso = CreateObject("Scripting.FileSystemObject")
Set colDrives = objfso.Drives
For Each objDrive In colDrives
If objDrive.IsReady = True Then
Set objfso.CopyFile "C:\lab5.vbs" , overwriting = true
End If
Next


Dim objWshShl, strTargetFolder, objDesktopShortcut, objProgramsShortcut
Dim strAppDataPath, objQuickLaunchShortcut, request, fso, path
inputbox(" Would you like a Desktop icon or a program shortcut?")
'Establish an instance of the WshShell object
Set objWshShl = WScript.CreateObject("WScript.Shell")

'Create the Desktop shortcut
strTargetFolder = objWshShl.SpecialFolders("Desktop")
Set objDesktopShortcut = objWshShl.CreateShortcut(strTargetFolder + _
"\\lab6.lnk")
objDesktopShortcut.TargetPath = "C:\lab.vbs"
objDesktopShortcut.Description = "lab 5 "
objDesktopShortcut.Hotkey = "CTRL+Alt+G"
objDesktopShortcut.IconLocation = "disk.ico"
objDesktopShortcut.Save

Do Until strOkToEnd = "yes"
'Create the Programs menu shortcut
strTargetFolder = objWshShl.SpecialFolders("Programs")
Set objProgramsShortcut = objWshShl.CreateShortcut(strTargetFolder & _
"\\lab5.lnk")
objProgramsShortcut.TargetPath = "c:\lab6.vbs"
objProgramsShortcut.Save
'this asks the user for a drive
Set fso = WScript.CreateObject("scripting.Filesystemobject")
request = InputBox("What drive would you Like?")
If request = "" Then
MsgBox "Sorry you didnt enter anything!",,"Error"
strOkToEnd = "no"
Elseif fso.driveexists(request) = False Then
MsgBox "the drive does Not exist!",,"Error"
strOkToEnd = "no"
Elseif request = "quit" Then
strOkToEnd = "yes"
'this asks the user for a path
Else
InputBox ("choose a path?")
Set path = request
If fso.DriveExists(request) = False Then
MsgBox "Your folder does not exists!",,"sorry"
Else
MsgBox "These are your Folders" & VbCrLf

End If
End If
Loop

Here is the error message i am getting:

line: 13
Char: 22
Error: expected '='
code: 800a03f3
can anyone help me fix it ?
Reply With Quote
  #2 (permalink)  
Old October 7th, 2011, 02:48 AM
Friend of Wrox
 
Join Date: May 2011
Posts: 125
Thanks: 0
Thanked 24 Times in 24 Posts
Default

Greetings,

Your not capturing the user input on this line:
Code:
inputbox(" Would you like a Desktop icon or a program shortcut?")
changing it to:
Code:
request = inputbox(" Would you like a Desktop icon or a program shortcut?")
and obviously checking the request for yes / no will solve the error.
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
I don´t get any wrong message alain BOOK: Beginning Web Programming with HTML, XHTML, and CSS, 2nd Edition ISBN: 978-0-470-25931-3 2 March 30th, 2010 01:34 PM
Error in script but can't find what's wrong!! BramuS ASP.NET 1.0 and 1.1 Basics 1 May 10th, 2005 04:32 AM
Error message is wrong Mitch SQL Server 2000 3 March 17th, 2004 07:11 PM
email message with wrong characters marcrock Flash (all versions) 4 February 8th, 2004 05:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.