netGong Posted March 4, 2010 Share Posted March 4, 2010 Hi! I'm new, as you can probably tell. Don't hold it against me. I searched for similar problems as mine in the forum, but I didn't find anything -- I hope I'm not repeating. At the beginning of my script, I declare several variables that will be the understood directories for certain folder and files. For some of these, though, I am trying to combine a macro with a string, which I thought would be possible. Like so: $storage_dir = @MyDocumentsDir & "\Storage" But when I use the concatenator & in the variable declaration, it seems to recognize only the @MyDocumentsDir section, and nothing else. Am I doing something wrong here? What's up? Thanks in advance for your help. Link to comment Share on other sites More sharing options...
MHz Posted March 4, 2010 Share Posted March 4, 2010 Welcome to the AutoIt forums, I see nothing incorrect with your code. Perhaps your usage afterwards is the issue, but without further code shown then the issue could be almost anything. This seems OK $storage_dir = @MyDocumentsDir & "\Storage" MsgBox(0, '', $storage_dir) The messagebox shows correct for me. Link to comment Share on other sites More sharing options...
netGong Posted March 5, 2010 Author Share Posted March 5, 2010 Mhz, thanks for your help.I have solved the problem, I'm posting it here for general knowledge and in case anyone runs into a similar issue.I am not completely sure why this is the case, but the ShellExecute command did what the Run command did not.It turns out the concatenation works (I sent it to a message and it came back properly), but would refuse to open up the proper directory.After a little research and finding this, I tried switching Run out for ShellExecute, and using the concatenated directory as the file instead of the working directory. Oddly enough, this worked perfectly.I would love if someone would be capable of explaining why these intricacies work just so, but in the meantime, the problem is solved: when working with relative or concatenated directories, use ShellExecute. Link to comment Share on other sites More sharing options...
jchd Posted March 5, 2010 Share Posted March 5, 2010 This is probably due to the path containing whitespace or similar thing. Shell can cope with them without problem, but DOS much less (needs quoting "like this"). This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
MHz Posted March 5, 2010 Share Posted March 5, 2010 (edited) I would love if someone would be capable of explaining why these intricacies work just so, but in the meantime, the problem is solved: when working with relative or concatenated directories, use ShellExecute.Please refer back to my last post. Without my knowledge of how you are using the stored path then I can only make a wild guess.The first parameter of Run, RunWait, RunAs, RunAsWait, Shellexecute and ShellexecuteWait may need to be double quoted if white space exists in the path. The previous mentioned functions may need to know where to find the file being executed and the executable may need a working directory passed to it to find dependencies. Edited March 5, 2010 by MHz 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