#1
|
|||
|
|||
File Open Dialog
Hi,
I have a lot of scripts which prompts the user to open a file. At some point, these have stopped working and return an error. I've gotten a new PC with Windows 7 instead of XP and also upgraded to the latest version of SecureCRT (6.7.4) since the last time I've run these scripts. I don't know if it is something I'm missing, something that has changed, or something that is no longer supported. The error I'm getting is: Microsoft VBScript runtime error Error: ActiveX component can't create object: 'UserAccounts.CommonDialog' Obviously this is something outside of SecureCRT, but I don't know what would be the best or recommended method to fix this. The code I've used for these scripts is: Code:
' -------- Open the file dialog -------- Set fso = CreateObject("Scripting.FileSystemObject") Set objDialog = CreateObject("UserAccounts.CommonDialog") objDialog.Filter = "Text Files|*.txt|VBScript Scripts|*.vbs|Log Files|*.log|All Files|*.*" objDialog.FilterIndex = 1 Result = objDialog.ShowOpen If Result = 0 Then ErrorStr = 3 exit sub End If Set f = fso.GetFile(objDialog.FileName) Set ts = f.OpenAsTextStream(ForReading, TristateUseDefault) Wes |
#2
|
|||
|
|||
Hi Wes,
That's correct, I believe ActiveX objects are system dependent, so objects that worked on XP may not work on Vista or Windows 7. ![]() As an alternative, you can use the FileOpenDialog() method that was added to SecureCRT in version 6.7. Changes in SecureCRT 6.7 (Beta 1) -- March 8, 2011 -------------------------------------------------- New features:
Syntax: Code:
crt.Dialog.FileOpenDialog([title, [buttonLabel, [defaultFilename, [filter ]]]]) See the SecureCRT Help topic Scripting / Script Objects Reference / Dialog Object for additional information on the FileOpenDialog() method.
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#3
|
|||
|
|||
Nice! Thanks. I missed that addition...
Wes |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|