Sign in to follow this  
Followers 0
gcue

copying several text items to clipboard

6 posts in this topic

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)

Share this post


Link to post
Share on other sites



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]

Share this post


Link to post
Share on other sites

brilliant!!!

works perfectly

many thanks!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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...

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