Jump to content

[RESOLVED] Copying the contents of a file?


Recommended Posts

I need to be able to copy the contents of a repeatedly used script without opening the script directly. The file is a UDF so would prefer to not handle it all the time for this but to just remotely "extract" the file's contents.

What command would one use for this, pls?

Thanks. muttley

Edited by Diana (Cda)
Link to comment
Share on other sites

Just use FileRead to read the file completely and close it again.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Just use FileRead to read the file completely and close it again.

Thanks! Knowing the command really helped.

Phew, another toughie. This post pointed the way: http://www.autoitscript.com/forum/index.ph...st&p=549573 Here's what I came up with:

;
; AutoIt
;
#include <_PartitionLetters.au3>     ; this replaces drive letters
#include<_WEReplacement.au3>     ; references a Windows Explorer replacement program
AutoItSetOption("WinTitleMatchMode", 2)     ; this allows partial window titles to be valid!
;===========================================================================================


$file = FileOpen($Fldr_Programs_DriveLtr & "\AutoIt\APP- AutoIt v3.2.10.0\Include\_PartitionLetters.au3", 0)
$READ = FileRead($FILE)
FileClose($FILE)
ClipPut($READ)


;----- PUTS THE RESULTS ON A TEXT EDITOR PAGE: ---------------------------------------------------------------------------------
ShellExecute($LaunchSciTE, "", "", "open", @SW_MAXIMIZE)     ; launches SciTE, maximized
WinWait("SciTE")
WinActivate("SciTE")
Send("^n")
WinWait("(Untitled)")
Send ("^v")
;-------------------------------------------------------------------------------------------------------------------------------oÝ÷ ØÜjǬ¢g¨¶«ìë&mméÞ~+lw¶²Â÷öØZ½é²Áè«uø¥z­È^­íý²Ê&zØb  ¨­ë-­¨ ×诫u«­¢+ÙÕѽ%ÑMÑ=ÁÑ¥½¸ ÅÕ½Ðí]¥¹Q¥Ñ±5Ñ¡5½ÅÕ½Ðì°È¤ìÑ¡¥Ì±±½ÝÌÁÉÑ¥°Ý¥¹½ÜѥѱÌѼٱ¥ÌÌì((ÀÌØí¥±ô¥±=Á¸¡Í­Ñ½Á¥ÈµÀìÅÕ½ÐìÀäÈíQÍÐ¥±¹ÑáÐÅÕ½Ðì°À¤(ÀÌØíIô¥±I ÀÌØí%1¤)¥±
±½Í ÀÌØí%1¤)
±¥ÁAÕÐ ÀÌØíI¤(((ì´´´´´AUQLQ!IMU1QL=8QaP%Q=HAè´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´)M¡±±áÕÑ ÅÕ½Ðí¹½ÑÁ¹áÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí½Á¸ÅÕ½Ðì°M]}5a%5%i¤)]¥¹]¥Ð ÅÕ½ÐíU¹Ñ¥Ñ±ÅÕ½Ðì¤)]¥¹Ñ¥ÙÑ ÅÕ½ÐíU¹Ñ¥Ñ±ÅÕ½Ðì¤)M¹ ÅÕ½Ðíy¸ÅÕ½Ðì¤)]¥¹]¥Ð ÅÕ½ÐíU¹Ñ¥Ñ±ÅÕ½Ðì¤)M¹ ÅÕ½ÐíyØÅÕ½Ðì¤

Thanks! muttley

Link to comment
Share on other sites

Or better yet, _FileReadToArray(), and if you want to move the file contents, _FileWriteFromArray()!

Hi, just saw your post, yet I "closed" this thread with the "Resolved" in the title. Why would you use this one over "FileRead", pls? Just curious. I don't know this second command but before going to the length of time and effort to figure it out (I'm very slow, you see, at figuring out syntax), just wondering what it would make easier.

Thanks much! muttley

Link to comment
Share on other sites

Hi, just saw your post, yet I "closed" this thread with the "Resolved" in the title. Why would you use this one over "FileRead", pls? Just curious. I don't know this second command but before going to the length of time and effort to figure it out (I'm very slow, you see, at figuring out syntax), just wondering what it would make easier.

Thanks much! muttley

_FileReadToArray reads each line into an array element. It wouldn't be better, or easier, to use for what you are wanting to do. Edited by cppman
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...