Gllopc Posted February 28, 2006 Posted February 28, 2006 Hello all, I have an issue that I think it pretty easy, but I'm just not experienced enough to know the exact answer. When calling a VB Script from my AutoIt script, the VB script executes, but then gives a "cannot find the file specified" error. When running the VB script from explorer or Start|Run, it works perfectly, regardless of whether using a UNC path or drive letter. The purpose of the VB script is to start a program installation, do some other actions for cleanup, and then exit. I don't have the option of modifying the VB script. I'm calling the Visual Basic script from it's UNC path using the command interpreter, as AutoIt will not execute VBS files. I do not have the option of using a drive letter and I have to use a UNC path. I use the following code: RunWait(@ComSpec & ' /c ' & @WorkingDir & '\intel\s1\smscert-standard-profiles.vbs', "", @SW_HIDE) The AutoIt script is being run from a UNC path. This successfully calls the VB script, and so in essence it's not an AutoIt issue; but, the problem I have is that the VB script does not know it's working path, and so it errors out when it tries to call a program from within itself. Again, if I then opened Start|Run and then typed in the UNC path of the script and it's name it works perfectly. Any ideas?
GaryFrost Posted February 28, 2006 Posted February 28, 2006 Hello all, I have an issue that I think it pretty easy, but I'm just not experienced enough to know the exact answer. When calling a VB Script from my AutoIt script, the VB script executes, but then gives a "cannot find the file specified" error. When running the VB script from explorer or Start|Run, it works perfectly, regardless of whether using a UNC path or drive letter. The purpose of the VB script is to start a program installation, do some other actions for cleanup, and then exit. I don't have the option of modifying the VB script. I'm calling the Visual Basic script from it's UNC path using the command interpreter, as AutoIt will not execute VBS files. I do not have the option of using a drive letter and I have to use a UNC path. I use the following code: RunWait(@ComSpec & ' /c ' & @WorkingDir & '\intel\s1\smscert-standard-profiles.vbs', "", @SW_HIDE) The AutoIt script is being run from a UNC path. This successfully calls the VB script, and so in essence it's not an AutoIt issue; but, the problem I have is that the VB script does not know it's working path, and so it errors out when it tries to call a program from within itself. Again, if I then opened Start|Run and then typed in the UNC path of the script and it's name it works perfectly. Any ideas? have you tried? RunWait(@ComSpec & ' /c ' & @WorkingDir & '\intel\s1\smscert-standard-profiles.vbs', @WorkingDir , @SW_HIDE) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Gllopc Posted February 28, 2006 Author Posted February 28, 2006 (edited) Same thing I'm afriad. I tried several different combinations, such as removing the first @WorkingDir and replacing it with the exact UNC, but no luck. Hmmm.... have you tried? RunWait(@ComSpec & ' /c ' & @WorkingDir & '\intel\s1\smscert-standard-profiles.vbs', @WorkingDir , @SW_HIDE) Edited February 28, 2006 by Gllopc
Gllopc Posted February 28, 2006 Author Posted February 28, 2006 Something to note is that I can circumvent the problem by doing the following: Send("#r") WinWaitActive("Run") Send(@WorkingDir & "\intel\s1\smscert-standard-profiles.vbs{Enter}") Which starts Run and inserts the location of the VB script and it's name, and then hits "OK". The reason I can't do this is that it's considered sloppy and unreliable.
DaveF Posted February 28, 2006 Posted February 28, 2006 Are you using RunAsSet? Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.
Gllopc Posted February 28, 2006 Author Posted February 28, 2006 Yeah, I tried and I'm afraid it didn't make any difference. I tried both a domain account with admin privs, and a local admin account.Are you using RunAsSet?
randallc Posted February 28, 2006 Posted February 28, 2006 hi, I think this is a problem with "xcopy" and "dir" run this way as well... Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
GaryFrost Posted February 28, 2006 Posted February 28, 2006 I would just get the beta and convert it autoit, then shouldn't have to worry about it. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Gllopc Posted March 1, 2006 Author Posted March 1, 2006 I've considered doing this, but I thought I'd try referencing CSCRIPT.EXE first, and see how that responds. It actually didn't make any difference.It looks like I'm going to have to modify the VB script itself - which I didn't want to do. I'll try that and report back.Thanks Everyone for all the suggestions and input.I would just get the beta and convert it autoit, then shouldn't have to worry about it.
Gllopc Posted March 1, 2006 Author Posted March 1, 2006 Well, it looks like the fix to the problem is to add a couple of lines to the vb script: set shell = createobject("wscript.shell") shell.currentdirectory = wscript.scriptfullname & "\.." wscript.echo shell.currentdirectory Just add it to the top of the script. The last line is really just a message box that displays the scripts current working directory, and can ultimately be ommited. Oh well, this is a fault in VB Script, and not AutoIt.
CyberSlug Posted March 1, 2006 Posted March 1, 2006 This might be a Windows feature. I might have an AutoIt solution: ; Add this line before you call Run or RunWait FileChangeDir("\\your\UNC\path\goes\here") Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now