Sreenivasulu Posted May 11, 2016 Share Posted May 11, 2016 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 comment Share on other sites More sharing options...
AutoBert Posted May 11, 2016 Share Posted May 11, 2016 If the file always in users desktopdir use ControlSetText("Open","","Edit1",@DesktopDir&"\FileUpload.txt") Link to comment Share on other sites More sharing options...
Sreenivasulu Posted May 11, 2016 Author Share Posted May 11, 2016 No Bert it would be in my project framework.. Link to comment Share on other sites More sharing options...
Sreenivasulu Posted May 11, 2016 Author Share Posted May 11, 2016 If i can fetch the project root path then i can add that path. But how to fetch the project root path in AutoIT. Link to comment Share on other sites More sharing options...
Trong Posted May 11, 2016 Share Posted May 11, 2016 ? @ScriptDir & "\FileUpload.txt" Regards, Link to comment Share on other sites More sharing options...
Berbozy Posted June 11, 2021 Share Posted June 11, 2021 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 comment Share on other sites More sharing options...
Luke94 Posted June 11, 2021 Share Posted June 11, 2021 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 comment Share on other sites More sharing options...
Berbozy Posted June 11, 2021 Share Posted June 11, 2021 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 comment Share on other sites More sharing options...
Luke94 Posted June 11, 2021 Share Posted June 11, 2021 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 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