Leaderboard
Popular Content
Showing content with the highest reputation on 09/09/2013 in all areas
-
GUI beginner attempt, cash register
jaberwacky and one other reacted to kylomas for a topic
CroatianPig, The "programming language" is not your problem. This project is significantly bigger than "create a gui with some buttons" which is how the thread started. I am suggesting the following with your best interests at heart. You are clearly a beginner at both AutoIT and programming / system development. Three things are standing in your way: - lack of planning - lack of formal definition - impatience You have shown some aptitude for picking up the language. Now you need to slow down a bit and truly understand what each function / instruction / operator is doing. Some of your questions suggest that you are reading the doc, but not understanding all of the implications (understandable for a new programmer). Now that you have gotten your hands wet, take a step back and document what you really want to do. Define the kinds of data that you will need, how the data will be stored, presented and used. Following that, define your task at a very high level. Then start breaking each "thing" that you want to do into smaller and smaller pieces. Each of these piece is what you will code from. If you are familiar with programming flowcharts, use this to document your task. All that you want to do can be done with one driver gui, some subordinate gui's (product/customer/inventory definition for example) and an SQLite DB. At this point I would recommend NOT using an *.INI file, the SQLite UDF makes SQLite as simple as using an INI file for data storage. Final Comment... I know this seems like a waste of time and you don't want to "throw away what you've done" or "change directions". However, it will pay dividends later, especially slowing down and understanding what you are reading in the Help file and example scripts. Good Luck, kylomas2 points -
Well when I find something works well for me I tend to make use of it very often as most of us do and so when I make a tutorial video you may find through habit my ways of doing things will be present. My intention is to give other people the same chance to make use of this great language as I have had. Yes there will be differences between how I do things and how others do things but difference is the juice of life. If everyone did the same things in the same ways the creativity would not flow as freely. People are free to do things in what ever way works for them, so when I make a video people will learn how to do something and from that point the more they understand the language they will learn their own tricks and preferences. It is just the way of things. I learned originally from 403 forbidden's video tutorials and the help file, however choice is always good. Not everyone will like his videos, voice, style etc. Similarly some people may not like my videos, voice or style but having choices available is preferable to feeling restricted. Contrast will teach people different methods of doing the same things so please do not be afraid to share your tutorials, help or tips for fear of "polluting" someone's coding method with your own style. Let them learn and find what works for them.1 point
-
it works on latest beta but not on AutoIt 3.3.8.11 point
-
This is what I've got for the moment. If you are interested in it tell me for any modifications. Added a lot more of code and functions Features Add, Insert or Delete(one or all) Item Call function when item is clicked Support of scrolling with arrow buttons VScroll Bar is now included Enter is also taken as an event Set your own cursor Multiple EditLists could be used at a time. EditList.au3 #include-once #include <Array.au3> #include <WinAPISys.au3> #include <WinAPIRes.au3> #include <APISysConstants.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> #include <Constants.au3> ; = = = = = = . . . . Private UDF Global Variables =========================================================== Global $aItems[1] ;stores Item indexes Global $sAppend ;stores Item delimited Global $__hCur ;stores the handle to the cursor Global $h_ControlHwnd ;stores the handle of the control. Global $p_Original_WindowProc ;stores the original window procedure(WndProc) of the edit control. Global $h_NewWndProc = DllCallbackRegister("_NewWnd_Proc_", "int", "hwnd;uint;wparam;lparam") ;hanlde to the new WndProc Global $p_NewWndProc = DllCallbackGetPtr($h_NewWndProc) ;pointer to the new WndProc. Global $s_OnEventFunc ;string storing the name of the func to call upon click. Func _Edit_List_Create($iX, $iY, $iWidth, $iHeight, $hWin, $sAppendString = -1) $h_ControlHwnd = _GUICtrlRichEdit_Create($hWin, "", $iX, $iY, $iWidth, $iHeight, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_MULTILINE, $ES_NOHIDESEL)) OnAutoItExitRegister("Destroy") $p_Original_WindowProc = _Subclass_($h_ControlHwnd, $p_NewWndProc) _GUICtrlRichEdit_SetText($h_ControlHwnd, "") If $sAppendString = -1 Then $sAppendString = @LF $sAppend = $sAppendString $aItems[0] = -StringLen($sAppend) Return $h_ControlHwnd ; EndFunc ;==>_Edit_List_Create Func _Edit_List_Suspend() Local $aRet[6] = [$aItems, $sAppend, $__hCur, $h_ControlHwnd, $p_Original_WindowProc, $s_OnEventFunc] ReDim $aItems[1] $sAppend = "" $__hCur = 0 $h_ControlHwnd = 0 $p_Original_WindowProc = 0 $s_OnEventFunc = "" Return $aRet EndFunc ;==>_Edit_List_Suspend Func _Edit_List_Restore($aData) If IsArray($aData) = 0 Then Return $aItems = $aData[0] $sAppend = $aData[1] $__hCur = $aData[2] $h_ControlHwnd = $aData[3] $p_Original_WindowProc = $aData[4] $s_OnEventFunc = $aData[5] EndFunc ;==>_Edit_List_Restore Func _Edit_List_GetActive() Return $h_ControlHwnd EndFunc ;==>_Edit_List_GetActive Func _Edit_List_InsertItem($s_Text, $iIndex = -1) Local $sEdit_Text = _GUICtrlRichEdit_GetText($h_ControlHwnd) Local $iMaxLen = StringLen($sEdit_Text) If IsInt($iIndex) = 0 Then Return SetError(2, 0, 0) ;bad $iIndex $s_Text = StringRegExpReplace($s_Text, "\v+", @LF) If $iIndex >= UBound($aItems) Then Return SetError(3, 0, 0) If $iIndex >= 1 Then Local $iUbound = UBound($aItems) If $iIndex > $iUbound Then Return SetError(3, 0, 0) ;bad $iIndex _GUICtrlRichEdit_GotoCharPos($h_ControlHwnd, $aItems[$iIndex - 1] + StringLen($sAppend)) _GUICtrlRichEdit_InsertText($h_ControlHwnd, $s_Text & $sAppend) Local $Change = StringLen($s_Text & $sAppend) _ArrayInsert($aItems, $iIndex - 1, $aItems[$iIndex - 1]) ;reset the array For $i = $iIndex To $iUbound $aItems[$i] += $Change Next ElseIf $iIndex = -1 Then _ArrayAdd($aItems, StringLen($sEdit_Text & $s_Text)) _GUICtrlRichEdit_AppendText($h_ControlHwnd, $s_Text & $sAppend) Else Return SetError(1, 0, 0) ;$iIndex parameter is wrong. EndIf Return 1 EndFunc ;==>_Edit_List_InsertItem Func _Edit_List_GetItemText($iIndex = -1) ;by default gets the selected items text If $iIndex = -1 Then Return _GUICtrlRichEdit_GetSelText($h_ControlHwnd) If $iIndex <= 0 Or IsInt($iIndex) = 0 Then Return SetError(1, 0, 0) If $iIndex >= UBound($aItems) Then Return SetError(3, 0, 0) Return _GUICtrlRichEdit_GetTextInRange($h_ControlHwnd, $aItems[$iIndex - 1] + StringLen($sAppend), $aItems[$iIndex]) EndFunc ;==>_Edit_List_GetItemText Func _Edit_List_GetSelItemIndex() Local $iLowerIndex = _GUICtrlRichEdit_GetSel($h_ControlHwnd) If @error Then Return SetError(1, @error, 0) $iLowerIndex = $iLowerIndex[0] For $i = 1 To UBound($aItems) - 1 Switch $iLowerIndex Case $aItems[$i - 1] + StringLen($sAppend) To $aItems[$i] Return $i EndSwitch Next Return SetError(2, 0, 0) EndFunc ;==>_Edit_List_GetSelItemIndex ;The Following function was works using the functions of the already present library. ;Therefore it would work with both OnEvent as well as MsgLoop methods. ;PS: The OnEvent macros won't work like @GUI_CTRLID, etc. ;Use _Edit_List_SetOnClick("") to deregister an already registered function. ;The function should not have any parameter. Func _Edit_List_SetOnEvent($s_FuncName) $s_OnEventFunc = $s_FuncName EndFunc ;==>_Edit_List_SetOnEvent Func _Edit_List_SetCursor($hCursor) $__hCur = $hCursor;_WinAPI_CopyCursor() EndFunc ;==>_Edit_List_SetCursor Func _Edit_List_SetSel($iIndex, $iReverse = False) ;key: the index of the array is the length of the item, ;use the index of the previous item to get the initial position of the required item If IsInt($iIndex) = 0 Or $iIndex < 1 Or $iIndex >= UBound($aItems) Then Return SetError(1, 0, 0) Local $iAnchor = $aItems[$iIndex - 1] + StringLen($sAppend) Local $iActive = $aItems[$iIndex] If $iReverse Then _ArraySwap($iActive, $iAnchor) Return _GUICtrlRichEdit_SetSel($h_ControlHwnd, $iAnchor, $iActive) EndFunc ;==>_Edit_List_SetSel Func _Edit_List_RemoveItem($iIndex) If $iIndex >= UBound($aItems) Then Return SetError(3, 0, 0) _GUICtrlRichEdit_SetSel($h_ControlHwnd, $aItems[$iIndex - 1] + StringLen($sAppend), $aItems[$iIndex] + 1) _GUICtrlRichEdit_ReplaceText($h_ControlHwnd, "", False) Local $Change = StringLen(_Edit_List_GetItemText($iIndex) & $sAppend) _ArrayDelete($aItems, $iIndex) ;reset the array For $i = $iIndex To UBound($aItems) - 1 $aItems[$i] -= $Change Next _SendMessage($h_ControlHwnd, $WM_SETFOCUS) EndFunc ;==>_Edit_List_RemoveItem Func _NewWnd_Proc_($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $h_ControlHwnd Switch $iMsg Case $WM_RBUTTONDOWN, $WM_CHAR Return 0 Case $WM_SETCURSOR If $__hCur <> 0 And _WinAPI_LoWord($lParam) = 1 Then Return _WinAPI_SetCursor($__hCur) ;lparam = hittest = 1 = client area Case $WM_KEYDOWN Local Const $VK_UP_ = 0x26 Local Const $VK_DOWN_ = 0x28 Local Const $VK_ENTER_ = 0x0D Switch $wParam Case $VK_UP_, $VK_DOWN_ _Edit_List_SetSel(_Edit_List_GetSelItemIndex() + $wParam - 0x27, $wParam - 0x28) _GUICtrlRichEdit_ScrollToCaret($hWnd) Case $VK_ENTER_ If IsFunc($s_OnEventFunc) Then $s_OnEventFunc($hWnd, 1) EndSwitch Return 0 Case $WM_KILLFOCUS $iRet = _WinAPI_CallWindowProc($p_Original_WindowProc, $hWnd, $iMsg, $wParam, $lParam) DllCall("user32.dll", "int", "ShowCaret", "hwnd", $hWnd) Return $iRet Case $WM_SETFOCUS $iRet = _WinAPI_CallWindowProc($p_Original_WindowProc, $hWnd, $iMsg, $wParam, $lParam) DllCall("user32.dll", "int", "HideCaret", "hwnd", $hWnd) Return $iRet Case $WM_LBUTTONDOWN, $WM_LBUTTONDBLCLK $iX = _WinAPI_LoWord($lParam) $iY = _WinAPI_HiWord($lParam) $iChar = _GUICtrlRichEdit_GetCharPosFromXY($hWnd, $iX, $iY); For $n = 1 To UBound($aItems) - 1 Switch $iChar Case $aItems[$n - 1] + StringLen($sAppend) To $aItems[$n] _Edit_List_SetSel($n, 1) _GUICtrlRichEdit_ScrollToCaret($hWnd) EndSwitch Next If IsFunc($s_OnEventFunc) Then $s_OnEventFunc($hWnd, 0) Return 0; EndSwitch Case Else Switch $iMsg Case $WM_LBUTTONDOWN, $WM_LBUTTONDBLCLK If IsFunc($s_OnEventFunc) Then $s_OnEventFunc($hWnd, 0) Return 0; EndSwitch EndSwitch ;go with the original processing. Return _WinAPI_CallWindowProc($p_Original_WindowProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_NewWnd_Proc_ Func _Subclass_($hWnd, $pNew_WndProc) ;substitute the WndProc of the control. Return _WinAPI_SetWindowLong($hWnd, $GWL_WNDPROC, $pNew_WndProc) EndFunc ;==>_Subclass_ Func Destroy() _Subclass_($h_ControlHwnd, $p_Original_WindowProc) _GUICtrlRichEdit_Destroy($h_ControlHwnd) _WinAPI_DestroyCursor($__hCur) EndFunc ;==>Destroy Func _Edit_List_Clear() ReDim $aItems[1] Local $iRet = _GUICtrlRichEdit_SetText($h_ControlHwnd, "") _SendMessage($h_ControlHwnd, $WM_SETFOCUS) Return $iRet EndFunc ;==>_Edit_List_Clear Test Script.au3 ;Note the script requries AutoIT v3.3.10++ #include <EditList.au3> #include <WinAPIRes.au3> If StringMid(@AutoItVersion, 3, 4) <> "3.10" Then Exit MsgBox(16, "Error", "The script requries AutoIT v3.3.10++" & @CRLF & "You have " & @AutoItVersion) $hMain = GUICreate("Test", 700, 300) Global $hRichEdit_1 = _Edit_List_Create(10, 10, 300, 280, $hMain) _Edit_List_InsertItem("1. The usual high-level elements for functions, loops and expression-handling.") _Edit_List_InsertItem("4. A staggering amount of string handling functions and a Perl Compatible Regular Expression Engine(PCRE)" & @CRLF) _Edit_List_InsertItem("2. Call Win32 and Third-Party DLL APIs." & @CRLF, 2) _Edit_List_InsertItem("3. COM support", 3) Local $hCur = _WinAPI_LoadCursor(0, $IDC_HAND) _Edit_List_SetCursor($hCur) _WinAPI_DestroyCursor($hCur) _Edit_List_SetOnEvent(OnEvent_Handler) ;Now before creating a new EditList we have to suspend the first EditList Global $aData = _Edit_List_Suspend() Global $hRichEdit_2 = _Edit_List_Create(390, 10, 300, 280, $hMain) _Edit_List_InsertItem("The only things that evolve by themselves in an organization are disorder, friction and malperformance." & @CRLF) _Edit_List_InsertItem("The mind is everything. What you think you become. –Buddha" & @CRLF) _Edit_List_InsertItem("There is only one way to avoid criticism: do nothing, say nothing, and be nothing. –Aristotle" & @CRLF) _Edit_List_InsertItem("A person who never made a mistake never tried anything new. – Albert Einstein" & @CRLF) _Edit_List_InsertItem("The battles that count aren’t the ones for gold medals. The struggles within yourself–the invisible battles inside all of us–that’s where it’s at. –Jesse Owens") _Edit_List_SetOnEvent(OnEvent_Handler) GUISetState() _SendMessage($hRichEdit_2, $WM_SETFOCUS) ;required for initial hiding of the caret. The one created at last should be set the focus Do Sleep(10) Until GUIGetMsg() = -3 ;$GUI_EVENT_CLOSE = -3 Func OnEvent_Handler($hRichEdit, $iEvent) ;$hRichedit is the handle of the richedit from where the function is called ;$iEvent ; 1| OnEnterDown (received when it is the current editlist) ; 0| OnLeftClick Switch $iEvent Case 0 ;onmouse click If _Edit_List_GetActive() <> $hRichEdit Then Local $bData = _Edit_List_Suspend() _Edit_list_Restore($aData) $aData = $bData MouseClick('left', Default, Default, 1, 0) ;simulate a click to set selection EndIf EndSwitch ConsoleWrite("Item Selected: " & _Edit_List_GetSelItemIndex() & @TAB & " ItemText: " & _Edit_List_GetItemText() & @CRLF) EndFunc ;==>OnEvent_Handler Let me know what you think. Thumbs up if it helped Regards1 point
-
What I do in my own code doesn't make it into the help file examples, as these should exhibit good coding standards and unbiased practices.1 point
-
Don't forget operator precedence. The reason 100 + 100/2 gives you 150 is because "/" has a higher precedence than "+", so division is done first, then addition. In the case of 100 * 100/2 multiplication and division have the same precedence, so it's computed left to right.1 point
-
Hi. I thought the forum would email me with responses I have run into issues with multi-tiered calculations breaking down unless things are ( ( encapsulated ) / ( encapsulated ) ) * nonencapsulated etc. So while sometimes it may not be needed to add ( ) around some of the things I do, I find it since it breaks nothing to do it and adds a logical aid to see how the calculations are processed I always do it these days. I don't usually ever run into issues with calculations being misinterpreted due to missing something. I think the main issues have been a calculation being only performed on the last bit of an equation rather than the result of something. Eg 100 + 100 / 2 My intention may be that it will result in 100 but in fact it may end up being 150 as in this example. It is more of an issue with many components in a calculation but to avoid all issues I logically break it up any way. It helps me also understand what is going on. So even in calculations tat don't "require" grouping with brackets I do it any way. The following example would be required to be grouped to get to the correct intended result of 100: ((100 + 100) / 2) or in this example that doesn't "require" grouping: (UBound($Array) -1) Adding the grouping makes it easy to logically see what is a self-contained result figure and you can then easily add to the equation without having to re-read it all to then group it up so a more elaborate calculation won't break. My method lets me just add to what I already have. So, basically it is a time saver and helps me read and understand. Edit: So in this example no grouping is needed: ; Milligrams of caffeine per ml of energy drink... $CaffeineGrams = 0.16 $LiquidML = 500 $Answer = $CaffeineGrams * 1000 / $LiquidML However I would write it like this: ; Milligrams of caffeine per ml of energy drink... $CaffeineGrams = 0.16 $LiquidML = 500 $Answer = (($CaffeineGrams * 1000) / $LiquidML) Because now I can see that $CaffeineGrams * 1000 is a self contained unit of information that has been calculated and if I want to process it further perhaps by taking the resulting mg of caffeine per 500ml can of energy drink and multiply it by a custom amount of liquid to find out how much caffeine would be in a drink xyz size I don't have to make sure everything is grouped up at that time, I can simply add to it and then encapsulate the entire thing in another set of brackets like this: ; Milligrams of caffeine in 2 cans of energy drink... $CaffeineGrams = 0.16 $LiquidML = 500 $Answer = ((($CaffeineGrams * 1000) / $LiquidML) * ($LiquidML * 2)) Now I can see if I drink 2 drinks I will get 320 mg of caffeine. I can easily see what a self contained result is and now if I wanted to add even more to it I could do so easily because this is now a whole contained result with self contained components.1 point
-
Make a button visible when Notepad is opened
Alexxander reacted to Mat for a topic
Generally you don't want to set a state in a tight loop. That's just asking for flashing and other graphical glitches. WinExists is not quite what you want either. When you close notepad it hides the window, and only deletes it later (there shouldn't be a huge delay, but I'm using a pretty old computer so it's noticeable). Anyway, I changed the code a bit and it works now. No idea what issue it was stopping your code from working, possibly NOTEPAD wasn't matching any windows, and was matching the start menu somehow. Can't reproduce here on xp. #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> $GUI = GUICreate("MY GUI", 100, 100, 500, 500, $WS_POPUP, $WS_EX_TOPMOST) $but = GUICtrlCreateButton("", -1, -1, 500, 500) GUISetState() Local $fShown = True, $h While 1 $nMsg = GUIGetMsg() $h = WinGetHandle("[CLASS:Notepad]") $menu = Not @error And BitAND(WinGetState($h), @SW_SHOW) If $menu <> $fShown Then GUICtrlSetState($but, $menu ? $GUI_SHOW : $GUI_HIDE) ConsoleWrite($menu & @LF) $fShown = $menu EndIf If $nMsg = $but Then ShellExecute("C:\auto\try.exe") WEnd1 point -
What about this here? AutoIt version 3.3.9.x is needed: #include <GUIConstantsEx.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #NoTrayIcon $hGUI = GUICreate("Form 1", 300, 200, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU), $WS_EX_DLGMODALFRAME) $hIcon = _WinAPI_GetClassLongEx($hGUI, $GCL_HICON) _WinAPI_DestroyIcon($hIcon) _WinAPI_SetClassLongEx($hGUI, $GCL_HICON, 0) _WinAPI_SetClassLongEx($hGUI, $GCL_HICONSM, 0) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Br, UEZ1 point
-
Read Excel Cells - Send email depending on whats in there
13lack13lade reacted to kylomas for a topic
13lack13lade, Your code should be organized similar to this. $team needs to contain the email address (change the team name in the orginal spreadsheet to an email address) #include <Excel.au3> #include <array.au3> #Include<file.au3> #include<ie.au3> #include<Date.au3> ; Error handler Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Email definitions global $SmtpServer = "SMTP ADDRESS" ; address for the smtp-server to use - REQUIRED global $FromName = "13lack 13lade" ; name from who the email was sent global $FromAddress = "FROM EMAIL" ; address from where the mail should come Global $ToAddress = '' ; destination address of the email - REQUIRED global $Subject = " report name " ; subject from the email - can be anything you want it to be global $Body = "enter body text here" global $AttachFiles = "" ; the file you want to attach- leave blank if not needed global $CcAddress = "" ; address for cc - leave blank if not needed global $BccAddress = "" ; address for bcc - leave blank if not needed global $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" global $Username = "" ; username for the account used from where the mail gets sent - REQUIRED global $Password = "" ; password for the account used from where the mail gets sent - REQUIRED global $IPPort = 25 ; port used for sending the mail global $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS ;~ ;$IPPort=465 ; GMAIL port used for sending the mail ;~ ;$ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS ;teams / countries XRFE TBL ; [0] = team name ; [1] = boolean to indicate that an email was sent for this team ; [2]...[n] = country codes global $aXREF_TBL[4][100] global $sXREFPath = "Q:\Documents\Load Support\Tom\Automation" & '\destinationbreakdown.xlsx' global $oExcel = _ExcelBookOpen($sXREFPath,0) if $oExcel = 0 then ConsoleWrite('Error opening ' & "Q:\Documents\Load Support\Tom\Automation" & '\destinationbreakdown.xlsx' & @LF) Exit endif global $sXREFSize = $oExcel.Application.Selection.SpecialCells($xlCellTypeLastCell).Address(True, True, $xlR1C1) $AXREFSize = StringRegExp($sXREFSize, "\A[^0-9]*(\d+)[^0-9]*(\d+)\Z", 3) global $XREFRow = $aXREFSize[0] global $XREFCol = $aXREFSize[1] ConsoleWrite('Processing ' & $XREFRow & ' rows and ' & $XREFCol & ' columns' & @LF) $aXREF_TBL[0][0] = $oExcel.Activesheet.Cells(3,2).Value ; team name $aXREF_TBL[1][0] = $oExcel.Activesheet.Cells(3,4).Value ; team name $aXREF_TBL[2][0] = $oExcel.Activesheet.Cells(3,6).Value ; team name $aXREF_TBL[3][0] = $oExcel.Activesheet.Cells(3,8).Value ; team name $aXREF_TBL[0][1] = 0 $aXREF_TBL[1][1] = 0 $aXREF_TBL[2][1] = 0 $aXREF_TBL[3][1] = 0 ; populate South Pacific for $1 = 4 to $XREFRow if $oExcel.Activesheet.Cells($1,1).Value = '' then exitloop $aXREF_TBL[0][$1-2] = $oExcel.Activesheet.Cells($1,1).Value next ; populate Asia for $1 = 4 to $XREFRow if $oExcel.Activesheet.Cells($1,3).Value = '' then exitloop $aXREF_TBL[1][$1-2] = $oExcel.Activesheet.Cells($1,3).Value next ; populate Europe / Africa for $1 = 4 to $XREFRow if $oExcel.Activesheet.Cells($1,5).Value = '' then exitloop $aXREF_TBL[2][$1-2] = $oExcel.Activesheet.Cells($1,5).Value next ; populate Australia for $1 = 4 to $XREFRow if $oExcel.Activesheet.Cells($1,7).Value = '' then exitloop $aXREF_TBL[3][$1-2] = $oExcel.Activesheet.Cells($1,7).Value next _ExcelBookClose($oExcel, 0) global $sFilePath1 = "Q:\Documents\Load Support\Tom\Automation\QA Reports" & "\p_ebefffrm.xlsm" global $oExcel = _ExcelBookOpen($sFilePath1,0) switch @error case 1 MsgBox(0, "Error!", "Unable to Create the Excel Object") Exit case 2 MsgBox(0, "Error!", "File does not exist - Shame on you!") Exit endswitch ; get # of rows and columns global $sLastCell = $oExcel.Application.Selection.SpecialCells($xlCellTypeLastCell).Address(True, True, $xlR1C1) $sLastCell = StringRegExp($sLastCell, "\A[^0-9]*(\d+)[^0-9]*(\d+)\Z", 3) global $iLastRow = $sLastCell[0] global $iLastColumn = $sLastCell[1] ; define country results variable global $sMList ; loop through visible entries and add an entry to the country results variable if it does not already exist for $1 = 2 to $iLastRow if $oExcel.Sheets("Todays Data").Rows($1).Hidden = True then Else ; create string of unique country codes if not stringinstr($sMList, $oExcel.Activesheet.Cells($1,1).Value & ',') then $sMList &= $oExcel.Activesheet.Cells($1,1).Value & ',' EndIf next ConsoleWrite(@LF) ConsoleWrite('! Processing entries for countries : ' & stringtrimright($sMList,1) & @LF) ConsoleWrite(@LF) ; create array to search against $aXREF_TBL $aMList = stringsplit(stringtrimright($sMList,1),',',2) ; search XREF TBL and send email to clients for $1 = 0 to ubound($aMList) - 1 for $2 = 0 to ubound($aXREF_TBL) - 1 for $3 = 2 to ubound($aXREF_TBL,2) - 1 if $aXREF_TBL[$2][$3] = $aMList[$1] and $aXREF_TBL[$2][1] = 0 then _send_email($aXREF_TBL[$2][0]) $aXREF_TBL[$2][1] = 1 EndIf Next Next next ConsoleWrite(@LF) _ExcelBookClose($oExcel, 0) func _send_email($team) ; $team need to contain the email address of the recipient at this point $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $team, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) If @error Then MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc) EndIf endfunc ; ; The UDF Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 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 If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then $objEmail.AddAttachment ($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) SetError(1) Return 0 EndIf Next 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 If $ssl Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True EndIf ;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 If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail="" EndFunc ;==>_INetSmtpMailCom ; ; ; Com Error Handler Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1); something to check for when this function returns Return EndFunc ;==>MyErrFunc kylomas1 point -
Malware of any form - trojan, virus, keylogger, spam tool, "joke/spoof" script, etc.Bypassing of security measures - log-in and security dialogs, CAPTCHAs, anti-bot agents, software activation, etc.Automation of software/sites contrary to their EULA (see Reporting bullet below).Launching, automation or script interaction with games or game servers, regardless of the game.Running or injecting any code (in any form) intended to alter the original functionality of another process.Decompilation of AutoIt scripts or details of decompiler software.This list is non-exhaustive - the Moderating team reserve the right to close any thread that they feel is contrary to the ethos of the forum. What are you talking about? Please be serious. Auto log in on web site is allowed. I am not bypassing any kind of security or captcha. It is a regular log in as in this forum. I am just asking if it possible to do it in another way. If you want some attention get a pet.1 point
-
Right on the money! I used IcoFX It will show you the contents of the ico file and you can remove entries, add and modify entries, and likely much more that I never use.1 point
-
You could use an icon editor like Greenfish or IcoFx (both Free) to remove unwanted quality icons. Greenfish Icon Editor Pro Portable IcoFX Portable1 point
-
New AutoIt3Wrapper Beta uploaded that should fix this. Jos1 point
-
Ghost21, I presume you are asking about the SciTE editor rather than AutoIt. SciTE as a default tries to add tabs to an exisiting instance, but you can tell it to open a new instance each time you open a new file. Add this line to your User Options File - you will find it under the <Options> menu: check.if.already.open=0 Or amend the similar line in the Global Options File - I have it on line #105. However, altering the Global Options File is not recommended as you will lose the setting when you next upgrade. M231 point