Camera automation under Vista



Hi,

I am trying the get the following script to work under Vista:

<job>
<reference object="wia.DeviceManager" />
<object id="DevMan" progid="Wia.DeviceManager" />
<script language="VBScript">
Option Explicit

Dim Command, Name, Description, Icon, EventID, DeviceID, i

Command = WScript.fullname & " """ & WScript.scriptfullname & """ connect"
Name = "QuickTransfer"
Description = "Quick Scripting Transfer"
Icon = WScript.fullname & ", 0"
EventID = wiaEventDeviceConnected
DeviceID = "*"

If WScript.arguments.count = 1 then
If UCase(WScript.arguments(0)) = "REGISTER" then
MsgBox "Registering Event Handler"
DevMan.RegisterPersistentEvent Command, Name, Description, Icon, EventID, DeviceID
WScript.quit
End If
If UCase(WScript.arguments(0)) = "UNREGISTER" then
MsgBox "Unregistering Event Handler"
DevMan.UnregisterPersistentEvent Command, Name, Description, Icon, EventID, DeviceID
WScript.quit
End If
End If

If WScript.arguments.count = 2 then
If UCase(WScript.arguments(0)) = "REGISTER" then
MsgBox "Registering Event Handler"
DeviceID = WScript.arguments(1)
DevMan.RegisterPersistentEvent Command, Name, Description, Icon, EventID, DeviceID
WScript.quit
End If
If UCase(WScript.arguments(0)) = "UNREGISTER" then
MsgBox "Unregistering Event Handler"
DeviceID = WScript.arguments(1)
DevMan.UnregisterPersistentEvent Command, Name, Description, Icon, EventID, DeviceID
WScript.quit
End If
End If

If WScript.arguments.count = 3 Then
If UCase(WScript.arguments(0)) = "CONNECT" Then
Dim DevID
Dim Dev
Dim Itm
Dim Img

DevID = Mid(WScript.arguments(1), 12)
set Dev = DevMan.DeviceInfos(DevID).Connect

For Each Itm in Dev.Items
Set Img = Itm.Transfer
Img.SaveFile "C:\Temp\" & Itm.Properties("Item Name").Value & "." & Img.FileExtension

'Uncomment the following lines to remove the picture from the
'Camera after transfer

'For i = 1 to Dev.Items.Count
' If Dev.Items(i).ItemID = itm.ItemID Then
' 'Some Cameras don't support deleting pictures
' On Error Resume Next
' Dev.Items.Remove i
' If Err.Number <> 0 Then
' MsgBox Err.Description
' Err.Clear
' End If
' On Error Goto 0
' Exit For
' End If
'Next
Next
WScript.quit
End If
End If

Description = "Usage:" & vbCrLf & vbCrLf & "To register type:" & vbCrLf & vbCrLf & _
WScript.ScriptName & " register" & vbCrLf & "...or..." & vbCrLf & _
WScript.ScriptName & " register DeviceID" & vbCrLf & vbCrLf & _
"To unregister type:" & vbCrLf & vbCrLf & WScript.ScriptName & _
" unregister" & vbCrLf & "...or..." & vbCrLf & WScript.ScriptName & _
" unregister DeviceID" & vbCrLf & vbCrLf & "Available DeviceIDs:" & _
vbCrLf & vbCrLf

for i = 1 to DevMan.DeviceInfos.Count
Description = Description & DevMan.deviceInfos(i).DeviceID & " '" & _
DevMan.deviceInfos(i).Properties("Name").Value & vbCrLf
next

MsgBox Description
</script>
</job>

When I execute the following command to register the script for my camera:

CopyPictures register {EEC5AD98-8080-425f-922A-DABF3DE3F69A}\0006

I get the follwing error:

Script: C:\Temp\CopyPictures.wsf
Line: 33
Char: 4
Error: Unspecified Error

Code: 80004005
Source: WIA.DeviceManager.1

Line 33 is this line of code:

DevMan.RegisterPersistentEvent Command, Name, Description, Icon, EventID, DeviceID

Can anyone tell me what might be wrong?

Thank You,
Tracy

.



Relevant Pages

  • Camera Automation under Vista
    ... I am trying the get the following script to work under Vista: ... Dim Command, Name, Description, Icon, EventID, DeviceID, i ... MsgBox "Registering Event Handler" ... MsgBox "Unregistering Event Handler" ...
    (microsoft.public.scripting.vbscript)
  • Camera Automation under Vista
    ... I am trying the get the following script to work under Vista: ... Dim Command, Name, Description, Icon, EventID, DeviceID, i ... MsgBox "Registering Event Handler" ... MsgBox "Unregistering Event Handler" ...
    (microsoft.public.scripting.vbscript)
  • Re: Retrieving changes to AD via VBS
    ... The script runs every 15 minutes and takes less than a ... > have recording thr highestCommittedUSN and comparing it to the current ... > MsgBox "highestCommittedUSN written to file" ... > Set objConnection = CreateObject ...
    (microsoft.public.win2000.active_directory)
  • Re: Err values from MapNetworkDrive failures
    ... msgbox Err.description ... '// I switched to run so I can ensure this command ... '// this turns error handling off ... that allows me to see where the script stops. ...
    (microsoft.public.windows.server.scripting)
  • Re: MessageBox questions
    ... than MsgBox since that is a function in the VBScript ... > script was from AWK about a hundred years ago - whew! ... >>reference to JScript and MessageBox that seemed even remotely like it ... >>work for me since I need to tie it to a web service response. ...
    (microsoft.public.dotnet.framework.aspnet)

Loading