Tekkion Posted July 9, 2014 Posted July 9, 2014 (edited) Hi there, the title says it all. My problem here is: im starting the autoit compiled .exes from a cmd window. So im also passing needed parameters there. These parameters are in this case paths to files, and sometimes some slashes within these paths got switched with the german "ß" character which lies on the same key as the backslash. After checking the cmd window the .exe call with the parameter includes the correct path. For some odd reason its only happening sometimes and also only in the license_A_Prof_Sec function. So any hints what could cause this problem? Here is my code: expandcollapse popup#RequireAdmin run("C:\Program Files (x86)\Avira\AntiVir Desktop\avcenter.exe") sleep(2000) $aWins=WinList("Avira") For $i = 1 To $aWins[0][0] Switch $aWins[$i][0] case "Avira Professional Security" license_A_Prof_Sec($aWins[$i][1]) Case "Avira Free Antivirus" license_A_Free_AV($aWins[$i][1]) EndSwitch Next func license_A_Free_AV($handle) WinActivate($handle) sleep(3000) Send("!H") Send("m") $whnd=winwait("Avira Free Antivirus","Lizenz",60) ControlClick($whnd,"","[CLASS:Static; INSTANCE:4]") $whnd=winwait("Öffnen") ControlSend($whnd,"","[CLASS:Edit; INSTANCE:1]",$CMDLine[1]) ControlClick($whnd,"","[CLASS:Button; INSTANCE:1]") $whnd=WinWait("Avira Free Antivirus","Lizenz ist bereits vorhanden",60) ControlClick($whnd,"","[CLASS:Button; INSTANCE:1]") $whnd=WinWait("Avira Free Antivirus","Die Lizenzdatei wurde aktualisiert",60) ControlClick($whnd,"","[CLASS:Button; INSTANCE:1]") $whnd=WinWait("Avira Free Antivirus","Lizenzinformationen",60) sleep(500) ControlClick($whnd,"","[CLASS:Button; INSTANCE:8]") winclose("Avira Free Antivirus") EndFunc func license_A_Prof_Sec($handle) WinActivate($handle) sleep(3000) Send("!H") Send("l") $whnd=winwait("Öffnen","",60) ControlSend($whnd,"","[CLASS:Edit; INSTANCE:1]",$CMDLine[1]) ControlClick($whnd,"","[CLASS:Button; INSTANCE:1]") $whnd=WinWait("Avira Professional Security","Die Lizenzdatei wurde aktualisiert",60) ControlClick($whnd,"","[CLASS:Button; INSTANCE:1]") winclose("Avira Professional Security") EndFunc Edited July 11, 2014 by Tekkion
Tekkion Posted July 9, 2014 Author Posted July 9, 2014 (edited) I think this is connected to the send im using before. After I put a sleep right before the send with the path string it seems to be working. Edited July 9, 2014 by Tekkion
Tekkion Posted July 10, 2014 Author Posted July 10, 2014 (edited) still having the problem.... problem occuring in line 62. here's my new code: expandcollapse popup#RequireAdmin sleep(2000) global $return=4 $aWins=WinList("Avira") For $i = 1 To $aWins[0][0] Switch $aWins[$i][0] case "Avira Professional Security" license_A_Prof_Sec($aWins[$i][1]) Case "Avira Free Antivirus" license_A_Free_AV($aWins[$i][1]) EndSwitch Next func license_A_Free_AV($handle) WinActivate($handle) sleep(3000) Send("!H") Send("m") $whnd=winwait("Avira Free Antivirus","Lizenz",60) ControlClick($whnd,"","[CLASS:Static; INSTANCE:4]") $whnd=winwait("Öffnen","",60) $path = StringReplace($CMDLine[1],"ß","\") sleep(3000) ControlSend($whnd,"","[CLASS:Edit; INSTANCE:1]",$path) sleep(3000) $whnd=winwait("Öffnen","",60) ControlClick($whnd,"","[CLASS:Button; INSTANCE:1]") sleep(500) ControlClick($whnd,"","[CLASS:Button; INSTANCE:2]") $whnd=WinWait("Avira Free Antivirus","Lizenz ist bereits vorhanden",60) ControlClick($whnd,"","[CLASS:Button; INSTANCE:1]") $whnd=WinWait("Avira Free Antivirus","wird nicht installiert",60) if $whnd=0 then $whnd=WinWait("Avira Free Antivirus","Die Lizenzdatei wurde aktualisiert",60) if $whnd <> 0 Then $return=0 endif ControlClick($whnd,"","[CLASS:Button; INSTANCE:1]") $whnd=WinWait("Avira Free Antivirus","Lizenzinformationen",60) sleep(500) ControlClick($whnd,"","[CLASS:Button; INSTANCE:8]") winclose("Avira Free Antivirus") Else $return=3 endif EndFunc func license_A_Prof_Sec($handle) WinActivate($handle) sleep(3000) Send("!H") Send("l") $whnd=winwait("Öffnen","",60) $path = StringReplace($CMDLine[1],"ß","\") sleep(3000) ControlSend($whnd,"","[CLASS:Edit; INSTANCE:1]",$path) sleep(3000) $whnd=winwait("Öffnen","",60) ControlClick($whnd,"","[CLASS:Button; INSTANCE:1]") sleep(500) ControlClick($whnd,"","[CLASS:Button; INSTANCE:2]") $whnd=WinWait("Avira Professional Security","wird nicht kopiert",60) if $whnd=0 then $whnd=WinWait("Avira Professional Security","Die Lizenzdatei wurde aktualisiert",60) if $whnd <> 0 Then $return=0 endif ControlClick($whnd,"","[CLASS:Button; INSTANCE:1]") winclose("Avira Professional Security") Else $return=3 EndIf EndFunc exit($return) Edited July 10, 2014 by Tekkion
Gianni Posted July 10, 2014 Posted July 10, 2014 still having the problem.... problem occuring in line 62. here's my new code: . . . $path = StringReplace($CMDLine[1],"ß","\") . . . that line should replace the letter "ß" with the backslash "" What happens instead of wrong for you? Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
Tekkion Posted July 11, 2014 Author Posted July 11, 2014 (edited) Its working well but I don't think that thats the problem, cause the path is correctly passed to the autoit file I checked it even before I use the controlsend command and it shows me the correct path. So I think thats some kind of bug that the ALT key is still pressed from the send before and so its negating the backslashes im trying to send. The question is now is there anyway to control if the ALT key is still pressed and if so reset him. What I will try now is to send a the path to a "dummy control" to negate this ALT key. edit: didnt help Edited July 11, 2014 by Tekkion
Tekkion Posted July 11, 2014 Author Posted July 11, 2014 also the strange thing is im trying this script on 4 different vms and this problem is only occuring on my win7 32bit machine :/
Gianni Posted July 11, 2014 Posted July 11, 2014 ..... The question is now is there anyway to control if the ALT key is still pressed and if so reset him. ..... Send("{ALTDOWN}{ALTUP}") Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
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