Jump to content
Sign in to follow this  
netGong

Concatenation Failing

Recommended Posts

netGong

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.

Share this post


Link to post
Share on other sites
MHz

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.

Share this post


Link to post
Share on other sites
netGong

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.

Share this post


Link to post
Share on other sites
jchd

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 here
RegExp tutorial: enough to get started
PCRE 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)

Share this post


Link to post
Share on other sites
MHz

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 by MHz

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.