Jump to content

Trying to open a text file


Recommended Posts

I am sure it is simple, but I can't find the problem.

Here's the script:

Runwait(@COMSPEC & '/c "hl7.log"')

Here's the error

---------------------------

AutoIt Error

---------------------------

Line 59 (File "C:\Documents and Settings\keithdavenport\Desktop\hl7imp4.au3"):

Runwait(@COMSPEC & '/c "hl7.log"')

Error: Unable to execute the external program.

The system cannot find the path specified.

---------------------------

OK

---------------------------

I appreciate any and all help.

Link to comment
Share on other sites

you need a space before the /c

Runwait(@COMSPEC & ' /c "hl7.log"')

you need to tell it what to open a .log file with

Runwait(notepad.exe "hl7.log"')

or try using start

Runwait(@COMSPEC & ' /c start "hl7.log"')

Edited by emmanuel

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

  • some questions
  • which of those leaves you at the prompt?
  • the /c should close the 'dos' window when the run proccess is complete, /k would leave it up, try that to see what the error was
  • what type of file is the .log file and what are you trying to open it with? some people here open .log files with SAS, some use notepad, others use textpad.
  • does typing "hl7.log" into the command prompt open the file like you want it to? that's what putting it after @comspec does.
  • try setting the working dir to @scriptdir if the file you're trying to run is in the script dir, or set the working path to where the file is.
  • what is your shoe size?
  • what is the air-speed of a african swallow?
  • what is your favorite color?
Edited by emmanuel

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

ok, so, I broke down and tested it. when you run @comspec /c it runs the command interpreter (cmd on 2k/xp) which will stay until the proccess you launch after it closes. so, the command window will be there until you close notepad.

Starts a new instance of the Windows XP command interpreter

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]

    [ [/C | /K] string]

/C      Carries out the command specified by string and then terminates

so, just tell autoit to hide that command prompt

run(@comspec & " /c n:\keys.log","",@SW_HIDE)

if you use runwait, your whole script will pause until notepad is closed.

why not just run("notepad file.log") ?

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Although a definitive answer would of course require further measurements, published species-wide averages of wing length and body mass, initial Strouhal estimates based on those averages and cross-species comparisons, the Lund wind tunnel study of birds flying at a range of speeds, and revised Strouhal numbers based on that study all lead me to estimate that the average cruising airspeed velocity of an unladen European Swallow is roughly 11 meters per second, or 24 miles an hour.

http://www.style.org/unladenswallow/

Link to comment
Share on other sites

you need a space before the /c

Runwait(@COMSPEC & ' /c "hl7.log"')

you need to tell it what to open a .log file with

Runwait(notepad.exe "hl7.log"')

or try using start

Runwait(@COMSPEC & ' /c start "hl7.log"')

Runwait("notepad hl7.log")

Rick

Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...