hypernaut Posted February 10, 2007 Posted February 10, 2007 (edited) I get crazy... I have this line in a script:Run (@WindowsDir & "\system32\write.exe " & @ScriptDir & "\test.doc")I doesnt work if there are blanks in the '@scriptdir'-path.e.g. @scriptdir is "E:\my scripts\autoIt scripts\xxx" I tried variuos combinations with ' and " and whatever. Can someone please tell me the right syntax. Thanks, rob Edited February 10, 2007 by hypernaut
Moderators SmOke_N Posted February 10, 2007 Moderators Posted February 10, 2007 Run ('"' & @WindowsDir & '\system32\write.exe" "' & @ScriptDir & '\test.doc"') Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
hypernaut Posted February 10, 2007 Author Posted February 10, 2007 (edited) Thanks you saved my day. Would be a lot easier if one could use macros in strings... Anyway, one more question, though: i wonder why the same script (in the same path) has no problems with this line: FileOpen(@ScriptDir &"\text1.txt", 0) and when i use the same method as above FileOpen('"'& @ScriptDir & '\text1.txt"', 0) it doesnt work. rob Edited February 10, 2007 by hypernaut
Shevilie Posted February 10, 2007 Posted February 10, 2007 Well its not the same.... the top line is C:\Script\Dir\text1.txt The second is "C:\Script\Dir\text1.txt" Might because of the way OpenFile works, I dont know Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
hypernaut Posted February 10, 2007 Author Posted February 10, 2007 (edited) i know but isnt that strange? In the manual the filename in the FILEOPEN-command is enclosed in quotation marks the same way as in the RUN-command.: FileOpen ( "filename", mode )Run ( "filename" [, "workingdir" [, flag]] ) yet it works different. Edited February 10, 2007 by hypernaut
Shevilie Posted February 10, 2007 Posted February 10, 2007 Well have a test.. make a test.txt on your C-drive (I cant sitting with a borrowed computer) then try FileOpen("C:\test.txt") and the try FileOpen('"C:\test.txt"') Well the bottomline is newer use path with spaces Should have been banned a long time ago Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
hypernaut Posted February 10, 2007 Author Posted February 10, 2007 (edited) Well have a test.. make a test.txt on your C-drive (I cant sitting with a borrowed computer) then tryFileOpen("C:\test.txt") and the try FileOpen('"C:\test.txt"')Thats not the point. If its described the same way it should work the same way, shouldn't it?For someone who is new to autoIT, like me, its hard to predict what happens, otherwise.Well the bottomline is newer use path with spaces Should have been banned a long time ago I dont use blanks. But if you script for a bigger environment you (your code) has to be prepared for anything. Edited February 10, 2007 by hypernaut
Shevilie Posted February 10, 2007 Posted February 10, 2007 Well the two things was actually for testing.. I dont know what they will return, and I'm actually curios If the second will work But I think the main problem is that in your start question, that the scriptdir is a parameter for the program you are running, and as a parameter you'll need the extra " to tell the program that its not two but one parameter... Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
Shevilie Posted February 10, 2007 Posted February 10, 2007 Well yea the nut must be the parameters, because if you used run without a parameter (only to run a program) you would never add the explicit ".. So the extra " must be because of theres a parameter and a space... Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
hypernaut Posted February 10, 2007 Author Posted February 10, 2007 (edited) mmmh.. but no. That: FileOpen(@ScriptDir &"\text1.txt", 0) works. That: Run (@ScriptDir &"\text1.txt") doesn't. Here i get an "Cant find the file"-Error. Edited February 10, 2007 by hypernaut
Shevilie Posted February 10, 2007 Posted February 10, 2007 I'm not sure you can run an txt... Try making a txt in your C drive and run it like this Run("C:\test.txt") Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
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