faustf Posted March 3, 2017 Posted March 3, 2017 hi guys i have pageweb , it , have a button for upload image , i click them and it open a dialog file , i analize them with , Autoit v3 info expandcollapse popup>>>> Window <<<< Title: Choose File to Upload Class: #32770 Position: 115, 42 Size: 960, 489 Style: 0x96CC02C4 ExStyle: 0x00010101 Handle: 0x00221CFE >>>> Control <<<< Class: Instance: ClassnameNN: Name: Advanced (Class): ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: >>>> Mouse <<<< Position: 189, 500 Cursor ID: 0 Color: 0xD4D0C8 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Namespace Tree Control Tree View ShellView File &name: Files of &type: All Files (*.*) &Open Cancel Address: Libraries\Documents >>>> Hidden Text <<<< Namespace Tree Control Shell Preview Extension Host &Help i write a code like this If WinActive("[CLASS:#32770]") Then MsgBox(0,'','image is open ') EndIf but not work , how is possible if i call a class correct??? thankz at all
Moderators JLogan3o13 Posted March 3, 2017 Moderators Posted March 3, 2017 Does it work if you use the title instead of the class? Is the window actually active? Once again, you throw stuff out there without stating what you have done to troubleshoot the issue. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
faustf Posted March 3, 2017 Author Posted March 3, 2017 (edited) sorry , yes the windows is active , and i just tryed to use title but , not have much expirience about use it for test title i used this to command If WinActive("[Title:Choose File to Upload]") Then and dont go If WinActive("Choose File to Upload") Then and dont go also this but nothing If WinActive("[CLASS:Choose File to Upload]") Then Edited March 3, 2017 by faustf
faustf Posted March 3, 2017 Author Posted March 3, 2017 i saw but , i dont understund so much , i , if you want test my all script expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: faustf Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <File.au3> #include <IE.au3> #include <Array.au3> Global $ISP_WEB = 0 _StartShpock() Func _StartShpock() If ProcessExists("iexplore.exe") Then ; Check if the internet esplorer process is running. ProcessClose("iexplore.exe") EndIf #cs Local $oIE = _IECreate ("https://it.shpock.com/my/signup/") Local $oForm = _IEFormGetCollection($oIE, 0) Local $username = _IEFormElementGetCollection ($oForm, 1) Local $password = _IEFormElementGetCollection ($oForm, 2) _IEFormElementSetValue ($username, "USER") _IEFormElementSetValue ($password, "PASS") _IEFormSubmit($oForm) #ce ;#cs Global $oIE = _IECreate("https://it.shpock.com/my/signup/", 0, 1, 1, 1) ; <--- 0011 invisible explorer <--- 0111 visible explorer _IELoadWait($oIE) Local $oBtns = $oIE.document.GetElementsByTagName("input") For $oBtn In $oBtns $classname = String($oBtn.classname()) $placehold = String($oBtn.placeholder()) ;ConsoleWrite($classname & @CRLF) If $classname = "password" Then _IEAction($oBtn, "click") _IEFormElementSetValue($oBtn, "kronos123") EndIf If $placehold = "Indirizzo email" Then _IEAction($oBtn, "click") _IEFormElementSetValue($oBtn, "stfn77@gmail.com") EndIf If $placehold = "login" Then _IEAction($oBtn, "click") EndIf Next ; #ce ; clic botton login Local $oBtns = $oIE.document.GetElementsByTagName("input") For $oBtn In $oBtns $classname = String($oBtn.value()) ;ConsoleWrite($classname & @CRLF) If $classname = "Login" Then _IEAction($oBtn, "click") EndIf Next _IENavigate($oIE, "https://it.shpock.com/my/sell/") ; vendi Local $oLprice = _IEGetObjByName($oIE, "price") _IEAction($oLprice, "focus") _IEAction($oLprice, "Click") _IEFormElementSetValue($oLprice, "12") ; prezzo prodotto Local $oLprice = _IEGetObjByName($oIE, "location") _IEAction($oLprice, "focus") _IEAction($oLprice, "Click") _IEFormElementSetValue($oLprice, "via curtatone e montanare 19") ; indirizzo e civico Local $oBtns = $oIE.document.GetElementsByTagName("") For $oBtn In $oBtns $classname = String($oBtn.class()) ;ConsoleWrite($classname & @CRLF) If $classname = "opener category" Then _IEAction($oBtn, "click") EndIf Next ;seleziona categoria Local $oBtns = _IELinkGetCollection($oIE) For $oBtn In $oBtns $classname = String($oBtn.classname()) ;ConsoleWrite($classname & @CRLF) If $classname = "opener category" Then ;ConsoleWrite("Found it" & @CRLF) _IEAction($oBtn, "click") EndIf Next Sleep(2000) Local $oBtns = $oIE.document.GetElementsByTagName("span") Local $iLPushLimit = 0 For $oBtn In $oBtns $classname = String($oBtn.classname()) ;ConsoleWrite($classname & @CRLF) If $classname = "cat fa" Then If $iLPushLimit = 2 Then _IEAction($oBtn, "click") EndIf $iLPushLimit += 1 EndIf Next ; descrizione Local $oBtns = $oIE.document.GetElementsByTagName("textarea") For $oBtn In $oBtns $classname = String($oBtn.name()) ;ConsoleWrite($classname & @CRLF) If $classname = "description" Then _IEAction($oBtn, "click") _IEFormElementSetValue($oBtn, "descrizione massimo 500 caratteri") ; descrizione massimo 500 caratteri EndIf Next ; titolo inserzione Local $oLprice = _IEGetObjByName($oIE, "title") _IEAction($oLprice, "focus") _IEAction($oLprice, "Click") _IEFormElementSetValue($oLprice, "Bikini mare donna") ; titolo inserzione ;foto load Local $oLprice = _IEGetObjByName($oIE, "media") _IEAction($oLprice, "focus") _IEAction($oLprice, "Click") Sleep (1000) ControlClick("[CLASS:#32770]", "Choose File to Upload", "[CLASS:ToolbarWindow32; INSTANCE:2]") If WinActive("[CLASS:Choose File to Upload]") Then MsgBox(0,'','è aperto l upload immagini ') EndIf #cs Local $oBtns = $oIE.document.GetElementsByTagName("input") For $oBtn In $oBtns $classname = String($oBtn.placeholder()) ConsoleWrite($classname & @CRLF) If $classname = "Indirizzo email" Then ;MsgBox(0, 'menubar', $classname) ConsoleWrite("Found it" & @CRLF) MsgBox(0, 'de', $oBtn) _IEAction ($oBtn, "click") _IEFormElementSetValue($oBtn, "passeraword") ;$cliccata += 1 ;MsgBox (0,'','estrae quello che deve estrarre') ;_IENavigate ($oIE,$get_url) EndIf Next #ce #cs $oCorrectObj = "" $tags = $oIE.document.GetElementsByTagName("div") For $tag in $tags $class_value = $tag.GetAttribute("class") If string($class_value) = "password" Then $oCorrectObj = $tag MsgBox(0, "Level: ", "Level found :)") ExitLoop EndIf Next If IsObj ( $oCorrectObj ) Then _IEAction ($oCorrectObj, "click") EndIF #ce EndFunc ;==>_StartShpock Func _IEGetObjByClass(ByRef $o_object, $s_Class, $i_index = 0) If Not IsObj($o_object) Then __IEConsoleWriteError("Error", "_IEGetObjByClass", "$_IEStatus_InvalidDataType") SetError($_IEStatus_InvalidDataType, 1) Return 0 EndIf ; If Not __IEIsObjType($o_object, "browserdom") Then __IEConsoleWriteError("Error", "_IEGetObjByClass", "$_IEStatus_InvalidObjectType") SetError($_IEStatus_InvalidObjectType, 1) Return 0 EndIf ; Local $i_found = 0 ; $o_tags = _IETagNameAllGetCollection($o_object) For $o_tag In $o_tags If String($o_tag.className) = $s_Class Then If ($i_found = $i_index) Then SetError($_IEStatus_Success) Return $o_tag Else $i_found += 1 EndIf EndIf Next ; __IEConsoleWriteError("Warning", "_IEGetObjByClass", "$_IEStatus_NoMatch", $s_Class) SetError($_IEStatus_NoMatch, 2) Return 0 EndFunc ;==>_IEGetObjByClass
mLipok Posted March 4, 2017 Posted March 4, 2017 you can find Answer in my signature. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
faustf Posted March 6, 2017 Author Posted March 6, 2017 @mlipok but where i find a solution ??' sginature?? what is this??? i dont understund a sense
mLipok Posted March 6, 2017 Posted March 6, 2017 I think your case is exactly the same as here: Why isn't Autoit able to click a Javascript Dialog? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
faustf Posted March 7, 2017 Author Posted March 7, 2017 i trye to use , this but not work , i use windows 10 , soon test the script in windows 7 and tell you this is a script total expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: faustf Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <File.au3> #include <IE.au3> #include <Array.au3> Global $ISP_WEB = 0 _StartShpock() Func _StartShpock() If ProcessExists("iexplore.exe") Then ; Check if the internet esplorer process is running. ProcessClose("iexplore.exe") EndIf #cs Local $oIE = _IECreate ("https://it.shpock.com/my/signup/") Local $oForm = _IEFormGetCollection($oIE, 0) Local $username = _IEFormElementGetCollection ($oForm, 1) Local $password = _IEFormElementGetCollection ($oForm, 2) _IEFormElementSetValue ($username, "USER") _IEFormElementSetValue ($password, "PASSW") _IEFormSubmit($oForm) #ce ;#cs Global $oIE = _IECreate("https://it.shpock.com/my/signup/", 0, 1, 1, 1) ; <--- 0011 invisible explorer <--- 0111 visible explorer _IELoadWait($oIE) Local $oBtns = $oIE.document.GetElementsByTagName("input") For $oBtn In $oBtns $classname = String($oBtn.classname()) $placehold = String($oBtn.placeholder()) ;ConsoleWrite($classname & @CRLF) If $classname = "password" Then _IEAction($oBtn, "click") _IEFormElementSetValue($oBtn, "PASSW") EndIf If $placehold = "Indirizzo email" Then _IEAction($oBtn, "click") _IEFormElementSetValue($oBtn, "USER") EndIf If $placehold = "login" Then _IEAction($oBtn, "click") EndIf Next ; #ce ; clic botton login Local $oBtns = $oIE.document.GetElementsByTagName("input") For $oBtn In $oBtns $classname = String($oBtn.value()) ;ConsoleWrite($classname & @CRLF) If $classname = "Login" Then _IEAction($oBtn, "click") EndIf Next _IENavigate($oIE, "https://it.shpock.com/my/sell/") ; vendi Local $oLprice = _IEGetObjByName($oIE, "price") _IEAction($oLprice, "focus") _IEAction($oLprice, "Click") _IEFormElementSetValue($oLprice, "12") ; prezzo prodotto Local $oLprice = _IEGetObjByName($oIE, "location") _IEAction($oLprice, "focus") _IEAction($oLprice, "Click") _IEFormElementSetValue($oLprice, "via curtatone e montanare 19") ; indirizzo e civico Local $oBtns = $oIE.document.GetElementsByTagName("") For $oBtn In $oBtns $classname = String($oBtn.class()) ;ConsoleWrite($classname & @CRLF) If $classname = "opener category" Then _IEAction($oBtn, "click") EndIf Next ;seleziona categoria Local $oBtns = _IELinkGetCollection($oIE) For $oBtn In $oBtns $classname = String($oBtn.classname()) ;ConsoleWrite($classname & @CRLF) If $classname = "opener category" Then ;ConsoleWrite("Found it" & @CRLF) _IEAction($oBtn, "click") EndIf Next Sleep(2000) Local $oBtns = $oIE.document.GetElementsByTagName("span") Local $iLPushLimit = 0 For $oBtn In $oBtns $classname = String($oBtn.classname()) ;ConsoleWrite($classname & @CRLF) If $classname = "cat fa" Then If $iLPushLimit = 2 Then _IEAction($oBtn, "click") EndIf $iLPushLimit += 1 EndIf Next ; descrizione Local $oBtns = $oIE.document.GetElementsByTagName("textarea") For $oBtn In $oBtns $classname = String($oBtn.name()) ;ConsoleWrite($classname & @CRLF) If $classname = "description" Then _IEAction($oBtn, "click") _IEFormElementSetValue($oBtn, "descrizione massimo 500 caratteri") ; descrizione massimo 500 caratteri EndIf Next ; titolo inserzione Local $oLprice = _IEGetObjByName($oIE, "title") _IEAction($oLprice, "focus") _IEAction($oLprice, "Click") _IEFormElementSetValue($oLprice, "Bikini mare donna") ; titolo inserzione ;foto load Local $oLprice = _IEGetObjByName($oIE, "media") _IEAction($oLprice, "focus") _IEAction($oLprice, "Click") #cs Sleep (1000) ControlClick("[CLASS:#32770]", "Choose File to Upload", "[CLASS:ToolbarWindow32; INSTANCE:2]") If WinActive("[CLASS:Choose File to Upload]") Then MsgBox(0,'','è aperto l upload immagini ') EndIf #ce $oForm=_IEFormGetObjByName($oIE, "uploadfile") $oInputFile=_IEFormElementGetObjByName($oForm, "photo_upload") _IEAction($oInputFile, "click") Sleep(2000) _ExecuteInBackground() #cs Local $oBtns = $oIE.document.GetElementsByTagName("input") For $oBtn In $oBtns $classname = String($oBtn.placeholder()) ConsoleWrite($classname & @CRLF) If $classname = "Indirizzo email" Then ;MsgBox(0, 'menubar', $classname) ConsoleWrite("Found it" & @CRLF) MsgBox(0, 'de', $oBtn) _IEAction ($oBtn, "click") _IEFormElementSetValue($oBtn, "passeraword") ;$cliccata += 1 ;MsgBox (0,'','estrae quello che deve estrarre') ;_IENavigate ($oIE,$get_url) EndIf Next #ce #cs $oCorrectObj = "" $tags = $oIE.document.GetElementsByTagName("div") For $tag in $tags $class_value = $tag.GetAttribute("class") If string($class_value) = "password" Then $oCorrectObj = $tag MsgBox(0, "Level: ", "Level found :)") ExitLoop EndIf Next If IsObj ( $oCorrectObj ) Then _IEAction ($oCorrectObj, "click") EndIF #ce EndFunc ;==>_StartShpock Func _IEGetObjByClass(ByRef $o_object, $s_Class, $i_index = 0) If Not IsObj($o_object) Then __IEConsoleWriteError("Error", "_IEGetObjByClass", "$_IEStatus_InvalidDataType") SetError($_IEStatus_InvalidDataType, 1) Return 0 EndIf ; If Not __IEIsObjType($o_object, "browserdom") Then __IEConsoleWriteError("Error", "_IEGetObjByClass", "$_IEStatus_InvalidObjectType") SetError($_IEStatus_InvalidObjectType, 1) Return 0 EndIf ; Local $i_found = 0 ; $o_tags = _IETagNameAllGetCollection($o_object) For $o_tag In $o_tags If String($o_tag.className) = $s_Class Then If ($i_found = $i_index) Then SetError($_IEStatus_Success) Return $o_tag Else $i_found += 1 EndIf EndIf Next ; __IEConsoleWriteError("Warning", "_IEGetObjByClass", "$_IEStatus_NoMatch", $s_Class) SetError($_IEStatus_NoMatch, 2) Return 0 EndFunc ;==>_IEGetObjByClass Func _ExecuteInBackground() Local $sCommand = _ 'Local ' & _ '$Dummy1 = WinWaitActive("[CLASS:#32770]", "Selezionare il file da caricare"), ' & _ '$Dummy2 = Sleep(1000), ' & _ '$Dummy3 = ControlClick("[CLASS:#32770]", "Selezionare il file da caricare", "[CLASS:Edit; INSTANCE:1]") ' & _ '' $sCommand = '"' & StringReplace($sCommand, '"', '""') & '"' ConsoleWrite($sCommand & @CRLF) Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand) EndFunc ;==>_ExecuteInBackground
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