Jump to content

How to pass root path of the file to be uploaded in Autoit Script


Recommended Posts

ControlFocus("Open","","Edit1")
ControlSetText("Open","","Edit1","C:\Users\srym\Desktop\FileUpload.txt")
ControlClick("Open","","Button1")

 

This is the AutoIT script written for File upload.

The text highlighted in Red, it is the path of the file that needs to be uploaded.But if want to execute my script in some other machine i need to change this path every time.

So can anyone help me writing this path in generic way so that i dont have to change this path every time running in different machine.

Link to post
Share on other sites
  • 5 years later...
On 5/11/2016 at 12:26 PM, Sreenivasulu said:

ControlFocus("Open","","Edit1")
ControlSetText("Open","","Edit1","C:\Users\srym\Desktop\FileUpload.txt")
ControlClick("Open","","Button1")

 

This is the AutoIT script written for File upload.

The text highlighted in Red, it is the path of the file that needs to be uploaded.But if want to execute my script in some other machine i need to change this path every time.

So can anyone help me writing this path in generic way so that i dont have to change this path every time running in different machine.

Hi,

did u fix that issue?

 

Link to post
Share on other sites
1 hour ago, Berbozy said:

Hi,

did u fix that issue?

 

If the file would be on the Desktop, you can use:

ControlSetText("Open","","Edit1", @DesktopDir & "\FileUpload.txt")

If the file would be in the same directory as the script, you can use:

ControlSetText("Open","","Edit1", @ScriptDir & "\FileUpload.txt")

I'm assuming you're looking for answer as this thread is over 5 years old?

Link to post
Share on other sites

Hi 

Merci Luke!,

I tried those macros but it did not work. while i' m executing from jenkins by using slave machines, its not able to find path. i need generic way to find the document which is desired to upload

Link to post
Share on other sites
7 minutes ago, Berbozy said:

Hi 

Merci Luke!,

I tried those macros but it did not work. while i' m executing from jenkins by using slave machines, its not able to find path. i need generic way to find the document which is desired to upload

Try asking here☺️

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...