Sign in to follow this  
Followers 0

Clipboard utility to interface with AU3

9 posts in this topic

Posted

Here's a cool little utility (cb.exe) to route output from a commandline app straight to the clipboard .. which can then be interrogated from within AU3 (thereby avoiding the need to bounce the info through a file)

;BOUNCING RESULTS THROUGH A FILE
    $sExeListName = "c:\exelist.txt"
    RunWait(@comspec & " /c dir *.EXE /s/b>" & $sExeListName,"",@SW_HIDE)
    $sExeList = FileRead($sExeListName, FileGetSize($sExeListName))
    FileDelete($sExeListName)


;CLEVERLY USING CB.EXE INSTEAD
    RunWait(@comspec & " /c dir *.EXE /s/b|cb.exe","",@SW_HIDE)
    $sExeList = ClipGet()

Have fun :D

Share this post


Link to post
Share on other sites



Posted

Nice. Very nice.

Share this post


Link to post
Share on other sites

Posted

this'll come in handy. :D

Share this post


Link to post
Share on other sites

Posted

How would you write the ClipGet to a txt file ?

Share this post


Link to post
Share on other sites

Posted

How would you write the ClipGet  to a txt file ?

to output to text file:

dir c:\windows > c:\dirlist.txt

to append:

dir c:\windows >> c:\dirlist.txt

Share this post


Link to post
Share on other sites

Posted

What does this do that DirectTo.exe doesn't?

Share this post


Link to post
Share on other sites

Posted

What does this do that DirectTo.exe doesn't?

Dunno till I see DirectTo.exe :D .. What / where is DirectTo.exe? Even Google doesn't appear to have heard of it. Care to share a link?

Share this post


Link to post
Share on other sites

Posted

Ummm, best I can do you is a cut-n-paste of the e-mail Larry sent to the Yahoo Group a while back:

http://groups.yahoo.com/group/AutoItList/f...IL/DirectTo.zip

I have created a utility to direct %comspec% derived information into

the clipboard OR an Environment Variable that can be retrieved

through a subsequently run script... here is the readme text...

DirectTo.exe

-  A console app to use in a %comspec% session to pipe info

into the clipboard or into an "Environment Variable".

Usage

-  redirect to clipboard

....<stdout> | DirectTo.exe /c

-  redirect to Environment Variable and run App

....<stdout> | DirectTo.exe /e "VariableName" "File String To Run"

Examples

Dir | DirectTo.exe /c

Dir | DirectTo.exe /e OUTPUT "MyExe.exe MyArgument"

AutoIt Usage (Compiled AutoIt3)

If $CmdLine[0] = 1 Then

MsgBox(4096,"I got the Output",EnvGet("OUTPUT"))

Else

MsgBox(4096,"","Click OK to run DirectTo.exe test")

;WORD WRAP CRAPPED

RunWait(@COMSPEC & ' /c DIR | DirectTo.exe /e OUTPUT "' &

@ScriptFullPath & ' test"',"",@SW_HIDE)

EndIf

essentially the RunWait runs this... (on my PC)

cmd.exe /c DIR | DirectTo.exe /e OUTPUT "c:\DirectToTest.exe test"

which populates the environment var "OUTPUT" with the dir listing and

reruns my script so that I can play with EnvGet("OUTPUT")

Larry

Share this post


Link to post
Share on other sites

Posted

Thanks Chris - and thanks Larry :D Now we have two to choose from!

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