mentosan Posted March 25, 2009 Share Posted March 25, 2009 Hi I'm having this line and I could not succeed to make it run because it is interpeted as splitted: ControlSend ($handle,"","", 'plink -ssh -v -l ' & $user1 & ' -pw ' & $pass1 & " " & $ip1 & "{Enter}") Please help and explain. Thank you Link to comment Share on other sites More sharing options...
Zedna Posted March 25, 2009 Share Posted March 25, 2009 try this ControlSend ($handle,"","", 'plink -ssh -v -l "' & $user1 & '" -pw "' & $pass1 & '" "' & $ip1 & '"{Enter}') Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Varian Posted March 25, 2009 Share Posted March 25, 2009 (edited) Interpreted as split by Auto IT or another program? Syntax-wise, it's OK; maybe one of the variables has a character that the your program sees as unreadable (whitespace or unicode) Edited March 25, 2009 by Varian Link to comment Share on other sites More sharing options...
mentosan Posted March 25, 2009 Author Share Posted March 25, 2009 (edited) @ Zedna: It is not ok. What is the synthax you've been using ? Each word must be quoted, even variables ? @ Varian: by AutoIt. Edited March 25, 2009 by mentosan Link to comment Share on other sites More sharing options...
Varian Posted March 25, 2009 Share Posted March 25, 2009 (edited) I don't have any issue with your syntax as written. See what happens with this(it's copied & pasted from your line so it's not a fat-finger issue by you) Local $handle, $user1 = @username, $pass1 = 'password', $ip1 = @IPAddress1 Run('notepad.exe') If Not winWait('[REGEXPTITLE:(?i)Untitled|(?i)Notepad]', '', 5) Then Exit $handle = WinGetHandle('[REGEXPTITLE:(?i)Untitled|(?i)Notepad]', '') ControlSend($handle,"","", 'plink -ssh -v -l ' & $user1 & ' -pw ' & $pass1 & " " & $ip1 & "{Enter}") Zedna's just quoted it so that it would output (as an example): plink -ssh -v -l "Administrator" -pw "password" "10.10.25.53" Edited March 25, 2009 by Varian Link to comment Share on other sites More sharing options...
mentosan Posted March 25, 2009 Author Share Posted March 25, 2009 (edited) I found where the problem is. I'm declaring variables by FileRead. For example: ;$user1 = FileRead ("userlogon.txt") It is OK if I'm using: $user1 = "root" This leads me at your previous post ,Varian maybe one of the variables has a character that the your program sees as unreadable (whitespace or unicode). How can be this "fixed"? I have another question. Can you tell me what is the meaning of (?i) in this line: If Not winWait('[REGEXPTITLE:(?i)Untitled|(?i)Notepad]', '', 5) Then Exit And what does [last] means ? I saw this in another thread posted here on the forum : ControlSend("[last]", "", "", $variable & "{Enter}") Thank you very much for your support. Edited March 25, 2009 by mentosan Link to comment Share on other sites More sharing options...
Spiff59 Posted March 25, 2009 Share Posted March 25, 2009 (edited) You need to show us what's being retrieved from the "userlogon.txt" file.If the file is multiline, you may need to use FileReadLine, if it has embedded control characters (a StringLen() test would show that) you may need to put it through a StringStripWS() statement (or manually remove the characters). If it has embedded quotes, you'd probably want to remove them.From the help file under Regular Expressions, or StringregExp:(?i) = case-insensitivity So, it matches on "untitled" or "Untitled" or "notepad" or "nOtEpAd", etc, regardless of case.From the helpfile under "Window titles and text":[LAST] - Last window used in a previous AutoIt command Edited March 25, 2009 by Spiff59 Link to comment Share on other sites More sharing options...
mentosan Posted March 26, 2009 Author Share Posted March 26, 2009 (edited) What about this line ControlSend ($handle,'','', @ScriptDir & "\bin\plink" & '{Enter}') I'm getting error because @ScriptDir would be on my Desktop so the path is "C:\Documents and Settings\Administrator\Desktop\Script". How can I insert @ScriptDir into quotas ? I cannot manage to make it work. :| The return of the command is "C:\Documents" and I need "C:\Documents and Settings". Edited March 26, 2009 by mentosan Link to comment Share on other sites More sharing options...
Zedna Posted March 26, 2009 Share Posted March 26, 2009 What about this line ControlSend ($handle,'','', @ScriptDir & "\bin\plink" & '{Enter}') I'm getting error because @ScriptDir would be on my Desktop so the path is "C:\Documents and Settings\Administrator\Desktop\Script". How can I insert @ScriptDir into quotas ? I cannot manage to make it work. :| The return of the command is "C:\Documents" and I need "C:\Documents and Settings". ControlSend ($handle,'','', '"' & @ScriptDir & '\bin\plink"' & '{Enter}') Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now