#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.12.1 Author: Christian Blank Version: 1.2 Script Function: Dieses programm lädt eine datei auf einen server hoch der server wird im ordner --tc--\data\hps\ gesucht #ce ---------------------------------------------------------------------------- Opt("TrayIconHide", 1); $tc = getvol("TC") $sd = getvol("SD") $dir = $tc & "\data\hps\" if($cmdLine[0] > 1) then $path = $cmdline[1] $file = $cmdline[2] Else msgbox(0,0,"First Parameter should be the server & the path to upload to (ex. my_server.de\var\www\localhost\), " & @crlf & _ @tab & "__ will be \," & @crlf & _ @tab & "@UserProfileDir\sendto\UPLOAD\ will be ''," & @crlf & _ @tab & "@UserProfileDir\AppData\Roaming\Microsoft\Windows\SendTo\UPLOAD\ will be ''," & @crlf & _ @tab & "--TC-- and --SD-- will be replaced" & @crlf & _ "the second Parameter should be the local file to be uploaded (or DIR!)"); exit endif $path = StringReplace($path,@UserProfileDir & "\sendto\UPLOAD\","") $path = StringReplace($path,@UserProfileDir & "\AppData\Roaming\Microsoft\Windows\SendTo\UPLOAD\","") $path = StringReplace($path,"--TC--",$tc) $path = StringReplace($path,"--SD--",$sd) $path = StringReplace($path,"__","\") $splitpaths = stringsplit($path,"\") $server = $splitpaths[1] $path = StringReplace($path,$server,"") $splitfile = stringsplit($file,"\") $filename = $splitfile[$splitfile[0]] $returnto = $splitfile[$splitfile[0]-1] if(stringright($path,1) = "\") Then Else $path = $path & "\" endif if(stringlen($server) < 4) Then msgbox(0,0,"please give more than 4 chars for servername " & $server) Exit endif $found = false $search = FileFindFirstFile($dir & "*" & $server & "*") While 1 $currfile = FileFindNextFile($search) If @error Then ExitLoop $attrib = FileGetAttrib($dir & $currfile) $fullpath = $dir & $currfile $found = true WEnd ; Close the search handle FileClose($search) if($found = true) then $content = fileread($fullpath) ;$content = stringreplace($content,@cr,"----------") $info = stringsplit($content,@cr); for $x = 1 to $info[0]-1 $info[$x] = stringreplace($info[$x],@crlf,"") $info[$x] = stringreplace($info[$x],@lf,"") $info[$x] = stringreplace($info[$x],@cr,"") next ;Create command for winscp $uploadfullname = $path & $filename $uploadfullname = stringreplace($uploadfullname,"\","/"); $winscpcommand = "put """ & $file & """ """ & $uploadfullname & """";sdf WinActivate($info[1]) if(winactive($info[1])=False) Then WinActivate($info[3]) if(winactive($info[3])=false) Then $command = $info[2]; $command = stringreplace($command,"--TC--",$tc) run($command) WinWaitActive($info[3],"",40) endif endif WinActivate($info[1]) if(winactive($info[1]) = false) Then WinActivate($info[3]) if(winactive($info[3]) = false) Then msgbox(0,0,"unable to run winscp") exit endif endif ; main action :-) ;msgbox(0,0,$winscpcommand) send($winscpcommand & "{ENTER}") opt("WinTitleMatchMode",2) WinActivate($returnto) Else msgbox(0,0,"configfile not found " & $server) endif func getvol($type) if($type="SD") Then $file = "SDToken" EndIf if($type="TC") Then $file = "TCToken" endif $var = DriveGetDrive( "all" ) If NOT @error Then For $i = 1 to $var[0] $status = DriveStatus( $var[$i]); if($status = "READY") then ;if($var[$i] <> "a:" and $var[$i] <> "b:") then if(fileexists($var[$i] & "\" & $file)) Then return $var[$i] endif endif Next EndIf return false endfunc