Jump to content

Issues in running autoit exe using selenium grid or jenkins windows server


Recommended Posts

I have a autoit exe file which is used in upload/browse file functionality.  This has been integrated with selenium framework and I am invoking the autoit exe using Java process and runtime. 

Now the issue is when I run the scripts and invoke the autoit exe in local it works perfectly.  But when I use selenium grid or jenkins to run the scripts in another windows server it is not working.

Can anyone please suggest any solution for this?

Link to post
Share on other sites
  • 3 weeks later...

have a requirement of running an exe file(autoit exe) for uploading a file. This is working fine in local machine but not when run in jenkins(windows server) or in another remote using Selenium server(hub).

Process p = Runtime.getRuntime().exec("full path of Autoit.exe");

Could someone help on how to deal with this using Java?

Link to post
Share on other sites
Posted (edited)

Why create a new topic that is exactly the same as your previous topic?

 

Edited by TheXman
Removed link to duplicate topic since someone merged it with this topic.
Link to post
Share on other sites
53 minutes ago, TheXman said:

Why create a new topic that is exactly the same as your previous topic?

Oh, maybe because this time he intends to include the source for script that isn’t working, or even what the error is, as well as the steps taken so far to debug the situation in the last three weeks.

Though I could be wrong :)

Code hard, but don’t hard code...

Link to post
Share on other sites
16 minutes ago, DJ143 said:

do we have any solution for this? 

Not yet, but I think we got a big clue when you said “it is not working”.  In my experience, that usually means “something is not right”.  And, IMHO, often can be fixed if someone just “takes a good look at it”.  Have you tried that?
 

Code hard, but don’t hard code...

Link to post
Share on other sites
  • 4 months later...

