Sign in to follow this  
Followers 0
blckpythn

Creating text from array data. [Solved]

9 posts in this topic

#1 ·  Posted (edited)

Hey guys, back from the grave here(long time no see)

I've got a little utility for many of my clients to see and copy-to-clipboard basic computer information for our ticketing system.

In this script I want to include any mapped drives during the ClipPut command.

Unfortunately I'm not quite sure how to enumerate and convert to text these drives. I can get them to print to console just fine, but I want to include in the ClipPut function.

Here is the jist of it.

$drives = DriveGetDrive("NETWORK")
If @error Then
ConsoleWrite("An error occured while retrieving the drives.")
Else
For $i = 1 To $drives[0]
ConsoleWrite(StringUpper($drives[$i]) & " " & DriveMapGet($drives[$i]) & @CRLF)
Next
EndIf

Func Copy()
ClipPut("Drives: " & )

EndFunc ;==>Copy

Forgive me if I screwed up the autoit-in-forum tags.

So at the 3rd to last line after "Drives: " I want it to show each drive letter and path like the ConsoleWrite command does.

Any ideas of how to do this without manhandling an array value repeatedly?

I'm assuming there has to be a way to do a For...To loop within the ClipPut parenthesis, yes?

Edited by blckpythn

Share this post


Link to post
Share on other sites



After that press CTRL+V

Local $drives = DriveGetDrive("NETWORK")
Local $tmp
If @error Then
ConsoleWrite("An error occured while retrieving the drives.")
Else
For $i = 1 To $drives[0]
;~ ConsoleWrite(StringUpper($drives[$i]) & " " & DriveMapGet($drives[$i]) & @CRLF)
$tmp &= StringUpper($drives[$i]) & " " & DriveMapGet($drives[$i]) & @CRLF
Next
ClipPut($tmp)
EndIf

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Ah, thank you! That makes so much sense.

Share this post


Link to post
Share on other sites

Unfortunately I'm now getting a syntax error at the end of the @CRLF, says it's missing Next. If I put Next on the same line then it says my EndFunc is ending the For loop.

Share this post


Link to post
Share on other sites

Show your code, please.


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

$drives = DriveGetDrive("NETWORK")
$clipboard = ""

For $i = 1 To $drives[0]
$clipboard &= StringUpper($drives[$i]) & " " & DriveMapGet($drives[$i]) & @CRLF
Next


$clipboard &= "[/code]"
ClipPut($clipboard)

You forgot to close the ) from StringUpper.


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Ha, thank you, I feel stupid.

Share this post


Link to post
Share on other sites

Little mistake, nothing really stupid.

Glad I could help.


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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