Jump to content

copying several text items to clipboard


gcue
 Share

Recommended Posts

im trying to copy all the values (not keys) from an INI section

here's what i got....

how can i append in the for next loop to a variable then in the end id set data to the clipboard?

$assets=IniReadSection("test.ini", "test")

For $i = 1 To $assets[0][0]
        ??
Next

_ClipBoard_SetData($var)
$var = ''
For $i = 1 to $assets[0][0]
$var &= $assets[$i][0] & @CRLF; the "@CRLF" is optional, depends on what you want
Next

_ClipBoard_SetData($var)

That work?

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

  • 4 weeks later...

I do see that a answer was provided for you, but for the sake of us noobs, can you explain a bit more what these lines are doing to the information and how the suggestion fixed your problem? Thanks.

The code posted loops through the array and assembles a single string containing all the value names, then it puts that string in the clipboard.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

$var = ''

For $i = 1 to $assets[0][0]

$var &= $assets[$i][0] & @CRLF; the "@CRLF" is optional, depends on what you want

Next

_ClipBoard_SetData($var)

Reading the help file about the function IniReadSection give in-detailed explanation that if the function end successfully then the return value is a 2D array which it's first subscript (i.e, $arrIni[0][0]) is equal to the number of keys that was copied to the array which each key has a value (whether defined or not).

After the variable that is going to hold the whole string is initialized the script preform loop from the first key to the last one.

The line "$var &= $assets[$i][0]" is equivalent to "$var = $var & $assets[$i][0]" this line process each key (and not it's value) in the set and concatenating it's name as string to variable $var, lol I feel like it's useless so I'll stop here as it's the base and a few reading in the help file or the FAQ thread may clear things much better than I do...

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...