eidolon74 Posted June 29, 2004 Share Posted June 29, 2004 Is it possible to run an osql statement in autoit? I have attached the lines I am currently working with. Any help would be appreciated. RunWait(@COMSPEC & "osql.exe -U sa -P master -d $variable1 -Q ""select * from hl7patient" -o c:\hl7check.txt"") Link to comment Share on other sites More sharing options...
emmanuel Posted June 29, 2004 Share Posted June 29, 2004 (edited) you'd want to check out FAQ #7 for your quotes...and I think that a /c would help this work.. all together:RunWait(@COMSPEC & ' /c osql.exe -U sa -P master -d ' & $variable1 & ' -Q "select * from hl7patient" -o c:\hl7check.txt')Something like that? dont' know osql, but hope that helps.(edit, you snuck a variable in the middle there, fixed that.) Edited June 29, 2004 by emmanuel "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
eidolon74 Posted June 29, 2004 Author Share Posted June 29, 2004 Tried it..still get an error "unable to execute external program"..any other thoughts? Link to comment Share on other sites More sharing options...
SlimShady Posted June 29, 2004 Share Posted June 29, 2004 You have to change osql.exe to the full path of osql.exe Link to comment Share on other sites More sharing options...
eidolon74 Posted June 29, 2004 Author Share Posted June 29, 2004 Ok...but what if the location of the file varies from system to system, yet the file will always be in the path. Is there anyway to get it to run without specifying the path? Link to comment Share on other sites More sharing options...
SlimShady Posted June 29, 2004 Share Posted June 29, 2004 (edited) Can you try this.... (All in one line) RunWait(@COMSPEC & ' /c ' & @ScriptDir & '\osql.exe -U sa -P master -d ' & $variable1 & ' -Q "select * from hl7patient" -o c:\hl7check.txt') Edited June 29, 2004 by SlimShady Link to comment Share on other sites More sharing options...
Developers Jos Posted June 29, 2004 Developers Share Posted June 29, 2004 (edited) Ok...but what if the location of the file varies from system to system, yet the file will always be in the path. Is there anyway to get it to run without specifying the path?you can try using the start.exe . Edited June 29, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
emmanuel Posted June 29, 2004 Share Posted June 29, 2004 you could use regread to get the path to osql.exe, if it's in the registry... I don't have it installed... blah blah blah... shouldn't a command put through the run line work on something that's in the path? Have you tried with fixed quotes without the @comspec? this should be like running from the run line... RunWait('osql.exe -U sa -P master -d ' & $variable1 & ' -Q "select * from hl7patient" -o c:\hl7check.txt') or like jdeB said, try start:RunWait('start osql.exe -U sa -P master -d ' & $variable1 & ' -Q "select * from hl7patient" -o c:\hl7check.txt') "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
eidolon74 Posted June 29, 2004 Author Share Posted June 29, 2004 2 things:I tried the script but i get the error "cannot open file"..secondly what is start.exe? Again thanks for all of the help...anything else i can try? Link to comment Share on other sites More sharing options...
emmanuel Posted June 29, 2004 Share Posted June 29, 2004 2 things:I tried the script but i get the error "cannot open file"..secondly what is start.exe?Again thanks for all of the help...anything else i can try?go to a command prompt and type start /? and you'll find a ton of info about start. "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
emmanuel Posted June 29, 2004 Share Posted June 29, 2004 maybe if you copy the text of the error message (ctrl-c works on most autoit errors to get the text) and paste it here, that'd help? "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
eidolon74 Posted June 29, 2004 Author Share Posted June 29, 2004 Ok..thanks for the elaboration of start...but I tried it as suggested and still no dice. anything else? Link to comment Share on other sites More sharing options...
eidolon74 Posted June 29, 2004 Author Share Posted June 29, 2004 --------------------------- AutoIt Error --------------------------- Line 50 (File "C:\Documents and Settings\keithdavenport\Desktop\hl7imp4.au3"): RunWait('start osql.exe -U sa -P master -d ' & $variable1 & ' -Q "select * from hl7patient" -o c:\hl7check.txt') ) Error: Unable to execute the external program. The system cannot find the file specified. --------------------------- OK --------------------------- This is the latest error message....any help would be appreciated..thanks! Link to comment Share on other sites More sharing options...
emmanuel Posted June 29, 2004 Share Posted June 29, 2004 (edited) well, according to that, looks like there's an extra ) at the end of the line. another idea, does it work when you put the whole kit into the run line? what's in $variable1? Edited June 29, 2004 by emmanuel "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Developers Jos Posted June 29, 2004 Developers Share Posted June 29, 2004 Or try: RunWait(@comspec & ' /c start osql.exe -U sa -P master -d ' & $variable1 & ' -Q "select * from hl7patient" -o c:\hl7check.txt') SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
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