Please refer to https://autumnator.wordpress.com/2011/12/22/autoit-sikuli-and-other-tools-with-selenium-grid/, as it should explain your exact issue, with suggestions on how to workaround it. A bit more work and tricky with Selenium Grid and more straightforward if you're just having issue executing from jenkins on a remote server, except for the latter, you'll have to put in logic to handle how to execute from jenkins case vs executing locally when developer testing.

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By robertocm
      Trying to get a working example from code by funkey:
      Added declarations from cited references, but the control looks empty, without returning errors:
      #cs ---------------------------------------------------------------------------- funkey, Feb 8, 2012 https://www.autoitscript.com/forum/topic/137333-ragriddll/?do=findComment&comment=961420 RaGrid download: ;KetilO, 2009 ;http://www.asmcommunity.net/forums/topic/?id=29679 Code examples: https://bcxbasiccoders.com/bcxusers/ian/Miscellaneous%20Code.html bcx_raGridWrappers.inc https://maul-esel.github.io/FormsFramework/files/RaGrid/RaGrid-ahk.html ;https://www.purebasic.fr/english/viewtopic.php?t=47141 #ce ---------------------------------------------------------------------------- #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Color.au3> ; #CONSTANTS# =================================================================================================================== ;gnozal, Aug 11, 2011 ;https://www.purebasic.fr/english/viewtopic.php?t=47141 ;http://www.pbosl.purearea.net/pbosl_examples.zip [in .\pbosl_examples\PBOSL4\EXAMPLES\PBOSL_CreateGadget\ ] ;Messages Global Const $GM_ADDCOL = $WM_USER + 1 ;wParam=0, lParam=lpCOLUMN Global Const $GM_ADDROW = $WM_USER + 2 ;wParam=0, lParam=lpROWDATA (can be NULL) Global Const $GM_INSROW = $WM_USER + 3 ;wParam=nRow, lParam=lpROWDATA (can be NULL) Global Const $GM_DELROW = $WM_USER + 4 ;wParam=nRow, lParam=0 Global Const $GM_MOVEROW = $WM_USER + 5 ;wParam=nFromRow, lParam=nToRow Global Const $GM_COMBOADDSTRING = $WM_USER + 6 ;wParam=nCol, lParam=lpszString Global Const $GM_COMBOCLEAR = $WM_USER + 7 ;wParam=nCol, lParam=0 Global Const $GM_GETCURSEL = $WM_USER + 8 ;wParam=0, lParam=0 Global Const $GM_SETCURSEL = $WM_USER + 9 ;wParam=nCol, lParam=nRow Global Const $GM_GETCURCOL = $WM_USER + 10 ;wParam=0, lParam=0 Global Const $GM_SETCURCOL = $WM_USER + 11 ;wParam=nCol, lParam=0 Global Const $GM_GETCURROW = $WM_USER + 12 ;wParam=0, lParam=0 Global Const $GM_SETCURROW = $WM_USER + 13 ;wParam=nRow, lParam=0 Global Const $GM_GETCOLCOUNT = $WM_USER + 14 ;wParam=0, lParam=0 Global Const $GM_GETROWCOUNT = $WM_USER + 15 ;wParam=0, lParam=0 Global Const $GM_GETCELLDATA = $WM_USER + 16 ;wParam=nRowCol, lParam=lpData Global Const $GM_SETCELLDATA = $WM_USER + 17 ;wParam=nRowCol, lParam=lpData (can be NULL) Global Const $GM_GETCELLRECT = $WM_USER + 18 ;wParam=nRowCol, lParam=lpRECT Global Const $GM_SCROLLCELL = $WM_USER + 19 ;wParam=0, lParam=0 Global Const $GM_GETBACKCOLOR = $WM_USER + 20 ;wParam=0, lParam=0 Global Const $GM_SETBACKCOLOR = $WM_USER + 21 ;wParam=nColor, lParam=0 Global Const $GM_GETGRIDCOLOR = $WM_USER + 22 ;wParam=0, lParam=0 Global Const $GM_SETGRIDCOLOR = $WM_USER + 23 ;wParam=nColor, lParam=0 Global Const $GM_GETTEXTCOLOR = $WM_USER + 24 ;wParam=0, lParam=0 Global Const $GM_SETTEXTCOLOR = $WM_USER + 25 ;wParam=nColor, lParam=0 Global Const $GM_ENTEREDIT = $WM_USER + 26 ;wParam=nCol, lParam=nRow Global Const $GM_ENDEDIT = $WM_USER + 27 ;wParam=nRowCol, lParam=fCancel Global Const $GM_GETCOLWIDTH = $WM_USER + 28 ;wParam=nCol, lParam=0 Global Const $GM_SETCOLWIDTH = $WM_USER + 29 ;wParam=nCol, lParam=nWidth Global Const $GM_GETHDRHEIGHT = $WM_USER + 30 ;wParam=0, lParam=0 Global Const $GM_SETHDRHEIGHT = $WM_USER + 31 ;wParam=0, lParam=nHeight Global Const $GM_GETROWHEIGHT = $WM_USER + 32 ;wParam=0, lParam=0 Global Const $GM_SETROWHEIGHT = $WM_USER + 33 ;wParam=0, lParam=nHeight Global Const $GM_RESETCONTENT = $WM_USER + 34 ;wParam=0, lParam=0 Global Const $GM_COLUMNSORT = $WM_USER + 35 ;wParam=nCol, lParam=0=Ascending, 1=Descending, 2=Invert Global Const $GM_GETHDRTEXT = $WM_USER + 36 ;wParam=nCol, lParam=lpBuffer Global Const $GM_SETHDRTEXT = $WM_USER + 37 ;wParam=nCol, lParam=lpszText Global Const $GM_GETCOLFORMAT = $WM_USER + 38 ;wParam=nCol, lParam=lpBuffer Global Const $GM_SETCOLFORMAT = $WM_USER + 39 ;wParam=nCol, lParam=lpszText Global Const $GM_CELLCONVERT = $WM_USER + 40 ;wParam=nRowCol, lParam=lpBuffer Global Const $GM_RESETCOLUMNS = $WM_USER + 41 ;wParam=0, lParam=0 Global Const $GM_GETROWCOLOR = $WM_USER + 42 ;wParam=nRow, lParam=lpROWCOLOR Global Const $GM_SETROWCOLOR = $WM_USER + 43 ;wParam=nRow, lParam=lpROWCOLOR Global Const $GM_GETCOLDATA = $WM_USER + 44 ;wParam=nCol, lParam=lpCOLUMN ;Column alignment Global Const $GA_ALIGN_LEFT = 0 Global Const $GA_ALIGN_CENTER = 1 Global Const $GA_ALIGN_RIGHT = 2 ;Column types Global Const $TYPE_EDITTEXT = 0 ;String Global Const $TYPE_EDITLONG = 1 ;Long Global Const $TYPE_CHECKBOX = 2 ;Long Global Const $TYPE_COMBOBOX = 3 ;Long Global Const $TYPE_HOTKEY = 4 ;Long Global Const $TYPE_BUTTON = 5 ;String Global Const $TYPE_IMAGE = 6 ;Long Global Const $TYPE_DATE = 7 ;Long Global Const $TYPE_TIME = 8 ;Long Global Const $TYPE_USER = 9 ;0=String, 1 to 512 bytes binary data Global Const $TYPE_EDITBUTTON = 10 ;String ;Column sorting Global Const $SORT_ASCENDING = 0 Global Const $SORT_DESCENDING = 1 Global Const $SORT_INVERT = 2 ;Window styles Global Const $STYLE_NOSEL = 0x1 Global Const $STYLE_NOFOCUS = 0x2 Global Const $STYLE_HGRIDLINES = 0x4 Global Const $STYLE_VGRIDLINES = 0x8 Global Const $STYLE_GRIDFRAME = 0x10 Global Const $STYLE_NOCOLSIZE = 0x20 Global Const $ODT_GRID = 6 ;~ Global Const $PB_EventType_Grid_HeaderClick = 1 ;User clicked header ;~ Global Const $PB_EventType_Grid_ButtonClick = 2 ;Sendt when user clicks the button in a button cell ;~ Global Const $PB_EventType_Grid_CheckClick = 3 ;Sendt when user double clicks the checkbox in a checkbox cell ;~ Global Const $PB_EventType_Grid_ImageClick = 4 ;Sendt when user double clicks the image in an image cell ;~ Global Const $PB_EventType_Grid_BeforeSelChange = 5 ;Sendt when user request a selection change ;~ Global Const $PB_EventType_Grid_AfterSelChange = 6 ;Sendt after a selection change ;~ Global Const $PB_EventType_Grid_BeforeEdit = 7 ;Sendt before the cell edit control shows ;~ Global Const $PB_EventType_Grid_AfterEdit = 8 ;Sendt when the cell edit control is about to close ;~ Global Const $PB_EventType_Grid_BeforeUpdate = 9 ;Sendt before a cell updates grid data ;~ Global Const $PB_EventType_Grid_AfterUpdate = 10 ;Sendt after grid data has been updated ;~ Global Const $PB_EventType_Grid_UserConvert = 11 ;Sendt when user cell needs to be converted. ;funkey, Feb 8, 2012 ;https://www.autoitscript.com/forum/topic/137333-ragriddll/?do=findComment&comment=961420 Global Const $__RAGRIDCONSTANT_DEFAULT_GUI_FONT = 17 Global Const $GN_HEADERCLICK = 1 ;User clicked header Global Const $GN_BUTTONCLICK = 2 ;Sendt when user clicks the button in a button cell Global Const $GN_CHECKCLICK = 3 ;Sendt when user double clicks the checkbox in a checkbox cell Global Const $GN_IMAGECLICK = 4 ;Sendt when user double clicks the image in an image cell Global Const $GN_BEFORESELCHANGE = 5 ;Sendt when user request a selection change Global Const $GN_AFTERSELCHANGE = 6 ;Sendt after a selection change Global Const $GN_BEFOREEDIT = 7 ;Sendt before the cell edit control shows Global Const $GN_AFTEREDIT = 8 ;Sendt when the cell edit control is about to close Global Const $GN_BEFOREUPDATE = 9 ;Sendt before a cell updates grid data Global Const $GN_AFTERUPDATE = 10 ;Sendt after grid data has been updated Global Const $GN_USERCONVERT = 11 ;Sendt when user cell needs to be converted. Global $Form Global $hGrid Global $hLib Global $hFont Global $lf = DllStructCreate($tagLOGFONT) Global Const $IDC_GRID = 101 Global $hWndSaveFocus = 0 ;take a little time to fill grid on startup with a large number Global Const $iRows = 500 Main() Func Main() FormLoad() If @error = 0 Then ;WinFlash($Form) GUIRegisterMsg($WM_NCACTIVATE, "MY_WM_COMMAND") GUIRegisterMsg($WM_NOTIFY, "MY_WM_COMMAND") GUIRegisterMsg($WM_DESTROY, "MY_WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop ;Case $IDC_GRID ;WinFlash($Form) EndSwitch WEnd GUIRegisterMsg($WM_NCACTIVATE, "") GUIRegisterMsg($WM_NOTIFY, "") GUIRegisterMsg($WM_DESTROY, "") EndIf $lf =0 EndFunc ;==>Main Func FormLoad() Local $wx = 700 Local $wh = 500 $Form = GUICreate("RAGrid Sample Program", $wx, $wh, 0, 0) $hLib = DllOpen(@ScriptDir & "\RAGrid.dll") If $hLib <> -1 Then Local $style = BitOR($WS_CHILD, $WS_VISIBLE, $STYLE_HGRIDLINES, $STYLE_VGRIDLINES, $STYLE_GRIDFRAME, $STYLE_NOSEL) $hGrid = _WinAPI_CreateWindowEx(0, "RAGRID", "", $style, 10, 10, $wx - 15, $wh - 35, $Form, $IDC_GRID) If $hGrid Then GridSetup($hGrid) ColorTheGrid($hGrid, $iRows) EndIf Else MsgBox(266288, "Error", "RaGrid.dll failed to load") GUIDelete($Form) Return SetError(1, 0, 0) EndIf GUISetState(@SW_SHOW) EndFunc ;==>FormLoad Func MY_WM_COMMAND($hWnd, $CBMSG, $wParam, $lParam) Switch $CBMSG Case $WM_NCACTIVATE If Not $wParam Then ; Save control focus $hWndSaveFocus = _WinAPI_GetFocus() ElseIf $hWndSaveFocus Then ; Restore control focus _WinAPI_SetFocus($hWndSaveFocus) $hWndSaveFocus = 0 EndIf Case $WM_NOTIFY ; Process grid notifications Local $pnmh = DllStructCreate("GRIDNOTIFY", $lParam) If DllStructGetData($pnmh, "hwndFrom") = $hGrid Then Switch DllStructGetData($pnmh, "Code") Case $GN_HEADERCLICK ; Sort the grid by column, invert sorting order _SendMessage($hGrid, $GM_COLUMNSORT, DllStructGetData($pnmh, "col"), $SORT_INVERT) ColorTheGrid($hGrid, $iRows) EndSwitch EndIf Case $WM_DESTROY _WinAPI_DeleteObject($hFont) EndSwitch EndFunc ;==>MY_WM_COMMAND Func GridSetup($hWnd) Local $lpzhdrtext, $lpsz, $r, $c, $z Local $col = DllStructCreate("double;double;double;double;double;double;double;double;double;double;double;double") ;Local $col = DllStructCreate("long;long;long;long;long;long;long;long;long;long;long;long") If @error Then MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), Default, "Error in DllStructCreate, Code: " & @error) EndIf For $i = 1 To 5 ; Create and format 5 columns $lpzhdrtext = DllStructCreate("wchar") DllStructSetData($lpzhdrtext, 1, Chr(64 + $i)) DllStructSetData($col, "colwt", 130) DllStructSetData($col, "lpszhdrtext", DllStructGetPtr($lpzhdrtext)) DllStructSetData($col, "halign", $GA_ALIGN_CENTER) DllStructSetData($col, "calign", $GA_ALIGN_CENTER) DllStructSetData($col, "ctype", $TYPE_EDITTEXT) DllStructSetData($col, "ctextmax", 31) DllStructSetData($col, "lpszformat", 0) DllStructSetData($col, "himl", 0) DllStructSetData($col, "hdrflag", 0) _SendMessage($hWnd, $GM_ADDCOL, 0, DllStructGetPtr($col)) Next DllStructSetData($lf, "Height", -12) ; Our grid will use 10 point Arial font DllStructSetData($lf, "FaceName", "Arial") $hFont = _WinAPI_CreateFontIndirect($lf) _SendMessage($hGrid, $WM_SETFONT, $hFont, 0) For $i = 1 To $iRows ; Create 32,765 blank rows _SendMessage($hGrid, $GM_ADDROW, 0, 0) Next For $r = 0 To $iRows - 1; Fill our grid with some data For $c = 0 To 4 $z = String(Random(0, $iRows)) $lpsz = DllStructCreate("char[" & StringLen($z) + 1 & "]") DllStructSetData($lpsz, 1, $z) _SendMessage($hGrid, $GM_SETCELLDATA, _WinAPI_MakeLong($c, $r), DllStructGetPtr($lpsz)) Next Next EndFunc ;==>GridSetup Func ColorTheGrid($hWnd, $Rows) Local $grc = DllStructCreate("double;double") ;Local $grc = DllStructCreate("long;long") DllStructSetData($grc, "backcolor", _MakeRGB(0, 240, 230)) DllStructSetData($grc, "textcolor", 0) For $i = 0 To $Rows - 1 Step 2 _SendMessage($hWnd, $GM_SETROWCOLOR, $i, DllStructGetPtr($grc)) Next DllStructSetData($grc, "backcolor", _MakeRGB(255, 255, 255)) DllStructSetData($grc, "textcolor", 0) For $i = 1 To $Rows Step 2 _SendMessage($hWnd, $GM_SETROWCOLOR, $i, DllStructGetPtr($grc)) Next $grc = 0 EndFunc ;==>ColorTheGrid Func _MakeRGB($b, $g, $r) Local $aRGB[3] $aRGB[0] = $r $aRGB[1] = $g $aRGB[2] = $b Return _ColorSetRGB($aRGB) EndFunc ;==>_MakeRGB
    • By Hermes
      Hello, the script below will read column A from an excel file - and if a value matches in the browser, it will click the corresponding link and click on a specific button to paste the data, then writes "Completed" in Column B. It will continue to read from the excel file and do the same thing for all the remaining rows.
      #Include "Chrome.au3" #Include "wd_core.au3" #Include "wd_helper.au3" #Include "WinHttp.au3" #include <MsgBoxConstants.au3> #include <File.au3> #include <IE.au3> #include <Array.au3> #include <INet.au3> #include <AutoItConstants.au3> #include <WinAPIFiles.au3> #include <GDIPlus.au3> #include <Excel.au3> #Include "WinHttp.au3" #Include "_HtmlTable2Array.au3" Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_LoadWait($sSession) _WD_Navigate($sSession, "table1.html") _WD_LoadWait($sSession) _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//table[@class='main']") Local $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//table[@class='main']") ;ConsoleWrite ("mat-table " & $sElement & @CRLF) Local $aArray1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, ".//td[contains(@class,'data')]", $sElement, True) sleep(1000) For $i = 0 to UBound($aArray1) - 1 $aArray1[$i] = _WD_ElementAction($sSession, $aArray1[$i], 'text') Next ;_ArrayDisplay($aArray1) ;Email variables $SmtpServer = "" ; address for the smtp-server to use - REQUIRED $FromName = "Hermes" ; name from who the email was sent $FromAddress = "sender@gmail.com" ; address from where the mail should come $ToAddress = "recipient@gmail.com" ; destination address of the email - REQUIRED, use commas (,) to add more email addresses $Subject = "File not found" ; subject from the email - can be anything you want it to be $Body = "File not found!" ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "" ; address for cc - leave blank if not needed $BccAddress = "" ; address for bcc - leave blank if not needed $Importance = "High" ; Send message priority: "High", "Normal", "Low" $Username = "" ; username for the account used from where the mail gets sent - REQUIRED $Password = "" ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 25 ; port used for sending the mail $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS $tls = 0 ; enables/disables TLS when required Local $oAppl = _Excel_Open() Local $sWorkbook = "c:\test.xlsx" Local $oWorkbook = _Excel_BookOpen($oAppl, $sWorkbook) ;open excel and pass both parameters If FileExists($sWorkbook) Then ;Check if the file exist. Local $oAppl = _Excel_Open() Local $sWorkbook = "c:\test.xlsx" Local $oWorkbook = _Excel_BookOpen($oAppl, $sWorkbook) ;open excel and pass both parameters Local $aArray2 = _Excel_RangeRead($oWorkbook,Default,$oWorkbook.ActiveSheet.Usedrange.Columns("A:A")) Local $iIdx Local $Skipline = 0 ;0==> first line Do Local $temprf For $i = 0 To UBound($aArray2) - 1 $temprf &= $aArray2[$i] _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, ".//a[contains(@class,'edit') and contains(text(),'Edit')]") Local $aElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, ".//a[contains(@class,'edit') and contains(text(),'Edit')]", $sElement, True) $iIdx = _ArraySearch($aArray1, $aArray2[$i]) If @error Then ContinueLoop _WD_ElementAction($sSession, $aElement[$iIdx], 'click') If $i < $Skipline Then ContinueLoop $oRange = $oWorkbook.ActiveSheet.Range("B" & $i + 1 & ":XFD" & $i + 1) _Excel_RangeCopyPaste($oWorkbook.Activesheet, $oRange) ;Paste Local $oTest4 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "pastebutton") _WD_ElementAction($sSession, $oTest4, 'click') Sleep(1000) ;Save Button Local $save3 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "button.button") _WD_ElementAction($sSession, $save3, 'click') _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Completed", "B" & $i+1) sleep(1000) Next Until (Not @error) _Excel_Close($oWorkbook) Else _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl, $tls) Exit EndIf _WD_LoadWait($sSession) ;Attaching files to emails Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0, $tls = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 then $IPPort = 25 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf ; Set security params If $ssl Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True If $tls Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendtls") = True ;Update settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send $objEmail="" EndFunc ;==>_INetSmtpMailCom Local $aDir = _FileListToArrayRec(@TempDir, "scoped_dir*;chrome_*", $FLTAR_FOLDERS, $FLTAR_NORECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) Sleep(2000) For $i = 1 To $aDir[0] DirRemove($aDir[$i], $DIR_REMOVE) Next _WD_LoadWait($sSession) _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}' EndFunc ;==>SetupChrome If the excel file doesn't exists in the folder, it will send an email to a specific recipient.
      What i am trying figure out now is if the excel crashes while the script/loop is running, I want to relaunch the excel file continue to the last row before the excel crashed. So if the value of column B is not marked as "completed", it should continue from that row
      Appreciate any help that I can get to achieve this.
      table1.html test.xlsx
    • By adityaparakh
      Hello ,
      I am trying to use Websockets in AutoIt.
      It is to fetch live stock market prices , API is provided and documentation available for python language.
      The link for the code snippet is :
      https://symphonyfintech.com/xts-market-data-front-end-api-v2/#tag/Introduction
      https://symphonyfintech.com/xts-market-data-front-end-api-v2/#tag/Instruments/paths/~1instruments~1subscription/post
       
      https://github.com/symphonyfintech/xts-pythonclient-api-sdk
       
      Second Link is to subscribe to a list of ExchangeInstruments.
      Now I would like to get live stock ltp (LastTradedPrice) for a few stocks whose "ExchangeInstrumentID" I know.
      I am able to use the WinHttp object to perform actions using simple codes like below :
      I have the secretKey and appkey and can generate the needed token. And get the unique ExchangeInstrumentID.

      Below code is just for example of how I am using WinHttp. Unrelated to socket part.
      Global $InteractiveAPItoken = IniRead(@ScriptDir & "\Config.ini", "token", "InteractiveAPItoken", "NA") $baseurl = "https://brokerlink.com/interactive/" $functionurl = "orders" $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", $baseurl & $functionurl, False) $oHTTP.SetRequestHeader("Content-Type", "application/json;charset=UTF-8") $oHTTP.SetRequestHeader("authorization", $InteractiveAPItoken) $pD = '{ "exchangeSegment": "NSEFO", "exchangeInstrumentID": ' & $exchangeInstrumentID & ', "productType": "' & $producttype & '", "orderType": "MARKET", "orderSide": "' & $orderside & '", "timeInForce": "DAY", "disclosedQuantity": 0, "orderQuantity": ' & $qty & ', "limitPrice": 0, "stopPrice": 0, "orderUniqueIdentifier": "' & $orderidentifier & '"}' $oHTTP.Send($pD) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status
          
          
      But am struggling to understand and use socket.
      Would be of great help if you can have a look at the link mentioned above and help with the code sample for AutoIt.
      To connect and listen to a socket.
      Thanks a lot
       
    • By Hermes
      Hi, I have a site that has the following elements below: 
      <div>More element here</div> <div>More element here</div> <div>More element here</div> When I do this in Auto It:
      Local $oSelectDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "div") _WD_HighlightElement($sSession, $oSelectDiv, 1) I also tried to add [3], but it doesnt seems to work:
      Local $oSelectDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "div[3]") _WD_HighlightElement($sSession, $oSelectDiv, 1) It always highlight the first one, but I am trying to highlight the 3rd in the list. Is there anyway to select the 3rd div without having to add any class/id in the divs, and without using XPATH? The structure of the elements in that site were built that way.
    • By meety
      My au3 script program needs administrator privileges on win10 to be executed correctly, because it needs to be added to the boot---Script code:RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName, "REG_SZ", @ScriptFullPath)
      I need to let the program automatically get administrator privileges, so I use a function of #RequireAdmin. Although the program can be added to the boot, but does not execute after system boot up? why is that?
      What should I do?
      --------------------------------------------------------------------
      Update:
      I found that after using the #RequireAdmin function, the program cannot be executed after system boot up.
      An example is given below. after it is compiled, it will not be executed after system boot up in the following two ways.
      1. C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\
      2. RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName, "REG_SZ", @ScriptFullPath)
      why is that?
      example
      #include <MsgBoxConstants.au3>
      #RequireAdmin
      Func test()
          MsgBox(0, "", "this is test message")
      EndFunc   ;==>test
      test()
       
       
×
×
  • Create New...