Jump to content

Filepath with blanks


 Share

Recommended Posts

I get crazy... :whistle:

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 by hypernaut
Link to comment
Share on other sites

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 by hypernaut
Link to comment
Share on other sites

i know :whistle:

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 by hypernaut
Link to comment
Share on other sites

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 :whistle:

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
Share on other sites

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"')

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 :lol: 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. :whistle:

Edited by hypernaut
Link to comment
Share on other sites

Well the two things was actually for testing.. I dont know what they will return, and I'm actually curios :whistle: 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

Link to comment
Share on other sites

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

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...