layer Posted April 9, 2005 Posted April 9, 2005 I know, I know, you could probably make it shorter by using _FileReadToArray... But when you compile a program, do you want the whole File.au3 in it? When you're only using one function from it? Thought so This is almost indentical to _FileReadToArray but, oh well... Func _ClipReadToArray(ByRef $a_ArrayData); ByRef there because $a_ArrayData may change Local $v_Clip, $h_TmpFile; Declaring Local strings $v_Clip = ClipGet(); Get data from clipboard FileWrite(@TempDir & "\ClipReadToArray.tmp", $v_Clip); write that data to a file in the TempDir $h_TmpFile = FileOpen(@TempDir & "\ClipReadToArray.tmp", 0); Get window handle of file written for easy access of it If $h_TmpFile = -1 Then Return 0; if autoit cant open this file, return 0, which initially quits the program $a_ArrayData = StringSplit(FileRead($h_TmpFile, FileGetSize(@TempDir & "\ClipReadToArray.tmp")), @LF); split the file into lines FileClose($h_TmpFile); close the file FileDelete(@TempDir & "\ClipReadToArray.tmp"); delete the file created Return 1; return success EndFunc ;==>_ClipReadToArray Dim $a_ArrayData If Not _ClipReadToArray($a_ArrayData) Then Return 0 For $i = 1 To $a_ArrayData[0] MsgBox(0, "ClipReadToArray", "Line " & $i & ": " & $a_ArrayData[$i]) Next FootbaG
Developers Jos Posted April 9, 2005 Developers Posted April 9, 2005 Layer, why are you writing it to disk first ? Why not like this: ? Func _ClipReadToArray(ByRef $a_ArrayData); ByRef there because $a_ArrayData may change $a_ArrayData = StringSplit(ClipGet() , @LF); split the file into lines Return 1 ; return success EndFunc ;==>_ClipReadToArray SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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