Jump to content

cetipabo

Active Members
  • Posts

    66
  • Joined

  • Last visited

Recent Profile Visitors

318 profile views

cetipabo's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. Thanks @Jos now i saw my mistake !!! 🤧
  2. sorry i was affraid that the json was too big. So we can do this : #include <Json.au3> $response = '{"code":"JYJY496","family":"security_shoes","family_variant":"security_shoes_by_size","parent":null,"categories":["c_j_synergy"],"values":{"marque":[{"locale":null,"scope":null,"data":"jallatte"}],"statut":[{"locale":null,"scope":null,"data":"0"}],"couleur":[{"locale":null,"scope":null,"data":"noir"}],"fabrication":[{"locale":null,"scope":null,"data":"tunisie"}],"type_chaussure":[{"locale":null,"scope":null,"data":"chaussures_de_securite_hautes"}],"systeme_de_fermeture":[{"locale":null,"scope":null,"data":"quicklio"}],"besoin":[{"locale":null,"scope":null,"data":["restitution_d_energie"]}],"activity":[{"locale":null,"scope":null,"data":["gros_oeuvre_tp_travaux_exterieurs"]}],"norme_iso":[{"locale":null,"scope":null,"data":["en_iso_20345_2011"]}],"marquage_ce":[{"locale":null,"scope":null,"data":["ci","hi","s3","src"]}],"photo_produit":[{"locale":null,"scope":null,"data":"1\/4\/a\/1\/14a114908cf6fc5f9447f4aca0cfa581ce00dc1c_JYJY496_JALTANO_SAS_ESD_lr.jpg","_links":{"download":{"href":"https:\/\/xxxxxx-staging.cloud.akeneo.com\/api\/rest\/v1\/media-files\/1\/4\/a\/1\/14a114908cf6fc5f9447f4aca0cfa581ce00dc1c_JYJY496_JALTANO_SAS_ESD_lr.jpg\/download"}}}],"name":[{"locale":"fr_FR","scope":null,"data":"JALTANO SAS ESD S3 CI HI SRC"}],"name_tech":[{"locale":null,"scope":null,"data":"JALTANO SAS ESD S3 CI HI SRC"}],"weight":[{"locale":null,"scope":null,"data":{"amount":"1482.0000","unit":"GRAM"}}],"weight_brut":[{"locale":null,"scope":null,"data":{"amount":"1717.0000","unit":"GRAM"}}],"privatif":[{"locale":null,"scope":null,"data":false}],"specifique":[{"locale":null,"scope":null,"data":false}],"sra_plat":[{"locale":null,"scope":null,"data":"0.7300"}],"srb_plat":[{"locale":null,"scope":null,"data":"0.3000"}],"sra_talon":[{"locale":null,"scope":null,"data":"0.7000"}],"srb_talon":[{"locale":null,"scope":null,"data":"0.2800"}],"descriptif":[{"locale":"fr_FR","scope":"web","data":"Chaussure de s\u00e9curit\u00e9 montante de style outdoor, con\u00e7ue avec une technologie anti-fatigue. Coloris noir. Chaussures\n\u00e9lectrostatiques dissipatrices ESD de classe environnementale II test\u00e9es suivant la norme EN 61340-4-3 et EN 61340-5-1\nprot\u00e9geant les dispositifs \u00e9lectroniques contre les ph\u00e9nom\u00e8nes de d\u00e9charge \u00e9lectrostatique."}]},"created":"2023-10-16T09:11:48+00:00","updated":"2023-10-16T15:01:13+00:00","associations":{"Embout":{"products":["PU00041"],"product_models":[],"groups":[]},"antiperforation":{"products":[],"product_models":[],"groups":[]},"doublure":{"products":[],"product_models":[],"groups":[]},"prem_de_proprete":{"products":["TL00166"],"product_models":[],"groups":[]},"semelle":{"products":["SM00002"],"product_models":[],"groups":[]},"tige":{"products":["PL00028"],"product_models":[],"groups":[]}},"quantified_associations":{},"metadata":{"workflow_status":"working_copy"}}' $Data = Json_Decode($response) $api_code = json_ObjGet($Data, ".code") $api_productname = json_ObjGet($Data, ".values.name[0].data") msgbox(0,"",$api_code & @crlf & $api_productname)
  3. Hello guyz ! i'm pulling my hairs with this problem since this morning. i have a json that I can show you part of it below : i can get the value for code but i cant get the value for values.name[0].data this the part of my code, in $response i receive the json above from an API request : $Data = Json_Decode($response) $api_code = json_ObjGet($Data, ".code") $api_productname = json_ObjGet($Data, ".values.name[0].data") msgbox(0,"",$api_code & @crlf & $api_productname) And that's what i have in the msgbox whatever i try to get, as long there is an array in the path, it returns me nothing... i tried this syntax also, but same result : $api_productname = json_ObjGet($Data, "values.name[0].data") $api_productname = json_ObjGet($Data, "[values][name][0][data]") $api_productname = json_ObjGet($Data, '["values"]["name"][0]["data"]') i added a $json = Json_Dump($response) to be sure the path is correct, and that's what i can see in the console : What am i doing wrong ??
  4. thanks @Danyfirex i found out the meaning of both KEY_AES[:16] and KEY_AES[16:], if i'm not wrong it basicaly slice the string in 2, first from start to 16 and second from 16 to the end of the string.
  5. Full code sent in PM
  6. i found something here : So with this _hmac function i guess the begining would be : $rand = 'xxxxxxxxxxxxxxx' $password = 'yyyyyyyyyyyyyyyy' $auth_key = 'zzzzzzzzzzzzzzzzzzzz' $KEY_AES =_HashHMAC("SHA256", $rand, $auth_key) I still have this last line to convert : Final_Password = AES.new(KEY_AES[:16], AES.MODE_CBC, KEY_AES[16:]).decrypt(password)
  7. Hello, i have a piece of python code that i would like to convert in Autoit, it's about cryptography and I don't know anything about it. rand = 'xxxxxxxxxxxxxxx' password = 'yyyyyyyyyyyyyyyy' auth_key = 'zzzzzzzzzzzzzzzzzzzz' KEY_AES = hmac.new(rand, auth_key, sha256).digest() Final_Password = AES.new(KEY_AES[:16], AES.MODE_CBC, KEY_AES[16:]).decrypt(password) anyone know how this piece of code could be converted in autoit code ? Thank you for helping !
  8. @Zedna thank you for your piece of code which is much easier to understand in my mind 😄
  9. Thanks @mikell for your explanations ! Now my project is fully working. this is how it looks : The Fisrt, Second and third values in the bracket are the 3 axis position of an industrial robot that removes the excess leather from the bottom of a shoe during its manufacture before sticking the sole. Sometimes we need to quickly shift the X, Y or Z position of the bot, and it is way faster to do it with an automated script than having to do it from the bot interface. So i created in my GUI the 3 Offsets X Y Z that I might want to add in the file in order to shift the bot path. So here is my code: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Change bot path", 438, 177, 192, 124) $Input1 = GUICtrlCreateInput("", 16, 24, 313, 21) $Button1 = GUICtrlCreateButton("File", 336, 24, 75, 21) $Button2 = GUICtrlCreateButton("Modify", 16, 120, 75, 25) $Label1 = GUICtrlCreateLabel("Offset Z", 144, 58, 40, 15) $Label2 = GUICtrlCreateLabel("Offset X", 16, 58, 42, 15) $Label3 = GUICtrlCreateLabel("Offset Y", 80, 58, 42, 15) $Input2 = GUICtrlCreateInput("0", 16, 74, 41, 21) $Input3 = GUICtrlCreateInput("0", 80, 74, 41, 21) $Input4 = GUICtrlCreateInput("0", 144, 74, 41, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button1 Local $sFileOpenDialog = FileOpenDialog("Select bot path file", @scriptdir & "\", "File (*.mod)") GUICtrlSetData ($Input1, $sFileOpenDialog) case $Button2 $sFilePath = GUICtrlRead($Input1) $offsetX = GUICtrlRead($Input2) $offsetY = GUICtrlRead($Input3) $offsetZ = GUICtrlRead($Input4) Local $hFileOpen = FileOpen($sFilePath, $FO_READ) Local $txt = FileRead($hFileOpen) ; we replace the values with the new ones by adding/decreasing the value of the offsets ; https://www.autoitscript.com/forum/topic/206794-help-replacing-string-in-string/?tab=comments#comment-1490540 $newtxt = Execute("'" & StringRegExpReplace($txt, "(?m)^\h*Move[JL]\h\[\[\K(-?\d+\.\d+)", "' & $1+$offsetX & '") & "'") $newtxt = Execute("'" & StringRegExpReplace($newtxt, "(?m)^\h*Move[JL]\h\[\[(?:[\d.-]+,)\K(-?\d+\.\d+)", "' & $1+$offsetY & '") & "'") $newtxt = Execute("'" & StringRegExpReplace($newtxt, "(?m)^\h*Move[JL]\h\[\[(?:[\d.-]+,){2}\K(-?\d+\.\d+)", "' & $1+$offsetZ & '") & "'") ;we write the new file $newname = StringReplace($sFilePath,".mod","_new.mod") Local $hNewFileOpen = FileOpen($newname, $FO_OVERWRITE) FileWrite ($hNewFileOpen, $newtxt) FileClose($hFileOpen) FileClose($hNewFileOpen) msgbox(0,"","COMPLETED") EndSwitch WEnd And i joined an example for testing pathfile.zip
  10. Hello ! Sorry for the delay, and thank you for your help. I'll try your suggestions. EDIT: Thanks @Zednaand @mikell @mikell's example in one-line seduced me ! it works as expected, but it wouldn't work if one day i decide to substract a decimal number like 2.55 for example. Well, so i tried to adapt your regex in order to be able to do the same for the 1st and the 2nd values in the bracket...and no way, that's really a hard, too complicated Regex for me 😪 i thought that replacing {2} with {1} would capture the second value, but it doesn't, and for the first value we can't do it based on the comma position, so i'm stuck here too 😬 Could you tell me what would be the regex in these case ? and if possible working with decimal numbers ? Thanks again for your help
  11. Hello, i have a txt file filled with lines like this : https://pastebin.com/raw/PvwFc1Wg And i would like, for each line starting with the command MoveJ or MoveL, replace the third value in the first Brackets with its value - 3 So in this example i have to replace in the first line 227.68 with 224.68 ( which is 227.68 - 3) and so on up to the end of my file. How can i do that ? i know how to read and write the lines in the TXT file, what i miss is how to get the value and change it in the line. Thank you for your help
  12. Finaly i found, i just have to increase the value, i thought 1 was only to enable the ticks 😄 but you can set the amount of ticks you want, so i just changed the parameters like this, and now it works, i can see the grid. _GraphGDIPlus_Set_GridX($Graph,50,0xFF6993BE) _GraphGDIPlus_Set_GridY($Graph,5,0xFF6993BE)
  13. Well, i have another problem now, with the grids. in my example below, i'm supposed to have a light grey background with a blue grid, but because of the high amount in Rangex (4000) the backgroung is filled in blue, is it a bug in the UDF or i forgot something ? #include "GraphGDIPlus.au3" #include <WinAPISysWin.au3> Opt("GUIOnEventMode", 1) $GUI = GUICreate("",900,600) GUISetOnEvent(-3,"_Exit") GUISetState() ;----- Create Graph area ----- $Graph = _GraphGDIPlus_Create($GUI,40,30,830,520,0xFF000000,0xFFD6D6D6) _GraphGDIPlus_Set_RangeX($Graph,0,4000,17,1,0) _GraphGDIPlus_Set_RangeY($Graph,-100,0,20,1,0) _GraphGDIPlus_Set_GridX($Graph,1,0xFF6993BE) _GraphGDIPlus_Set_GridY($Graph,1,0xFF6993BE) ;----- Draw the graph ----- _Draw_Graph() While 1 Sleep(100) WEnd Func _Draw_Graph() _GraphGDIPlus_Refresh($Graph) EndFunc Func _Exit() ;----- close down GDI+ and clear graphic ----- _GraphGDIPlus_Delete($GUI,$Graph) Exit EndFunc
×
×
  • Create New...