luizricardo Posted August 18, 2021 Share Posted August 18, 2021 como faço para fazer o autoit integrar com arquivo json? Link to comment Share on other sites More sharing options...
argumentum Posted August 18, 2021 Share Posted August 18, 2021 This is an only English forum. Try using a translator if needed. Also a better description and what you've done so far in an example code. Obrigado / Thanks Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 18, 2021 Moderators Share Posted August 18, 2021 Hi, Moved to the correct section. 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 Link to comment Share on other sites More sharing options...
luizricardo Posted August 19, 2021 Author Share Posted August 19, 2021 (edited) I have this code to automate sales, but I need to make autoit read a j.son file that will contain the sales information made in autoit. but I don't know what code to use, any ideas? expandcollapse popupGlobal $hWnd Global $titulo = "[REGEXPTITLE:myCommerce.+]" Global $ListaProdutos[8] = [ "047100119391", "100119605", "047100119391", "100119605", "047100119391", "100119605", "047100119391", "100119605", ] Global $cheque = 88595 Func esperaCampoVazio() ConsoleWrite("esperaCampoVazio"& @CRLF) If WinExists("Item Não Cadastrado", "") > 0 Then ConsoleWrite("tela aberta"& @CRLF) Send("{ESC}") EndIf While (ControlGetText($hWnd, "", "ThunderTextBox3") <> "") Sleep(100) WEnd EndFunc Func liberaCredito() ConsoleWrite("Libera Credito"& @CRLF) Sleep(1000) Send("1") Sleep(1000) send("{ENTER}") Sleep(100) send("{ENTER}") Sleep(100) ConsoleWrite("Finaliza Libera Credito"& @CRLF) EndFunc Func finalizaVenda_Dinheiro() ConsoleWrite("Inicia Dinheiro" & @CRLF) Sleep(2000) Send("d") Sleep(2000) ConsoleWrite("Finaliza Dinheiro" & @CRLF) EndFunc Func finalizaVenda_Crediario() ConsoleWrite("Inicia crediario" & @CRLF) Sleep(2000) Send("k") Sleep(2000) Send("78") Sleep(100) send("{ENTER}") Sleep(100) liberaCredito() Sleep(100) send("{ENTER}") Sleep(100) send("{ENTER}") Sleep(100) send("{ENTER}") Sleep(100) send("{ENTER}") ConsoleWrite("Finaliza crediario " & @CRLF) EndFunc Func finalizaVenda_Cheque() ConsoleWrite("Inicia Cheque " & @CRLF) Sleep(1000) Send("r") Sleep(1000) Send("2") Sleep(1000) send("{ENTER}") Sleep(100) Send("1") ; comp Sleep(100) send("{ENTER}") Sleep(100) Send("1") ; banco Sleep(100) send("{ENTER}") Sleep(100) Send("1") ; agencia Sleep(100) send("{ENTER}") Sleep(100) Send("1") ; conta corrente Sleep(100) send("{ENTER}") Sleep(100) $cheque = $cheque + 1 Send($cheque) ; n cheque ConsoleWrite("N° cheque "& $cheque & @CRLF) Sleep(100) send("{ENTER}") ; data Sleep(100) Send("{ENTER}") ; origem Sleep(100) Send("{ENTER}") ; descricao Sleep(100) Send("{ENTER}") ; cliente Sleep(100) Send("13") Sleep(100) Send("{ENTER}") Sleep(100) liberaCredito() Sleep(100) Send("13") ; não consulta ConsoleWrite("Finaliza cheque "&@CRLF) EndFunc Func finalizaVenda_Cartao() ConsoleWrite("Inicia Cartao "&@CRLF) Sleep(2000) Send("s") Sleep(1500) Send("{ENTER}") ; BANDEIRA Sleep(100) Send("{ENTER}") ; CARTAO Sleep(100) Send("321") Sleep(100) Send("{ENTER}") ; N PARCELA Sleep(100) Send("{ENTER}") ; SALVAR Sleep(100) Send("{ENTER}") ; CONFIRMA SALVAR Sleep(100) ConsoleWrite("Finaliza Cartao "&@CRLF) EndFunc Func cdbarraAleatorio() ConsoleWrite("cdbarraAleatorio "& @CRLF) $cdbarra = "" If UBound($ListaProdutos) > 1 Then $Index = Random(0, UBound($ListaProdutos), 1) If $Index > UBound($ListaProdutos) - 1 Then $Index = UBound($ListaProdutos) - 1 $cdbarra = $ListaProdutos[$Index] Else $cdbarra = $ListaProdutos[0] EndIf ConsoleWrite($cdbarra & @CRLF) Return $cdbarra EndFunc Func decideFinalizadora() $finCode = Random(1, 4, 1) ConsoleWrite("Selecionado finalizadora code: "& $finCode & @CRLF) Return $finCode EndFunc ConsoleWrite("INI"& @CRLF) $hWnd=WinWait($titulo) ConsoleWrite("INI2"& @CRLF) $numVendas=120 For $i = 0 To $numVendas - 1 Step 1 ConsoleWrite("FOR"& @CRLF) WinWaitActive($titulo, "") esperaCampoVazio() Send(cdbarraAleatorio()) Sleep(100) send("{ENTER}") WinWaitActive($titulo, "") $a = 10 ;Random(20, 100, 1) For $j = 1 to $a -1 Step 1 esperaCampoVazio() Send(cdbarraAleatorio()) Sleep(500) Send("{ENTER}") Next esperaCampoVazio() Sleep(100) Send("{SPACE}") Sleep(2000) WinWaitActive("","") Switch decideFinalizadora() Case 1 finalizaVenda_Dinheiro() ConsoleWrite("Switch Dinheiro"& @CRLF) Case 2 finalizaVenda_Cartao() ConsoleWrite("Switch Cartao"& @CRLF) Case 3 finalizaVenda_Cheque() ConsoleWrite("Switch Cheque"& @CRLF) Case 4 finalizaVenda_Crediario() ConsoleWrite("Switch Crediario"& @CRLF) EndSwitch Sleep(1000) Send(2) Sleep(1000) Next Edited August 19, 2021 by Melba23 Added code tags and reduced font size Link to comment Share on other sites More sharing options...
Zedna Posted August 19, 2021 Share Posted August 19, 2021 In Examples section of this forum there are several UDFs (prepared functions) for working with JSON files: https://www.autoitscript.com/forum/search/?q=json&type=forums_topic&nodes=9&updated_after=any&sortby=relevancy&search_in=titles luizricardo 1 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