faustf Posted March 2, 2017 Posted March 2, 2017 (edited) hi guys , i have a strange problem i read to array a file txt , and after take 2 part of this array (one is number and one is word ), i must compare with a word and number the code is expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: myName Script Function: Template AutoIt script. ; da levare mesgbox 360 #ce ---------------------------------------------------------------------------- #include <MsgBoxConstants.au3> #include <File.au3> Local $aLListFile = _FileListToArray(@ScriptDir & "\INSERIMENTI\", "*", 1) If Not FileExists("X:\") Then ConsoleWrite("Not Exist") DriveMapAdd("X:", "\\192.168.1.110\foto", $DMA_DEFAULT, "utente", "galleggiare") Else ConsoleWrite("wtf") EndIf For $i = 1 To UBound($aLListFile) - 1 Local $sLTextInsert = FileRead(@ScriptDir & "\INSERIMENTI\" & $aLListFile[$i]) Global $aLTextInsert = StringSplit($sLTextInsert, "_____________") $aLTextInsert = _Remove_BlankIN_Array($aLTextInsert) $aLTextInsert[0] = UBound($aLTextInsert) Local $aLFoto = StringSplit($aLTextInsert[1], "X:") $aLFoto = _Remove_BlankIN_Array($aLFoto) $aLFoto[0] = UBound($aLFoto) Global $aGRfoto[UBound($aLFoto)] Local $a = 0 For $i = 2 To UBound($aLFoto) - 1 Local $aLspliFoto = StringSplit($aLFoto[$i], "\") ; _ArrayDisplay($aLspliFoto) $aGRfoto[$a] = $aLspliFoto[3] $a += 1 Next _Little($aLFoto, $aLTextInsert[2], $aLTextInsert[3], $aLTextInsert[4], $aLTextInsert[5], $aLTextInsert[6], $aLTextInsert[7], $aLTextInsert[8], $aLTextInsert[9], $aLTextInsert[10]) Next Func _Control_first_size() Local $hWnd = WinWait("[CLASS:Chrome_WidgetWin_1]", "", 10) Local $aClientSize = WinGetClientSize($hWnd) Return $aClientSize EndFunc ;==>_Control_first_size Func _Little($link_foto, $sLDescription, $sLhashtag, $sLCategorie1, $sLCategorie2, $sLCurier, $sLPriceProduct, $sLPriceShipNation, $sLPriceShipInternatio, $iQtt) Opt("SendKeyDelay", 1000) Local $x_Linee = 24, $x_Vendi = 35, $x_Ship = 311, $x_Catg = 94, $x_Foto1 = 44, $x_Fatto = 133, $x_Fatto2 = 136 Local $x_Attendi = 111 Local $chrome_url_start = "fault --app-id=lglpcnconmnceemicloimdhmfhfjekkk" Local $ProgramFilesDir = EnvGet('ProgramFiles(x86)') ; for 64bit Win it will return a valid path. If Not $ProgramFilesDir Then $ProgramFilesDir = @ProgramFilesDir ; for 32bit Win this will "repair" the broken return from above. Run($ProgramFilesDir & "\Google\Chrome\Application\chrome.exe " & $chrome_url_start) Local $hWnd = WinWait("[Class:Chrome_WidgetWin_1]", "", 10) WinMove($hWnd, "", 0, 0, 360, 672) Sleep(5000) Local $Hwind = WinGetHandle("[CLASS:#32770]") If @error Then MsgBox(0, '', 'de') Else Sleep(1000) Send("{Enter}") EndIf Sleep(10000) Local $aLRetSize = _Control_first_size() ; ;MsgBox(0, '', $aLRetSize[0]) If $aLRetSize[0] <> "360" Then $x_Linee += 143 $x_Vendi += 143 $x_Ship += 143 $x_Catg += 143 $x_Foto1 += 143 $x_Attendi += 143 $x_Fatto2 += 143 $x_Fatto += 338 EndIf MouseMove($x_Linee, 63) Sleep(3000) MouseClick("left") Sleep(2000) MouseMove($x_Vendi, 238) Sleep(2000) MouseClick("left") Sleep(2000) For $i = 1 To 5 Send("{DOWN}") Next Send($sLPriceProduct) ; prezzo prodotto Sleep(2000) MouseClick("left", $x_Ship, 302, 1, 30) Sleep(2000) Local $prezzship = Number($sLPriceShipNation) Send($prezzship) ; prezzo spedizione nazionale Sleep(2000) MouseMove($x_Ship, 422) Sleep(2000) MouseClick("left") Sleep(2000) Local $prezzInter = Number($sLPriceShipInternatio) Send($prezzInter) ; prezzo spedizione internazionale Sleep(2000) For $i = 1 To 5 Send("{UP}") Next MouseMove($x_Catg, 281) Sleep(2000) MouseClick("left") Sleep(2000) ;_Categoria_select($sLCategorie1, $sLCategorie2) ; categorie _Categoria_select_ok($sLCategorie1, $aLTextInsert[5]) ; categorie MsgBox(0,'','136') Sleep(2000) Send("{Down}") Sleep(2000) Local $qtt = Number($iQtt) Send($qtt) ; Qantità Sleep(2000) For $i = 1 To 4 Send("{UP}") Next MouseMove($x_Foto1, 186) Sleep(2000) MouseClick("left") Sleep(2000) ; inserimento foto Local $Hwind = WinGetHandle("[CLASS:#32770]") If @error Then MsgBox(0, 'errore', 'de: ' & @error) Else Sleep(1000) For $i = 1 To 5 Send("{TAB}") Next Sleep(2000) Send("{ENTER}") Sleep(2000) Send("{BACKSPACE}") Sleep(2000) Send("X:\" & $aLspliFoto[2]) Send("{ENTER}") For $i = 1 To 5 Send("{TAB}") Next Sleep(2000) Send($aGRfoto[0]) ; Send("{ENTER}") EndIf Sleep(2000) MouseMove($x_Attendi, 391) ; fatto Sleep(2000) MouseClick("left") ; fatto per caria foto Sleep(2000) MouseMove($x_Fatto, 60) ; fatto Sleep(2000) MouseClick("left") ; fatto per caria foto Sleep(2000) ; clic carico seconda foto ;$aGRfoto ; qui ci vuole il for ;MouseMove ($x_Fatto2,85) MouseMove($x_Fatto2, 188) Sleep(2000) MouseClick("left") ; apro menu Sleep(2000) Send($aGRfoto[1]) ; Send("{ENTER}") Sleep(2000) MouseMove($x_Fatto, 60) Sleep(2000) MouseClick("left") ; fatto per caria foto Sleep(2000) EndFunc ;==>_Little Func _Categoria_Select_ok($category,$subCategory) MsgBox(0,$category,$subCategory) Local $de = BinaryToString ( $aLTextInsert[5] ) ;$subCategory = "intimo" And $category = 1 If $de = "intimo" And $category = 1 Then MsgBox(0,'','de ma deeee') EndIf MsgBox(0,'','222') EndFunc Func _Categoria_select($category, $subCategory) ; Select ; Case $category = 1 ; Send("{DOWN}") ; Send("{Enter}") ; Sleep(1000) If $subCategory = "Dalla cinta in su" And $category = 1 Then Send("{DOWN}") Send("{Enter}") Sleep(1000) For $i = 1 To 1 Send("{DOWN}") Next Send("{Enter}") EndIf If $subCategory = "Dalla cinta in giu" And $category = 1 Then Send("{DOWN}") Send("{Enter}") Sleep(1000) For $i = 1 To 2 Send("{DOWN}") Next Send("{Enter}") EndIf If $subCategory = "Intimo" And $category = 1 Then MsgBox(0, '', 'qua') Send("{DOWN}") Send("{Enter}") Sleep(1000) For $i = 1 To 3 Send("{DOWN}") Next Send("{Enter}") EndIf If $subCategory = "Giacche e soprabiti" And $category = 1 Then Send("{DOWN}") Send("{Enter}") Sleep(1000) For $i = 1 To 4 Send("{DOWN}") Next Send("{Enter}") EndIf If $subCategory = "Scarpe" And $category = 1 Then Send("{DOWN}") Send("{Enter}") Sleep(1000) For $i = 1 To 5 Send("{DOWN}") Next Send("{Enter}") EndIf If $subCategory = "Accessori" And $category = 1 Then Send("{DOWN}") Send("{Enter}") Sleep(1000) For $i = 1 To 6 Send("{DOWN}") Next Send("{Enter}") EndIf ;EndSelect If $category = 2 Then For $y = 1 To 2 Send("{DOWN}") Next Send("{Enter}") Sleep(1000) If $subCategory = "Dalla cinta in su" Then For $i = 1 To 1 Send("{DOWN}") Next Send("{Enter}") EndIf If $subCategory = "Dalla cinta in giu" Then For $i = 1 To 2 Send("{DOWN}") Next Send("{Enter}") EndIf If $subCategory = "Abiti" Then For $i = 1 To 3 Send("{DOWN}") Next Send("{Enter}") EndIf If $subCategory = "Intimo" Then For $i = 1 To 4 Send("{DOWN}") Next Send("{Enter}") EndIf If $subCategory = "Giacche e soprabiti" Then For $i = 1 To 5 Send("{DOWN}") Next Send("{Enter}") EndIf If $subCategory = "Scarpe" Then For $i = 1 To 6 Send("{DOWN}") Next Send("{Enter}") EndIf If $subCategory = "Accessori" Then For $i = 1 To 7 Send("{DOWN}") Next Send("{Enter}") EndIf EndIf If $category = 0 Then Select Case $subCategory = "Gioielli" For $i = 1 To 3 Send("{DOWN}") Next Send("{Enter}") Case $subCategory = "Arte" For $i = 1 To 4 Send("{DOWN}") Next Send("{Enter}") Case $subCategory = "Tecnologia" For $i = 1 To 5 Send("{DOWN}") Next Send("{Enter}") Case $subCategory = "Libri Riviste" For $i = 1 To 6 Send("{DOWN}") Next Send("{Enter}") Case $subCategory = "Film" For $i = 1 To 7 Send("{DOWN}") Next Send("{Enter}") Case $subCategory = "Musica" For $i = 1 To 8 Send("{DOWN}") Next Send("{Enter}") Case $subCategory = "Casa" For $i = 1 To 9 Send("{DOWN}") Next Send("{Enter}") Case $subCategory = "Bambini" For $i = 1 To 10 Send("{DOWN}") Next Send("{Enter}") Case $subCategory = "Bellezza" For $i = 1 To 11 Send("{DOWN}") Next Send("{Enter}") Case $subCategory = "Articoli sportivi" For $i = 1 To 12 Send("{DOWN}") Next Send("{Enter}") Case $subCategory = "Mezzi di trasporto" For $i = 1 To 13 Send("{DOWN}") Next Send("{Enter}") Case $subCategory = "Altro" For $i = 1 To 14 Send("{DOWN}") Next Send("{Enter}") EndSelect EndIf EndFunc ;==>_Categoria_select ; #INDEX# ======================================================================== ; Title .........: GUI_Configure.au3 ; AutoIt Version : 3.3.14.2++ ; Language ......: Italian ; Description ...: A collection of Function for Logic of Gest ; Author ........: Faustf ; What do you do.: Remove Blank in array 1d ; Version .......: 0.0.1 BETA - Work in progress 15/03/2016 ; Syntax ........: ; ================================================================================ Func _Remove_BlankIN_Array($arr_2) For $i = UBound($arr_2) - 1 To 0 Step -1 If $arr_2[$i] = "" Then _ArrayDelete($arr_2, $i) EndIf Next Return $arr_2 EndFunc ;==>_Remove_BlankIN_Array but when arrive to compare Func _Categoria_Select_ok($category,$subCategory) MsgBox(0,$category,$subCategory) Local $de = BinaryToString ( $aLTextInsert[5] ) ;$subCategory = "intimo" And $category = 1 If $de = "intimo" And $category = 1 Then MsgBox(0,'','de ma deeee') EndIf MsgBox(0,'','222') EndFunc always not recognise the word , the messagebox poped a correct word and number but nothing i try to insert direct a array , but nothing anyone can help me ?' thankz so much or have some idea? P.S. i try to create a simple script and in simple script work correct o_O #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 320, 120, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $aDE= FileReadToArray("C:\Users\Norrin\Desktop\Depop_Remote\INSERIMENTI\insert_prod.txt") Global $aba=StringSplit($aDE[9],"_") ;_ArrayDisplay($aba) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 if $aba[1] = 1 And $aba[2]= "intimo" then MsgBox (0,$aba[1],$aba[2]) EndIf EndSwitch WEnd Edited March 2, 2017 by faustf
faustf Posted March 3, 2017 Author Posted March 3, 2017 _____________ X:\1\IMG1475828624406 - Copy - Copy.jpg X:\1\IMG1475828624406 - Copy.jpg X:\1\IMG1475828624406.jpg _____________ de ma de caprarica fai caaaa _____________ #gel#uv _____________ 1_intimo _____________ Corriere _____________ 12.00 _____________ 12.00 _____________ 50.00 _____________ 1 _____________
Jfish Posted March 3, 2017 Posted March 3, 2017 Just curious, what do you see in the msgbox if you run this?: Func _Categoria_Select_ok($category,$subCategory) ;MsgBox(0,$category,$subCategory) Local $de = BinaryToString ( $aLTextInsert[5] ) MsgBox(0,$de,$category) ;$subCategory = "intimo" And $category = 1 If $de = "intimo" And $category = 1 Then MsgBox(0,'','de ma deeee') EndIf MsgBox(0,'','222') EndFunc Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt
faustf Posted March 3, 2017 Author Posted March 3, 2017 the message box popup intimo (in top) and 1 (in middle )
Jfish Posted March 4, 2017 Posted March 4, 2017 (edited) Edit: I think the issue may be carriage returns and white spaces (based on copying and pasting your sample file). try this: Func _Categoria_Select_ok($category,$subCategory) for $a=0 to ubound($aLTextInsert)-1 $aLTextInsert[$a]=StringStripCR($aLTextInsert[$a]) $aLTextInsert[$a]=StringStripWS($aLTextInsert[$a],3) Next ;MsgBox(0,"values from array",$aLTextInsert[5]&@crlf&$aLTextInsert[4]) If $aLTextInsert[5] == "intimo" And $aLTextInsert[4]=1 Then MsgBox(0,'','de ma deeee') EndIf MsgBox(0,'','222') EndFunc _Categoria_Select_ok($aLTextInsert[5],$aLTextInsert[4]) Edited March 4, 2017 by Jfish Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with 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