Sign in to follow this  
Followers 0
gsb

Read a text file from a server into the users clipboard.

8 posts in this topic

#1 ·  Posted (edited)

First, Thanks all for the help so far. You all are a great help.

Now I need a push in the right direction.

In my control, I can open and copy to the clipboard some small text from my .ini file.

Now I have a need to copy a big 50-60 lines from a file to the user's clipboard.

I was hoping I could keep the file on my server and ... what? That is my question.

How would I go about reading the file contents from the server "behind the scenes" so to speak.

Hope you all have some clever ideas that you can share with me on this one.

For I do not know a good approach.

gsb

Edited by gsb

"Did you ever stop to think? ...and forget to restart!"

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If the 50 to 60 lines is the entire file then:

ClipPut(FileRead(...))

If the 50 to 60 lines is only part of the file of interest then look at FileReadLine.

Edit: As long as the user has "read permissions" on the server/file of interest, FileRead should be able to read it for them. I would suggest using a UNC path to the file instead of mapping a drive.

Edit: typos

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Hi and thanks herewasplato,

But the FileOpen/FileRead seems to be foe a local file, not a remote (server) file/URL.

See I am trying to read a text file that will be on the server not local to me.

Any thoughts there, or am I missing something?

gsb


"Did you ever stop to think? ...and forget to restart!"

Share this post


Link to post
Share on other sites

FileOpen and FileRead will work with "UNC" or "mapped drive" paths.

If the file is on a file server, then test my suggestion with this one line of code from within the SciTE editor:

ConsoleWrite(FileRead("......"))

If the file is on a "web" server that your users won't have file level access to - then there are several ways to get the file - mrRevoked has given you a couple.

...enjoy...


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Here's what I came up for a similar situation:

;Open browser
$RFOI=ObjCreate("InternetExplorer.Application.1")

;Keep the browser hidden from user
$RFOI.Visible=0

;Visit website
$RFOI.Navigate("http://www.awebsite.com/a.php")

;Read webpage into variable
$RFOIcontent = _IEDocReadHTML($RFOI)

;Put webpage content onto clipboard
ClipPut($RFOIcontent )

;Close browser
_IEQuit ($RFOI)
Edited by nerdgerl

My AutoIT's:[topic="53958"]Personal Encyclopedia/Dictionary[/topic][topic="46311"]MS Access (Style) Database[/topic]"Some people are born on third base and go through life thinking they hit a triple."

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Yes herewasplato.

I did mean a web server, sorry to be so unclear at that.

mrRevoked, May well be the push I needed, Thank You.

And nerdgerl. Thank you too. A full script. I will try it.

I will try all these later this morning.

Again, Thank you all for your help.

gsb

Edited by gsb

"Did you ever stop to think? ...and forget to restart!"

Share this post


Link to post
Share on other sites

OK!

So here is what I found to work fine:

#include <INet.au3>
ClipPut( _INetGetSource( 'www/..../tutorial_post.txt' ) )

Thanks again all. :whistle:

gsb


"Did you ever stop to think? ...and forget to restart!"

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  
Followers 0