Ask a Question

How can i open a folder and read/write into a text file which is protected by Username and Password?

bommareddy
Contributor

How can i open a folder and read/write into a text file which is protected by Username and Password?

Hi Team,

 

Let us assume

Path : C:\app\Modifying\Automation

Folder Name : Automation

Text file Name : abc.txt

 

I want to open a text file(abc.txt) which is available in the folder Automation. But the folder is password protected.

i.e when i am trying to open Automation folder manually by double clicking, A popup will appear and i need to enter username and password.

 

Using script, How can i open a folder and read/write into a text file which is protected by Username and Password.

 

Thanks in Advance,

BommaReddy

8 REPLIES 8
AlexKaras
Community Hero

Hi,

 

Hm-m-m... Anything that prevents you from providing proper credentials into the dialog?

Have you tried to record your actions with TestComplete and check the result of the recording?

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
shankar_r
Community Hero

What happens when try to use aqFile.OpenTextFile(<filePath>,11,20)?


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

Hi Shankar,

 

When i tried to open using syntax OpenTextFile(<filePath>,11,20), I am getting error as "Unable to open the file."

 

Regards, 

BommaReddy

That is expected result.

Where your file located,

Is it network drive? If it is network drive then you can do some stuffs available https://www.codeproject.com/Questions/265459/HOW-TO-ACCESS-A-SHARED-FOLDER-VIA-COMMAND-LINE

Or Folder locked with some other folder locker tool? You have find out whether that locker tool have any command line options to unlock your folder.

 


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

bommareddy
Contributor

Yes. The file is located in FTP(File transfer protocol).

So how can I establish a connection from script to read and write in a text file which is located in FTP?

Regards,
BommaReddy

I have not worked with those stuffs but i guess you can use below line to connect the network drive

 

net use "\\NETWORKPATH\DRIVENAME" /user:"ROUTERNAME" "PW"

But I'm not sure how it is going to help you  😞


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

Hi,

 

> The file is located in FTP

This thread might help: https://community.smartbear.com/t5/TestComplete-General-Discussions/Uploading-file-to-an-FTP-server/...

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
HKosova
SmartBear Alumni (Retired)


@bommareddy wrote:
The file is located in FTP(File transfer protocol).

So how can I establish a connection from script to read and write in a text file which is located in FTP?

You'll need to download the file from FTP to the local computer, then read/write the file (e.g. using the aqFile object), then upload the file back to FTP.

 

There are several ways to work with FTP:

Hope this helps!


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: