Jump to content

All Activity

This stream auto-updates

  1. Today
  2. I think running the powershell from autoit would work and be much easier. Your'e sure right about this... But there are a few arguments which speak against taking the ready script. At first the challenge to develop something new. Thats the fun !! And i like challenges. Taking something thats already finished cuts of the whole fun of programming πŸ™‚ And at second i also dont really like powershell scripts.
  3. Can you show us YOUR solution without dummy, udf, menu/submenu, etc ? I am really curious to see how you got it working, and community sure would appreciate to learn from it too...
  4. Yesterday
  5. I guess the short answer is "nope", I tend to use the one from Melba32 for simplicity (and marked it as solution to close the topic), but you have to have a clickable empty menu in your gui.. The one Nine posted was a little more complicated and used a dummy and udf's, but it looks the way it should when used.. I can't really call any reply's the right 'solution' because the question was "possible without dummy's, udf's or submenu/second menu tricks?". But I wanna thank you all for coming up with workarounds, now at least I know I'm not doing anything wrong in my code TheAutomator
  6. Hi @agivx3, does the "bigger project" don't allow to use Powershell? Or could it be possible to stick with Powershell but call the script by AutoIt, get the PS console output and proceed in AutoIt? I mean, why do you want to convert the whole stuff when it's working in PS by default cmdlets? Best regards Sven
  7. I'm not an Excel expert (I don't really use it) but I notice a couple of things in your script. 1: Local $sValue = InputBox("Tag Auswal", "Bitte ein tag fur versand eingeben", "", " M2") If you are entering digits here, you must force them to be digits before using them in RangeRead _Excel_RangeRead($oBook, Int($sValue), 'A3:E164', 2, True) 2. If $aData[$Index][1] <> "172100-59" Or $aData[$Index][1] <> "232109-sz" Then isn't needed because of my following point. 3. See notes in code. If $aData[$Index][1] = "232109-sz" Then .... If $aData[$Index][1] = "172100-59" Then ;<---- This should be "ElseIf" otherwise the above If has to be true before this will be tested. ..... Else If $aData[$Index][1] <> "172100-59" Or $aData[$Index][1] <> "232109-sz" Then ;<---- Comment this out, will be already tested with above "Ifs". EndIf EndIf; <---- Comment this out. EndIf;<---- Comment this out 4. The file '\Test.xlsx' would not work for me until I changed it to '\Test.xls' (But I am using Word 2010, so you might need to change it back) 5. You might want to move Local $sExcel = _Excel_Open() Local $wbook = _Excel_BookOpen($sExcel, @ScriptDir & '\Test.xls') outside of the loop, otherwise you will keep opening the file, and for that matter, all variable declarations too. Try this: #include <Excel.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> ; MsgBox file delete Msgfiledel() Func Msgfiledel() $aBox = MsgBox(4, "Attention!", "Should undefined list be deleted?") If $aBox = 6 Then Udelete() ElseIf $aBox = 7 Then MsgBox(0, "No", "Clear List Skipped") EndIf EndFunc Func Udelete() ; Deletes the temporary file. Local $idDelete = FileDelete("Undefined.xlsx") ; Shows a message whether the file was deleted. If $idDelete Then MsgBox($MB_SYSTEMMODAL, "", "The file was deleted successfully.") Else MsgBox($MB_SYSTEMMODAL, "", "An error occurred while deleting the file.") EndIf EndFunc ; MsgBox wawi status MsgWawi() Func MsgWawi() $aBox = MsgBox(4, "Attention!", "Wawi on and for sale?") If $aBox = 6 Then MsgPrint() ElseIf $aBox = 7 Then MsgBox(0, "No", "Please prepare Wawi and start again") EndIf EndFunc ; MsgBox Printer status Func MsgPrint() $aBox = MsgBox(4, "Attention!", "Printer switched to virtual?") If $aBox = 6 Then Entry1() ElseIf $aBox = 7 Then MsgBox(0, "No", "Please switch to dosprint printer and start again") EndIf EndFunc ; Open Excel, Pick sheet, Close Excel Func Engabe1() Local $sValue = InputBox("Tag Select", "Please enter a day for shipping", "", " M2") MsgBox($MB_SYSTEMMODAL, "Info", "You Have Tag " & $sValue & " Selected") Local $oExcel = _Excel_Open(False) Local $oBook = _Excel_BookOpen($oExcel, @ScriptDir & '\Aktuell.xls', True, False) Global $aData = _Excel_RangeRead($oBook, Int($sValue), 'A3:E164', 2, True) _Excel_Close($oExcel) ; Switch focus to WAWI WinActivate("[title:MS-DOS Prompt -]", "") Send('{ENTER}') Local $sExcel = _Excel_Open() Local $wbook = _Excel_BookOpen($sExcel, @ScriptDir & '\Test.xls') Local $NextRow = $wbook.Activesheet.Usedrange.Rows.Count + 1 ; first loop input Local $bSplit For $Index = 0 To UBound($aData) - 1 If Not $aData[$Index][1] Then ContinueLoop If $aData[$Index][1] = "232109-sz" Then Send( '{i}' & '{2}' & '{3}' & '{ENTER}' & '{2}' & '{1}' & '{0}' & '{9}' & '{ENTER}' & '{s}' &'{z}' & '{ENTER}') ;Sleep ( 3500 ) Send('{UP}' & $aData[$Index][3] & '{ENTER}' & '{ENTER}' & '{END}' & '{ENTER}' & '{v}') ElseIf $aData[$Index][1] = "172100-59" Then Send( '{i}' & '{1}' & '{7}' & '{ENTER}' & '{2}' & '{1}' & '{0}' & '{0}' & '{ENTER}' & '{5}' & '{9}' & '{ENTER}') ;Sleep ( 3500 ) Send('{UP}' & $aData[$Index][3] & '{ENTER}' & '{ENTER}' & '{END}' & '{ENTER}' & '{v}') Else ;~ If $aData[$Index][1] <> "172100-59" Or $aData[$Index][1] <> "232109-sz" Then _Excel_RangeWrite($wbook, $wbook.Activesheet, $aData[$Index][1], "A" & $NextRow) $NextRow += 1 EndIf ;~EndIf ;~EndIf Next EndFunc
  8. Hi Water, yeah i know about the UDF´s and in the meantime i nearly have all of them... I am using AutoIt now for many years and created many scripts. But now i tried to convert a small powershell script and have no idea how to do this. This also may be due to the fact that my knowledge about WinHTTP.au3 is less than basic 😞 The powershell script works fine but i need it in AutoIT script because it will be part of a bigger project. Here is the example i am trying to convert. Maybe you have some ideas about this ? $request="2024-04 21H2 Server" $outdir = $request.Replace(" ","_") if (!(Test-Path $outdir)) { New-Item -ItemType Directory -Force -Path $outdir | Out-Null } $kbObj = Invoke-WebRequest -Uri "https://www.catalog.update.microsoft.com/Search.aspx?q=$request" $Available_KBIDs = $kbObj.InputFields|Where-Object { $_.type -eq 'Button' -and $_.Value -eq 'Download' } |Select-Object -ExpandProperty ID $kbObj.Links |Where-Object ID -match '_link' |where-object innertext -NotLike "*4.7*" |select innertext,id $kbGUIDs = $kbObj.Links | Where-Object ID -match '_link' | # where-object innertext -NotLike "*4.7*" | ForEach-Object { $_.id.replace('_link', '') } | Where-Object { $_ -in $Available_KBIDs } foreach ($kbGUID in $kbGUIDs) { $Post = @{ size = 0; updateID = $kbGUID; uidInfo = $kbGUID } | ConvertTo-Json -Compress $PostBody = @{ updateIDs = "[$Post]" } Invoke-WebRequest -Uri 'https://www.catalog.update.microsoft.com/DownloadDialog.aspx' -Method Post -Body $postBody| Select-Object -ExpandProperty Content | Select-String -AllMatches -Pattern "(http?)(:\/\/)([^\s,]+)(?=')" | Select-Object -Unique | ForEach-Object { ForEach ($line in $_.matches.value) { switch ($line) { {$_ -match '-x64' } { # 64-bit $line wget\wget.exe $line --no-clobber --directory-prefix=$outdir } } } } }
  9. Nice trick M23, to make it more like modern menu how about using this character (instead of null) : $mDummymenu = GUICtrlCreateMenu("≡")
  10. AutoIt provides a lot of UDFs. See this section of the UDF-list in the wiki.
  11. Hi Jos, I may have found a minor bug for Autocomplete, or at least the part that collects the list of all Variable names. Local $oTest1, $oText2 $oTest1 If you enter a period after $oTest1 (below the declaration), the autocomplete will come up with an option of "$oTest1," (including a comma). Otherwise the autocomplete doesn't show the one ending with a comma. Not sure if the variable including a comma at the end of it is intended or not?
  12. TheAutomator, The trick I have used in the past only works when you to have an initial "normal" menu entry - so how about this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 437, 192, 124) $mDummymenu = GUICtrlCreateMenu("") $menu1 = GUICtrlCreateMenuItem("click me", -1) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $menu1 MsgBox(64,'yes!','it works') ; does! EndSwitch WEnd M23
  13. Here one way : #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <GuiMenu.au3> Opt("MustDeclareVars", True) Global $hGUI = GUICreate("Form1", 625, 442, 370, 232) Global $idMenu = GUICtrlCreateMenu("Click me") Global $hMenu = _GUICtrlMenu_GetMenu($hGUI) Global $idChoice = GUICtrlCreateDummy() GUISetState() GUIRegisterMsg($WM_MENUSELECT, WM_MENUSELECT) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $idChoice ConsoleWrite("Menu clicked " & GUICtrlRead($idChoice) & @CRLF) EndSwitch WEnd Func WM_MENUSELECT($hWnd, $iMsg, $wParam, $lParam) Local $iIndex = _WinAPI_LoWord($wParam) Local $iFlag = _WinAPI_HiWord($wParam) If $iIndex = 0 And BitAND($iFlag, $MF_MOUSESELECT) And $lParam = $hMenu Then GUICtrlSendToDummy($idChoice, $iIndex) EndMenu() EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_MENUSELECT Func EndMenu() DllCall("user32.dll", "bool", "EndMenu") EndFunc
  14. simple example: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 437, 192, 124) $menu1 = GUICtrlCreateMenu("click me") GUISetState(@SW_SHOW) While 1     Switch GUIGetMsg()         Case $GUI_EVENT_CLOSE             Exit         Case $menu1             MsgBox(64,'yes!','it works') ; not     EndSwitch WEnd To make this work without submenus/empty menu tricks seems to be difficult Not possible without dummy's / extensive UDF's or submenus? TheAutomator
  15. Is there any similar command in AutoIt or has anyone scripted a function or UDF which does the same job as the powershell invoke-webrequest command ?
  16. Years ago, I made a program with Autoit3 to turn off the monitors of any PC I was connected to remotely, Autoit3 can turn off any one or more monitors on a PC natively with no third-party solution needed although, if I recall correctly, it will need to be run as administrator. I recommend this post to get started.
  17. You can swap them this way... ConsoleWrite("short Hex: 0x" & Hex(Number($hexStringForShort)) & @CRLF) ;~ should be 0x0001 ConsoleWrite("int Hex: 0x" & Hex(Number($hexStringForInt)) & @CRLF) ;~ should be 0x00000001 ConsoleWrite("float Hex: 0x" & Hex(Number($hexStringForFloat)) & @CRLF) ;~ should be 0x3f800000 ConsoleWrite("double Hex: 0x" & Hex(Number($hexStringForDouble)) & @CRLF) ;~ should be 0x3ff0000000000000
  18. Hello im trying to define input based on Column A and B from the excel list and if something dont have definition i want to open other excel file and write it down. long story short its not going so well..... any idea what would be a clean solution for it ? #include <Excel.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> ; MsgBox file delete Msgfiledel() Func Msgfiledel() $aBox = MsgBox(4, "Achtung!", "Soll Undefiniert liste Geloscht Werden ?") If $aBox = 6 Then Udelete() ElseIf $aBox = 7 Then MsgBox(0, "Nein", "Liste loschen Ubersprungen") EndIf EndFunc Func Udelete() ; Löscht die temporäre Datei. Local $idDelete = FileDelete("Undefiniert.xlsx") ; Zeigt eine Nachricht, ob die Datei gelöscht wurde. If $idDelete Then MsgBox($MB_SYSTEMMODAL, "", "Die Datei wurde erfolgreich gelöscht.") Else MsgBox($MB_SYSTEMMODAL, "", "Es ist während dem löschen der Datei ein Fehler aufgetreten.") EndIf EndFunc ; MsgBox wawi status MsgWawi() Func MsgWawi() $aBox = MsgBox(4, "Achtung!", "Wawi an und auf verkauf engestellt ?") If $aBox = 6 Then MsgPrint() ElseIf $aBox = 7 Then MsgBox(0, "Nein", "Bitte Wawi vorbereiten und noch mal starten") EndIf EndFunc ; MsgBox Printer status Func MsgPrint() $aBox = MsgBox(4, "Achtung!", "Drucker auf virtuel Umgestellt ?") If $aBox = 6 Then Engabe1() ElseIf $aBox = 7 Then MsgBox(0, "Nein", "Bitte in dosprint drucker umstellen und noch mal starten") EndIf EndFunc ; Open Excel, Pick sheet, Close Excel Func Engabe1() Local $sValue = InputBox("Tag Auswal", "Bitte ein tag fur versand eingeben", "", " M2") MsgBox($MB_SYSTEMMODAL, "Info", "Du Hast Tag " & $sValue & " Ausgwwählt") Local $oExcel = _Excel_Open(False) Local $oBook = _Excel_BookOpen($oExcel, @ScriptDir & '\Aktuell.xls', True, False) Global $aData = _Excel_RangeRead($oBook, $sValue, 'A3:E164', 2, True) _Excel_Close($oExcel) ; Switch focus to WAWI WinActivate("[title:MS-DOS Prompt -]", "") Send('{ENTER}') ; first looop Input Local $bSplit For $Index = 0 To UBound($aData) - 1 If Not $aData[$Index][1] Then ContinueLoop If $aData[$Index][1] = "232109-sz" Then Send( '{i}' & '{2}' & '{3}' & '{ENTER}' & '{2}' & '{1}' & '{0}' & '{9}' & '{ENTER}' & '{s}' &'{z}' & '{ENTER}') ;Sleep ( 3500 ) Send('{UP}' & $aData[$Index][3] & '{ENTER}' & '{ENTER}' & '{END}' & '{ENTER}' & '{v}') If $aData[$Index][1] = "172100-59" Then Send( '{i}' & '{1}' & '{7}' & '{ENTER}' & '{2}' & '{1}' & '{0}' & '{0}' & '{ENTER}' & '{5}' &'{9}' & '{ENTER}') ;Sleep ( 3500 ) Send('{UP}' & $aData[$Index][3] & '{ENTER}' & '{ENTER}' & '{END}' & '{ENTER}' & '{v}') Else If $aData[$Index][1] <> "172100-59" Or $aData[$Index][1] <> "232109-sz" Then Local $sExcel = _Excel_Open() Local $wbook = _Excel_BookOpen($sExcel, @ScriptDir & '\Test.xlsx') Local $NextRow = $wbook.Activesheet.Usedrange.Rows.Count + 1 _Excel_RangeWrite($wbook, $wbook.Activesheet, $aData[$Index][1], "A" & $NextRow) EndIf EndIf EndIf Next EndFunc Aktuell.xls
  19. Thank you Nine, _WinAPI_DisplayStruct() clearly tells me that those SHORT and FLOAT are saved correctly in memory. And thank you RTFC, these docs really helped me, I changed my code as below, and it works. Local $short = DllStructCreate("SHORT a") Local $int = DllStructCreate("INT a") Local $float = DllStructCreate("FLOAT a") Local $double = DllStructCreate("DOUBLE a") ; share memory Local $byte_2_for_short = DllStructCreate("BYTE[2]", DllStructGetPtr($short)) Local $byte_4_for_int = DllStructCreate("BYTE[4]", DllStructGetPtr($int)) Local $byte_4_for_float = DllStructCreate("BYTE[4]", DllStructGetPtr($float)) Local $byte_8_for_double = DllStructCreate("BYTE[8]", DllStructGetPtr($double)) ConsoleWrite("short size: " & DllStructGetSize($short) & " bytes" & @CRLF) ;~ should be 2 ConsoleWrite("int size: " & DllStructGetSize($int) & " bytes" & @CRLF) ;~ should be 4 ConsoleWrite("float size: " & DllStructGetSize($float) & " bytes" & @CRLF) ;~ should be 4 ConsoleWrite("double size: " & DllStructGetSize($double) & " bytes" & @CRLF) ;~ should be 8 $short.a = 1 $int.a = 1 $float.a = 1 $double.a = 1 ; returns binary type values now. They are in little-endian style on my PC, but it won't be big problem for me. Local $hexStringForShort = DllStructGetData($byte_2_for_short, 1) Local $hexStringForInt = DllStructGetData($byte_4_for_int, 1) Local $hexStringForFloat = DllStructGetData($byte_4_for_float, 1) Local $hexStringForDouble = DllStructGetData($byte_8_for_double, 1) ConsoleWrite("short Hex: 0x" & Hex($hexStringForShort) & @CRLF) ;~ should be 0x0001 ConsoleWrite("int Hex: 0x" & Hex($hexStringForInt) & @CRLF) ;~ should be 0x00000001 ConsoleWrite("float Hex: 0x" & Hex($hexStringForFloat) & @CRLF) ;~ should be 0x3f800000 ConsoleWrite("double Hex: 0x" & Hex($hexStringForDouble) & @CRLF) ;~ should be 0x3ff0000000000000 Thank you both again!
  20. Last week
  21. On a side note, when using structures (especially at the beginning or your learning), you should always check their integrity by showing the content of the structures with _WinAPI_DisplayStruct function. When creating more complex structures, alignement can, without notice, include some paddings that you may want or not. Just so you are aware of this...
  22. Hi @dartrax πŸ‘‹ , welcome to the forum. Please open a new Thread and explain what you want to achieve (on a example/code in best case). This would be much better then reopening a Thread 16 years after the last post πŸ˜‚ . Best regards Sven
  23. Hi! Where can I find #include <BinaryFile.au3> The link in the first post is dead, is there a new version? Because I need to download a file with basic authentication. Thanks!
  24. Hi folks πŸ‘‹ , I am really curious about which browsers/drivers are automated or tested by you guys on a regular base. Analyzing the answers can be helpful for the future of the project au3WebDriver. #browsersupport So please consider taking part. Thank you 🀝 . Best regards Sven
  25. Hi folks It´s update time again! ISN AutoIt Studio version 1.16 is now online! Have fun with it, and as always: Feedback is welcome! 😎 Here the detailed changelog (translated by google):
  26. There are two separate issues here, 1. struct element retrieval and 2. Hex representation. ad 1. struct dot notation won't tell you this, but if you check the help page for DllStructGetData, you'll see: ad 2. Reading up on the Hex function in the Help, you'll find:
  27. I want to get hex string of a value, that's why I tried DllStructCreate() The defined short should have been 2 bytes, but a 4-byte int type was returned. The defined float should have been 4 bytes, but an 8-byte double type was returned. Local $short = DllStructCreate("SHORT a") Local $int = DllStructCreate("INT a") Local $float = DllStructCreate("FLOAT a") Local $double = DllStructCreate("DOUBLE a") ConsoleWrite("short size: " & BinaryLen($short.a) & " bytes" & @CRLF) ;~ should be 2, got 4 ConsoleWrite("int size: " & BinaryLen($int.a) & " bytes" & @CRLF) ;~ should be 4 ConsoleWrite("float size: " & BinaryLen($float.a) & " bytes" & @CRLF) ;~ should be 4, got 8 ConsoleWrite("double size: " & BinaryLen($double.a) & " bytes" & @CRLF) ;~ should be 8 $short.a = 1 $int.a = 1 $float.a = 1 $double.a = 1 ConsoleWrite("short value: " & $short.a & @CRLF) ConsoleWrite("int value: " & $int.a & @CRLF) ConsoleWrite("float value: " & $float.a & @CRLF) ConsoleWrite("double value: " & $double.a & @CRLF) ConsoleWrite("short Hex: 0x" & Hex($short.a) & @CRLF) ;~ should be 0x0001 ConsoleWrite("int Hex: 0x" & Hex($int.a) & @CRLF) ;~ should be 0x00000001 ConsoleWrite("float Hex: 0x" & Hex($float.a) & @CRLF) ;~ should be 0x3f800000 ConsoleWrite("double Hex: 0x" & Hex($double.a) & @CRLF) ;~ should be 0x3ff0000000000000 I'm using Autoit v3.3.16.1. What's going on? What did I do wrong?
  1. Load more activity
×
×
  • Create New...