Jump to content
Sign in to follow this  
failedtocompile

Help with defining @MyDocumentsDir

Recommended Posts

failedtocompile

Hello Again :D

I created a topic the other day Other Topic

which has been resolved. I have now tried to implement into a new test environment which has users My Documents redirected onto a server share

e.g. \\server101\user101\my documents

Code that was working for standalone computers with local my documents.

RunWait('"C:\Program Files\?? ??\??\WIZ.EXE" /q /f /s " & @MyDocumentsDir & \officebkup\officebkup.OPS"')

Is there a way to make @MyDocumentsDir = %HomeShare%\officebkup\officebkup.OPS

I have tried this:

RunWait('"C:\Program Files\?? ??\??\WIZ.EXE" /q /f /s " & %HomeShare% & \officebkup\officebkup.OPS"')

Only problem is it saves it to C:\Program Files\?? ??\??\%HomeShare%\officebkup\officebkup.ops .

Do i need to added more double quotes? or can i reassign @MyDocumentsDir to - %HomeShare% .

Thanks in advance

Failedtocompile

Edited by failedtocompile

Share this post


Link to post
Share on other sites
martin

Hello Again :D

I created a topic the other day Other Topic

which has been resolved. I have now tried to implement into a new test environment which has users My Documents redirected onto a server share

e.g. \\server101\user101\my documents

Code that was working for standalone computers with local my documents.

RunWait('"C:\Program Files\?? ??\??\WIZ.EXE" /q /f /s " & @MyDocumentsDir & \officebkup\officebkup.OPS"')

Is there a way to make @MyDocumentsDir = %HomeShare%\officebkup\officebkup.OPS

I have tried this:

RunWait('"C:\Program Files\?? ??\??\WIZ.EXE" /q /f /s " & %HomeShare% & \officebkup\officebkup.OPS"')

Only problem is it saves it to C:\Program Files\?? ??\??\%HomeShare%\officebkup\officebkup.ops .

Do i need to added more double quotes? or can i reassign @MyDocumentsDir to - %HomeShare% .

Thanks in advance

Failedtocompile

When you say that this was working

RunWait('"C:\Program Files\?? ??\??\WIZ.EXE" /q /f /s " & @MyDocumentsDir & \officebkup\officebkup.OPS"')

I assume you mean that it saved into

C:\Program Files\?? ??\??\@MyDocumentsDir\officebkup\officebkup.ops

and the @MyDocumentsDir macro was not used at all.

You cannot assign a value to a macro like @MyDocumentsDir. Macros are read only and they represent some code in AutoIt which reads a value from the registry for example or calculates some value. All you need is to have your own variable.

I assume that HomeShare is an eviromental variable in which case you can read it with EnvGet("HomeShare").

$MyHomeShare = EnvGet("HomeShare") 
RunWait('"C:\Program Files\?? ??\??\WIZ.EXE" /q /f /s "' & $MyHomeShare & '\officebkup\officebkup.OPS"')

Please note that I have inserted 2 inverted commas, one before and one after $MyHomeSHare which I think you missed out in your example.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
rajeshontheweb

hmm the best thing would be to use a variable to store tbe command path as i had mentioned in the other script. this is kind of situations which made me use variables to store paths rather than actually using them at runtime.

viz., instead of

@MyDocumentsDir & \officebkup\officebkup.OPS

i would use

$path = @MyDocumentsDir & \officebkup\officebkup.OPS

similarly

$path =%HomeShare%& \officebkup\officebkup.OPS

but beware, rather than using enviroment variables, u better expand the environment variables to and pass the autoit value to path which willbe much more foolproof.

$path = EnvGet("HomeShare") & "\officebkup\officebkup.OPS"
would work better, in my guess, and of course, if spaces are there, i would again recommend using filegetshortname while passing it to command prompt...

oooooh, while i was updating my message for envget, martin has posted already!!!

Edited by rajeshontheweb

Share this post


Link to post
Share on other sites
failedtocompile

When you say that this was working

RunWait('"C:\Program Files\?? ??\??\WIZ.EXE" /q /f /s " & @MyDocumentsDir & \officebkup\officebkup.OPS"')

I assume you mean that it saved into

C:\Program Files\?? ??\??\@MyDocumentsDir\officebkup\officebkup.ops

and the @MyDocumentsDir macro was not used at all.

You cannot assign a value to a macro like @MyDocumentsDir. Macros are read only and they represent some code in AutoIt which reads a value from the registry for example or calculates some value. All you need is to have your own variable.

I assume that HomeShare is an eviromental variable in which case you can read it with EnvGet("HomeShare").

$MyHomeShare = EnvGet("HomeShare") 
RunWait('"C:\Program Files\?? ??\??\WIZ.EXE" /q /f /s "' & $MyHomeShare & '\officebkup\officebkup.OPS"')

Please note that I have inserted 2 inverted commas, one before and one after $MyHomeSHare which I think you missed out in your example.

Thanks Martin & rajeshontheweb, that worked no problems at all.

This Community forum by far is the best for support, and Im learning heaps small steps at a time.

Thanks again

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.