Leaderboard
Popular Content
Showing content with the highest reputation on 05/27/2024 in all areas
-
my approach #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <ScreenCapture.au3> Global $aArgs = $CmdLine ;~ Global $aArgs = [5, "one", 2, "three", "", "five"] ;test Global $filepath, $sspath, $sspath2, $option If $aArgs[0] = 4 Then $aArgs[0] = "CallArgArray" Call("_main", $aArgs) Else Global $sMsg = "Number of parameters: " & $aArgs[0] & @CRLF For $i = 1 To $aArgs[0] $sMsg &= $i & ") " & $aArgs[$i] & @CRLF Next ToolTip($sMsg , Default, Default, "!! Wrong Number of parameters", 3) Sleep(4000) EndIf Exit Func _main($sArg1, $sArg2, $sArg3, $sArg4) $filepath = $sArg1 $sspath = $sArg2 $sspath2 = $sArg3 $option = $sArg4 ControlFocus("Select Folder to Upload", "", "Edit1") If $option = "screenshot" Then popupIsDisplayed() ElseIf $option = "cancel" Then clickCancelInPopUp() ElseIf $option = "select file" Then selectFile() clickUploadInPopUp() ElseIf $option = "alert screenshot" Then alertISDisplayed() ElseIf $option = "upload" Then clickUploadInAlert() ElseIf $option = "cancel alert" Then clickCancelInAlert() EndIf EndFunc ;==>_main Func popupIsDisplayed() ControlFocus("Select Folder to Upload", "", "Edit1") Sleep(2000) Example() EndFunc ;==>popupIsDisplayed Func clickCancelInPopUp() ControlClick("Select Folder to Upload", "", "Button2") EndFunc ;==>clickCancelInPopUp Func selectFile() ControlSetText("Select Folder to Upload", "", "Edit1", $filepath) Sleep(2000) Example() Sleep(2000) EndFunc ;==>selectFile Func clickUploadInPopUp() ControlClick("Select Folder to Upload", "", "Button1") Sleep(2000) EndFunc ;==>clickUploadInPopUp Func alertISDisplayed() Example2() EndFunc ;==>alertISDisplayed Func clickUploadInAlert() Example2() Send("{Tab}") Send("{Enter}") EndFunc ;==>clickUploadInAlert Func clickCancelInAlert() Example2() Send("{Enter}") EndFunc ;==>clickCancelInAlert Func Example() Local $hBmp ; Capture full screen $hBmp = _ScreenCapture_Capture("") ; Save bitmap to file _ScreenCapture_SaveImage($sspath, $hBmp) EndFunc ;==>Example Func Example2() Local $hBmp ; Capture full screen $hBmp = _ScreenCapture_Capture("") ; Save bitmap to file _ScreenCapture_SaveImage($sspath2, $hBmp) EndFunc ;==>Example21 point
-
just do it. For $n = 1 To $CmdLine[0] ConsoleWrite($n & @TAB & '>' & $CmdLine[$n] & '<' & @CRLF) Next Exit I passed 1 "" 3 4 and got 1 >1< 2 >< 3 >3< 4 >4< so yes you can. What I would do in your case is Global $option, $filepath, $sspath, $sspath2 If $CmdLine[0] > 3 Then $option = $CmdLine[4] If $CmdLine[0] > 0 Then $filepath = $CmdLine[1] If $CmdLine[0] > 1 Then $sspath =$CmdLine[2] If $CmdLine[0] > 2 Then $sspath2 = $CmdLine[3] so you don't get the error you got with your code. Then again, you'll have to learn to think and explore on your own. My 2 cents even if you don't like it1 point
-
Just pass a dummy parameter, like "NULL" or specific character like "*". Anything beside nothing.... ps. In java you need to escape quotation marks if you want to send them, this would be a valid parameter : "\"\"" and it would be interpreted as Null value in AutoIt (like suggested by @argumentum below)1 point
-
Trying a WebDriver clean start but I could not
SOLVE-SMART reacted to Nine for a topic
Look at Wiki FAQ (#1 and #3)1 point -
Guess you have some studying to do then! You didn't specify, but the guess is you get the error on one of these: $option = $CmdLine[4] $filepath = $CmdLine[1] $sspath =$CmdLine[2] $sspath2 = $CmdLine[3] Which is because you started the script without (enough) parameters and the coder has forgotten to test for that! So open the AutoIt3 helpfile and look at the Running Scripts topic.1 point
-
ChatGPT had this to say when I queried that. It also said no need to swear at a machine. Just kidding about the swear bit.1 point
-
WebDriver Project "au3WebDriver": Which browser (driver) do you automate/test?
MarcoMonte reacted to SOLVE-SMART for a topic
I hope the following listed people, you guys 😇 , will also take part on this poll regarding WebDriver 🤞 🤝 . I saw in other Threads regarding WebDriver that you are involved in browser automation. Or at least you asked for help regarding WebDriver - that's why you are listed here now. Simply see the poll above 👆 , thanks. Please take part 🙏 : @argumentum ✅ @bdr529 ✅ @Blaxxun @MarcoMonte ✅ @SEKOMD ✅️ @tac7 @Keras Best regards Sven1 point -
Simple Google Translate
Musashi reacted to AspirinJunkie for a topic
You can probably increase the maximum number of characters if you really use POST instead of a disguised GET. The return limit here seems to be 65,535 characters. As an example: #include "Json.au3" #include <String.au3> ; build long string $sText = _StringRepeat("Wie geht`s? ", 2^16 / 12) ConsoleWrite("string length: " & StringLen($sText) & @CRLF) ; translate the string $sTranslated = _GoogleAPITranslate($sText , "de", "en") ConsoleWrite("return length: " & StringLen($sTranslated) & @CRLF & @CRLF) ConsoleWrite($sTranslated & @CRLF) Func _GoogleAPITranslate($sMytext, $sFrom, $sTo) ; format and send request Local $sResponse With ObjCreate("winhttp.winhttprequest.5.1") .Open("POST", "https://translate.googleapis.com/translate_a/single", False) .SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") .Send(StringFormat("client=gtx&sl=%s&tl=%s&dt=t&q=%s", $sFrom, $sTo, _URIEncode($sText))) $sResponse = .ResponseText EndWith Local $vResponse = _JSON_Parse($sResponse) ; process return Local $aData, $sOutput = "" If VarGetType($vResponse) = 'Array' Then $aData = $vResponse[0] If VarGetType($aData) = 'Array' Then For $i = 0 To UBound($aData) -1 $sOutput &= ($aData[$i])[0] Next EndIf EndIf Return $sOutput EndFunc Func _URIEncode($sData) ; Prog@ndy Local $aData = StringSplit(BinaryToString(StringToBinary($sData, 4), 1), "") Local $nChar $sData = "" For $i = 1 To $aData[0] $nChar = Asc($aData[$i]) Switch $nChar Case 45, 46, 48 To 57, 65 To 90, 95, 97 To 122, 126 $sData &= $aData[$i] Case 32 $sData &= "+" Case Else $sData &= "%" & Hex($nChar, 2) EndSwitch Next Return $sData EndFunc ;==>_URIEncode1 point