Guest frankh Posted March 5, 2005 Posted March 5, 2005 Gday all, Probably a real basic question from a non-programmer and a newbie to AutoIt I am trying to open a Jpeg image with MSPAINT and the file's path has a long directory name in it. In this example I will call it "Directory 123" If I type the following in the Windows RUN command line it works: mspaint "c:\WINDOWS\Desktop\Directory 123\TEST.jpg" Now if I try and apply this same line into a script by using the RUN command, I get parsing errors. For example: RUN("MSPAINT "c:\WINDOWS\Desktop\Directory 123\TEST.jpg"") I have looked all over the HELP and searched on the forums but can't get the answer or understand what I should be specifying it as. I think there is an ' character involved in the answer but don't know where to look to get an explanation of how the ' character works in AutoIt. Can someone just point out the correct syntax I should be using for the RUN command I have as the example in my post? (and if it involves the ' character in the solution does someone have a link to the help or a quick explanation on how this character works in AutoIt so I am some the wiser???) Cheers! Frank H
steveR Posted March 5, 2005 Posted March 5, 2005 (edited) try RUN("MSPAINT 'c:\WINDOWS\Desktop\Directory 123\TEST.jpg' ") notice the use of the single-quotes in the help file its under language reference > datatypes > strings if u wanted to use double-quotes try this: RUN("MSPAINT ""c:\WINDOWS\Desktop\Directory 123\TEST.jpg"" ") you just double up on the double-quotes it's a common error; even the pros get it wrong sometimes Edited March 5, 2005 by steveR AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Guest frankh Posted March 5, 2005 Posted March 5, 2005 Thanks steveR! I had a read of the help on the strings and must admit I am still a bit confused when applying it to the RUN statement I was trying to put together but no bother I can try and work it out now that I have a pointer. The MSPAINT file isn't in the path unfortunately so the question sort of developed from the initial report and I can't really confirm whether your 2 suggested syntaxes worked or not. I did get 2 solutions working, so I may as well post them in case some other newbie has the very same problem and flukes hitting this post in a search. The 2 solutions that I could get working ok are: RUN(@ProgramFilesDir & "\Accessories\MSPAINT.EXE" & " " & '"C:\WINDOWS\Desktop\Directory 123\TEST.jpg"') (ie. all in this statement are double quotes except the ' " C:\WINDOWS\Desktop\Directory 123\TEST.jpg " ' which has the characters quoted except without the spaces between the single and double quotes) OR........... RUN(@ProgramFilesDir & "\Accessories\MSPAINT.EXE" & " " & """C:\WINDOWS\Desktop\Directory 123\TEST.jpg""") (ie. all in this statement are double quotes) (Note - I'm guessing you could probably also specify the path to the MSPAINT EXE by using the working directory parameter of the RUN command as an alternative to specifying it as part of the exe to run parameter) Thanks again! I think I have to keep my training wheels on a bit longer and keep on practising! Cheers, Frank H
steveR Posted March 5, 2005 Posted March 5, 2005 (edited) Glad you figured it out Your examples are basically the same as how i showed you. The only reason i added the space is to allow the quotes to be seen better. The spaceing has no impact on how the code is run. (Spacing inside your path string does matter though) Edited March 5, 2005 by steveR AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Shadow14l Posted April 2, 2008 Posted April 2, 2008 RUN("MSPAINT "c:\WINDOWS\Desktop\Directory 123\TEST.jpg"")Frank HReplace "MSPAINT " with "MSPAINT.EXE"
johnylog Posted November 7, 2010 Posted November 7, 2010 (edited) Hello guys, Do you encounter errors while deleting files in Windows? I'm here to provide a solution. I've been reading several threads on this topic on different forums where computer users were asking about this popular error "The filename you specified is not valid or too long". My research helped me to find a tool for you guys. Its LONG PATH TOOL, a very easy to run but highly powerful software. Follow the link to read more about this error. Edited November 8, 2010 by Jos removed link
Developers Jos Posted November 8, 2010 Developers Posted November 8, 2010 (edited) Hello guys, Do you encounter errors while deleting files in Windows? I'm here to provide a solution. I've been reading several threads on this topic on different forums where computer users were asking about this popular error "The filename you specified is not valid or too long".My research helped me to find a tool for you guys. Its LONG PATH TOOL, a very easy to run but highly powerful software.Follow the link to read more about this error... and you felt the need to resurrect a 2 year old thread for sharing this?As it isn't a freeware I can only assume you use the forum for advertising ..... Edited November 8, 2010 by Jos 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.
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