gironhimo Posted June 13, 2017 Posted June 13, 2017 (edited) Hallo, ich würde gerne ein Script erstellen welches simpel einen Button klickt, aber es funktioniert trotz zahlreicher Beispiele nicht. Ich habe sogar Beispielscripte original 1 zu 1 übernommen, doch auch diese funktionieren nicht. Trans: I would like to create a script which simply clicks a button, but it does not work despite numerous examples.I have even taken sample scripts original 1 to 1, but also these do not work. Edited June 13, 2017 by Melba23 Added translation
gironhimo Posted June 13, 2017 Author Posted June 13, 2017 (edited) Hallo, ich würde gerne ein Script erstellen welches simpel einen Button klickt, aber es funktioniert trotz zahlreicher Beispiele nicht. Ich habe sogar Beispielscripte original 1 zu 1 übernommen, doch auch diese funktionieren nicht. Selbst die einfachen Notepad Scripte funktionieren absolut nicht, Weder Maus Clicks noch Send. Ich habe absolut keine Ahnung, warum selbst die einfachsten Scripte nicht funktionieren. Gibt es vielleicht generell ein Problem mit Win10 oder was mache ich falsch, das keine Scripte anziehen. Zwar öffnen sich Programmewenn ich diese mit Run oder Shell execute aufrufe, aber ControlClicks bzw Send commands funktionieren nicht. Trans: I would like to create a script which simply clicks a button, but it does not work despite numerous examples.I have even taken sample scripts original 1 to 1, but also these do not work.Even the simple notepad scripts do not work absolutely, neither mouse clicks nor send. I have absolutely no idea why even the simplest scripts do not work.Is there generally a problem with Win10 or what I do wrong, which do not attract scripts.Although open programs when I run these with Run or Shell execute, but ControlClicks or Send commands do not work. ShellExecute(@ScriptDir&"\Ninite.exe") #While 1 # WinSetTrans ( "Preparing", "", 0 ) # WinSetTrans ( "Ninite", "", 0 ) # $text = WinGetText("Ninite", "") # If StringInStr($text, "Finished.",1) Then # ExitLoop # EndIf # Sleep(500) #WEnd Sleep(1000) ControlClick("Ninite", "", "[CLASS:Button; TEXT:Close; INSTANCE:1]") ControlClick("Ninite", "", "[ID:2]") Edited June 13, 2017 by Melba23 Added translation and code tags
Moderators Melba23 Posted June 13, 2017 Moderators Posted June 13, 2017 gironhimo, This is an English-speaking forum - please use a translation site if you are concerned about your own language skills. Please post the code you have been trying (see here how to do it) so we can try and spot the problem. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
gironhimo Posted June 13, 2017 Author Posted June 13, 2017 (edited) Hello, I try to use to buils a script under Win10 but without any succsess and i have absolut no idea why. I have try to use sample scripts for Notepad but nothing works, no control click no send. Even given ample notepad scripts doesn't work. I can start programs with run or shellexecute command but i am not able to send message/text or control click command and i don't understand. Is it a problem with win10 build 1703 or what can be the reason for that ? Here an excample for a script which i need to use. ShellExecute(@ScriptDir&"\Ninite.exe") While 1 WinSetTrans ( "Preparing", "", 0 ) WinSetTrans ( "Ninite", "", 0 ) $text = WinGetText("Ninite", "") If StringInStr($text, "Finished.",1) Then ExitLoop EndIf Sleep(500) WEnd Sleep(1000) #ControlClick("Ninite", "", "[CLASS:Button; TEXT:Close; INSTANCE:1]") ControlClick("Ninite", "", "[ID:2]") Edited June 13, 2017 by Melba23 Added code tags
anthonyjr2 Posted June 13, 2017 Posted June 13, 2017 Are you sure the titles are from the beginning? The default window title match mode is a string starting from the beginning of the title. If you want to match any substring of the title, you can put Opt("WinTitleMatchMode", 1) at the top of your script. UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=
MattHiggs Posted June 13, 2017 Posted June 13, 2017 6 hours ago, gironhimo said: Hello, I try to use to buils a script under Win10 but without any succsess and i have absolut no idea why. I have try to use sample scripts for Notepad but nothing works, no control click no send. Even given ample notepad scripts doesn't work. I can start programs with run or shellexecute command but i am not able to send message/text or control click command and i don't understand. Is it a problem with win10 build 1703 or what can be the reason for that ? Here an excample for a script which i need to use. ShellExecute(@ScriptDir&"\Ninite.exe") While 1 WinSetTrans ( "Preparing", "", 0 ) WinSetTrans ( "Ninite", "", 0 ) $text = WinGetText("Ninite", "") If StringInStr($text, "Finished.",1) Then ExitLoop EndIf Sleep(500) WEnd Sleep(1000) #ControlClick("Ninite", "", "[CLASS:Button; TEXT:Close; INSTANCE:1]") ControlClick("Ninite", "", "[ID:2]") It looks like you are trying to run a ninite installer. The way the script is written is very...odd. Why would you put the WinSetTrans inside the while loop? Try this: #RequireAdmin ShellExecute ( @ScriptDir & "\ninite.exe" ) $win = WinWait ( "Ninite" ) WinSetTrans ( $win, "", 0 ) Do Sleep ( 300 ) Until WinExists ( "Ninite", "Close" ) WinActivate ( "Ninite", "Close" ) WinWaitActive ( "Ninite", "Close" ) ControlClick ( "Ninite", "Close", 2 )
anthonyjr2 Posted June 13, 2017 Posted June 13, 2017 Oh, I didn't even notice he was missing #RequireAdmin. That is definitely the reason he was not able to click the controls. UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=
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