Jump to content

traytip progress


Recommended Posts

Hello, my script initiates a putty secure copy session and I want to update the traytip with its progress only on mouseover, however I can't get it to update, it only shows the first message and last message. Please help.

note: you'll want to change "monte@10.1.1.253:/home/monte" to reflect your userid and directory path

and change "myPassword" in "stdinwrite($pscp, "myPassword" & @CRLF)" to a valid password.

To use: just drag the file you want to copy to your sever onto the compiled script and away it'll go.

#include <Constants.au3>
Opt("TrayOnEventMode",1)

TraySetOnEvent($TRAY_EVENT_MOUSEOVER,"message")
TraySetState()

;global variable to test if we can display the current progress
;script errors on $tipLine not declared if this doesn't exist
$pscpTest = 0

$pscp = run(@comspec & " /c " & "c:\progra~1\putty\pscp " & """" & $CmdLine[1] & """" & " monte@10.1.1.253:/home/monte/", "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)

While 1
  $line = StdoutRead($pscp)
  If @error Then ExitLoop
  if stringinstr($line, "password", 0) > 0 then
    stdinwrite($pscp, "myPassword" & @CRLF)
  ;wait until pscp closes
    while 1
    $tipLine = StdoutRead($pscp)
    TrayTip("", $tipLine, 1)
    $pscpTest = 1
      if not processexists($pscp) then
        TrayTip("pscp", $CmdLine[1] & " has been copied successfully", 7)
        exit
      sleep(1000)
      endif
    wend
  endif  
  sleep(500)
Wend

func message()
  if $pscpTest = 1 then
    TrayTip("", $tipLine, 1)
  endif
endfunc
Edited by monte
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...