Jump to content

How to append file path in Autoit


Recommended Posts

Are you getting any error?

Please note, Once AutoIt closes, the variables will cease to exist. If you want to permanently set, use registry write operation. Search this forum.

 

Edited by Anoop
Link to comment
Share on other sites

Ignore the posts above, they're not helping you.

You want to use EnvGet to retrieve an environment variable's value. So to get the value that qm_AttachmentsFile contains you'd use EnvGet("qm_AttachmentsFile") and that will return the value.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

2 hours ago, BrewManNH said:

 

Ignore the posts above, they're not helping you.

 

:D :D :D 

@vikashbitm2010, So let BreManNH post help you.

If you need any more details, please feel free to ask me.

Edited by Anoop
Link to comment
Share on other sites

Anoop, I'm sorry if you got all hurt because I told the truth.

The OP was asking how to use an environment variable in a script. Everything you posted was telling him how to set the variable which is not what he needed. If the OP kept following your advice he'd have gotten more confused and wondering why it wasn't working. You weren't helping, you were just confusing the issue.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

5 hours ago, BrewManNH said:

Anoop, I'm sorry if you got all hurt because I told the truth.

The OP was asking how to use an environment variable in a script. Everything you posted was telling him how to set the variable which is not what he needed. If the OP kept following your advice he'd have gotten more confused and wondering why it wasn't working. You weren't helping, you were just confusing the issue.

Unfortunately, I don't think that there is some truth :) . His question clearly states that, he has a batch file with an environment variable which is getting appended with some file path. And he wants to do it with Autoit. Per my knowledge, envget will not do this.

Link to comment
Share on other sites

Hi Anoop,

Thanks for understanding my query. Here you described in the same way.

EnvGet will not work in this case.

I have req with autoit as follows:

There is an environment variable " qm_AttachmentsFile " which is added to the process environment already during my application execution.

Now The value of the environment variable "qm_AttachmentsFile" should be the the full pathname to the file.

And It is very successful with the batch file:

echo myfile = D:\\myfile.txt >> %qm_AttachmentsFile%

In above line present in batch file, the value as full pathname to the file is getting appended in the environment variable " qm_AttachmentsFile ".

 

But I dont want to use batch file, so I want to do this through AutoIt script.

Any idea will be appreciated.

 

 

 

Link to comment
Share on other sites

EnvSet("qm_AttachmentsFile" ," D:\myfile.txt")
MsgBox(0,"",EnvGet("qm_AttachmentsFile"))

The above script is correctly setting the environment variable and I can get it back using EnvGet. But please note - A environment variable set in this way will only be accessible to programs that AutoIt spawns (Run(), RunWait()). Once AutoIt closes, the variables will cease to exist.

For permanently setting, you can use the script provided in the below post as reference.

 

Edited by Anoop
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...