Leaderboard
Popular Content
Showing content with the highest reputation on 04/23/2013 in all areas
-
you can check the syntax of an Email. The Regex would match most of it, excluding the special chars, U+007F above chars IP address domain name and comments. That's the general syntax many email providers allow only a few chars other than alphanum. Use a Case-Insensitivity switch(?i), for matching upper-case chars. Edit: I tried to simplify the regex #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> mainlobby() Func mainlobby() Global $msg, $receiver Local $sendemilbutton, $recipientsread, $recipientsenter, $aEmail $width = 320 $height = 200 GUICreate('', 320, 200, 500, 250) $recipientsenter = GUICtrlCreateInput("", 10, 5, 250, 20) $sendemilbutton = GUICtrlCreateButton("Send Email", 230, 128, 70, 25, 1) GUISetState() Do $msg = GUIGetMsg() Select Case $msg = $sendemilbutton If GUICtrlRead($recipientsenter) = "" Then MsgBox(16, "Email Not Input", "Cannot Find Any Email") Else ; start added code $aEmail = StringSplit(GUICtrlRead($recipientsenter), ';') $localpart = "[[:alnum:]!#$%&'*+-/=?^_`{|}~.]+" $domainname = "[[:alnum:].-]+\.[[:alnum:]]+" For $1 = 1 To $aEmail[0] If StringRegExp($aEmail[$1], '(?i)^(' & $localpart & ')@(' & $domainname & ')$', 0) Then ConsoleWrite("Email_" & $1 & " is valid" & @CRLF) Else MsgBox(0, "Error", "Email " & $1 & " is not valid") EndIf Next ; end added code EndIf EndSelect Until $msg = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>mainlobbyThe limitations are still the same Regards2 points
-
dannydy, You might do something like this (not tested) Func mainlobby() Global $msg, $receiver Local $sendemilbutton, $recipientsread, $recipientsenter, $aEmail GUICreate($toolname, $width, $height, 500, 250, -1, $WS_EX_ACCEPTFILES) ; will create a dialog box that when displayed is centered GUISetBkColor(0x6666FF) $recipientsenter = GUICtrlCreateInput("", 10, 5, 250, 20) $sendemilbutton = GUICtrlCreateButton("Send Email", 230, 128, 70, 25, -1, 0x00000001) GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Select Case $msg = $sendemilbutton If GUICtrlRead($recipientsenter) = "" Then MsgBox(16, "Email Not Input", "Cannot Find Any Email") Else MsgBox(0, "Email Input", GUICtrlRead($recipientsenter)) $receiver = GUICtrlRead($recipientsenter) ; start added code $aEmail = stringsplit($receiver,';') for $1 = 1 to $aEmail[0] if stringregexp($aEmail[$1],'^[\_]*([a-z0-9]+(\.|\_*)?)+@([a-z][a-z0-9\-]+(\.|\-*\.))+[a-z]{2,6}$',0) = 1 then CreateMailItem() Else guictrlsetdata($recipientsenter,$aEmail[$1] & ' in error - not sent') EndIf next ; end added code EndIf EndSelect Until $msg = $GUI_EVENT_CLOSE GUIDelete() _Exit() EndFunc ;==>mainlobby The regexp was found using GOOGLE search. You don't really need to understand it to use it (although better if you do, obviously). kylomas2 points
-
The AutoItObject team is proud to announce that the first version of our AutoItObject UDF is complete and ready to use. The project page is located at [currently missing] Please, report bugs and any other issues at our [currently missing], and not here. An overview of all the functions can be found in the online documentation [currently missing] or in the offline .chm documentation file which is included with the [currently missing]. If Origo has problems providing the download, the current version will be mirrored here The UDF requires the current AutoIt version v3.3.4.0! AutoItObject 1.2.8.2.exe AutoItObject 1.2.8.2.zip Please, leave your comments and experiences here. Regards, - trancexx - ProgAndy - monoceres - Kip Our work is published under the Artistic License 2.0 A copy of the FAQ to answer your most urgent questions right away: (can also be found at the online documentation: Some helper-functions: When using the Wrapper, this are some simple methods to get a return value from the resulting array. ; #FUNCTION# ==================================================================================================================== ; Name...........: _AIOResult ; Description ...: Returns the return value of the Call to a WraperObject function ; Syntax.........: _AIOResult(Const $aResult [, $vError=0] ) ; Parameters ....: $aResult - the resulting array ; $vError - [optional] value to be returned if result is no array (default: 0) ; Return values .: Success - Returnvalue ($aResult[0]) ; Failure - $vError, @error set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _AIOResult(Const $aResult, $vError=0) ; Author: Prog@ndy If IsArray($aResult) Then Return $aResult[0] Return SetError(1,0,$vError) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _AIOParam ; Description ...: Returns the parameter value of the Call to a WraperObject function ; Syntax.........: _AIOParam(Const $aResult, $iParam, $vError=0) ; Parameters ....: $aResult - the resulting array ; $iParam - The parameterindex to return (0: result, 1: first parameter, 2: 2nd parameter, ...) ; $vError - [optional] value to be returned if result is no array (default: 0) ; Return values .: Success - Parameter value ; Failure - $vError, @error set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _AIOParam(Const $aResult, $iParam, $vError=0) ; Author: Prog@ndy If UBound($aResult)-1 < $iParam Then Return SetError(1,0,$vError) Return SetExtended($aResult[0], $aResult[$iParam]) EndFunc1 point
-
Here you will find several functions, some old (mainly improved) and some new, organized in a suite of UDFs. Some will likely undergo changes in the future, as and when better methods are discovered by me, or following suggested improvements. bitwise.au3 stringf.au3 arrayf.au3 convert.au3 misc2.au3 kids.au3 math10.au3 flipflapflop.au3 examples.au3 Download all UDFs and examples in one zip file udf_suite.zip1 point
-
Classes and Objects
crashdemons reacted to BrewManNH for a topic
Will you please stop with all the emoticons? Most of them you're using don't even fit into what you're saying, so it makes you look like you're 12.1 point -
GUIListViewEx - Deprecated Version
mesale0077 reacted to Melba23 for a topic
mesale0077, I have looked into dragging items between ListViews and I have come up with something. Add this function to the UDF: <code removed> and then run this script to see it in action: <code removed> As you can see, you need to tell the UDF whether to drag internally or externally - I am still working on getting that to be automatic but it is proving a bit tricky. How would you fell about having to hold down the Ctrl key to permit external dragging as that would simplify things enormously. Of course, comments from any other interested readers also welcome. M231 point -
Multiple commands in a line (one liners)
Joaquin reacted to JLogan3o13 for a topic
And Be sure to include plenty of these guys for JohnOne's amusement1 point -
Clark, I can explain what is happening. The function does indeed return an array - but only if an item in the ListView was doubleclicked. If nothing was double-clicked (i.e on most passes through the idle loop) then the function does not return an array but just an empty string. As I was just using _ArrayDisplay to display the returned array (and which just passes over a non-array parameter) I did not realise that this would cause a problem. There are several AutoIt functions and UDFs that do not always return arrays (e.g. IniReadSection, _FileListToArray) and quite frankly I did not expect the user to try and access the return without checking that there was actually an array present. It seems I was wrong. I will amend the function header to make clear that an array is only returned from an edit process launched by a double-click and that the user needs to check for the existence of an array before trying to access it. M23 Edit: ; Return values .: If no double-click: Empty string ; After double-click: 2D array of zero-based [row][column] items edited - total edits in [0][0] ; Failure: Sets @error as follows: ; 1 - ListView not editable ; 2 - Empty ListView ; 3 - Column not editable [...] ; The function only returns an array after an edit process launched by a double-click. If no ; double-click has occurred, the function returns an empty string. The user should check that a ; valid array is present before attempting to access it.1 point
-
What makes an email address "valid" is very complex in practice. Already at the email client level, what is considered valid is variable based on actual client, setup and network context. Then relays have to adhere to the same validity set of rules which is hardly the case. Finally the recipient host also has to consider valid the local part the same way as you did. This is one of the most complex routine task in IT and I don't believe it can be done unconditionnally from a blind end. Even if the practice is doubtful (due to overload of the servers) I regard asking SMTP the most reliable approach (or the less prone to failure). Of course that means you have access to a (the!) SMTP server on the machine the validation is running on. I don't know of any online service working correctly.1 point
-
Very helpful RegExLib is a website. Take this as a starter.1 point
-
Xandy, with luck i managed to do it. Here's the code stringregexp($aEmail[$1],'^[\_|[color=#ff0000][b]\-[/b][/color]]*([a-z0-9]+(\.|\_|[color=#ff0000][b]\-[/b][/color]*)?)+@([a-z][a-z0-9\-]+(\.|\-*\.))+[a-z]{2,6}$',0) Basically i added - in the statement(Highlighted in red). Many Thanks for taken a loop into it.1 point
-
Sorry I don't know stringregexp() formatting well enough (at all really) to try to write one without getting very frustrated. I would do something like use stringinstr() to find a '@', make sure it was not the first character. Is there always a '.' after the '@'? I don't know. Doing it this way would not be that many lines, but it would not be one line. You could smash it into a function though. I could write it pretty easy, would you like me to do it?1 point
-
It seems that $aRet isn't a 2D array it may be 1D. Have you tried $aRet[0] = 1 Then?1 point
-
Hmmm, but wouldn't _ArrayDisplay bork if that was the case? But let's assume for a second that it is not returning an array (even though _DisplayArray is showing the contents I need at element 0,0 and at 1,0), is there a way I can retrieve the elements that have been returned somehow, so I can use them?1 point
-
Many Thanks both of you(kylomas and Xandy). Its working fine, however if i entered one email address, the program threw me an error on that. its only worked on multiple email addresses. i'm working on it right now, make some modification will handle it. Really appreciate that save me a lot of time:)1 point
-
kylomas example reworked slightly to run without modification. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> mainlobby() Func mainlobby() Global $msg, $receiver Local $sendemilbutton, $recipientsread, $recipientsenter, $aEmail $toolname= "abc" $width= 320 $height= 200 GUICreate($toolname, $width, $height, 500, 250, default, $WS_EX_ACCEPTFILES) ; will create a dialog box that when displayed is centered GUISetBkColor(0x6666FF) $recipientsenter = GUICtrlCreateInput("", 10, 5, 250, 20) $sendemilbutton = GUICtrlCreateButton("Send Email", 230, 128, 70, 25, -1, 0x00000001) GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Select Case $msg = $sendemilbutton If GUICtrlRead($recipientsenter) = "" Then MsgBox(16, "Email Not Input", "Cannot Find Any Email") Else MsgBox(0, "Email Input", GUICtrlRead($recipientsenter)) $receiver = GUICtrlRead($recipientsenter) ; start added code $aEmail = stringsplit($receiver,';') for $1 = 1 to $aEmail[0] if stringregexp($aEmail[$1],'^[\_]*([a-z0-9]+(\.|\_*)?)+@([a-z][a-z0-9\-]+(\.|\-*\.))+[a-z]{2,6}$',0) = 1 then ;CreateMailItem() Else guictrlsetdata($recipientsenter,$aEmail[$1] & ' in error - not sent') EndIf next ; end added code EndIf EndSelect Until $msg = $GUI_EVENT_CLOSE GUIDelete() ;_Exit() EndFunc ;==>mainlobby1 point
-
Clark, All your own doing I am afraid! You were not correctly creating the array to pass to the UDF. Your $lvitem array actually contained the ControlIDs of the ListView items and not the contents of the items - and the [0] element of the array had no content even though in the _Init function you set $iCount to 0 and so the UDF expected something. Hence the UDF tried to edit that empty element - and of course there was nothing in there to edit! I suggest that you use the _GUIListViewEx_ReadToArray function to get a valid array once the ListView is filled - like this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx_Mod.au3" Global $lvitem, $iLV_List, $listbox, $hImage, $iEditMode = 0 $Form1 = GUICreate("Kerberos - Plan a Release", 947, 662, -1, -1) GUICtrlSetStyle($Form1, $LVS_ICON) $lvMain = GUICtrlCreateListView("# |CRM ID |Name/Description |BU |Defect #|PO Number|Provider Ref |Provider | ", 8, 200, 921, 396, BitOR($LVS_SORTASCENDING, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS), BitOR($LVS_EX_FULLROWSELECT, $WS_EX_CLIENTEDGE, $LVS_EX_DOUBLEBUFFER, $LVS_EX_SUBITEMIMAGES)) _GUICtrlListView_SetColumnWidth($lvMain, 0, 50) _GUICtrlListView_SetColumnWidth($lvMain, 2, 320) _GUICtrlListView_SetColumnWidth($lvMain, 8, 92) $hListBox = GUICtrlGetHandle(-1) $btnExit = GUICtrlCreateButton("Exit", 768, 608, 75, 25) GUICtrlSetTip(-1, "Exit this screen without saving") GUISetState(@SW_SHOW) _GUIListViewEx_MsgRegister(True, False, False) ; Create the items without using an array <<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlCreateListViewItem("1|8000069709|Application Search Enhancement|Grants|2012|1234567890|FUJ999|Fujitsu", $lvMain) GUICtrlCreateListViewItem("2|8000088092|New CRM Business Support Role|Grants|2099|5634567928|FUJ998|Fujitsu|", $lvMain) GUICtrlCreateListViewItem("3|8000073022|3 wage types for termination payments|Grants|", $lvMain) ; Now read the completed ListView into an array - note that the $iCount parameter matches that used in the _Init function below <<<<<<<<<<<<<<< $lvitem = _GUIListViewEx_ReadToArray($lvMain, 0) ; Initiate LVEx - use filling array - no count parameter - default insert mark colour (black) - drag image - sort & editable (0 & 2) - only cols 4-7 editable $iLV_List = _GUIListViewEx_Init($lvMain, $lvitem, 0, 0, False, 1 + 2, "4-7") ; I coded the elegant range syntax - so please use it! <<<<<<<<< ; Set the left ListView as active _GUIListViewEx_SetActive(1) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btnExit Exit EndSwitch ; No longer any need to define columns as now done in _Init function $aRet = _GUIListViewEx_Editonclick($iEditMode) ; Allow keys to move edit location ;_ArrayDisplay($aRet, @error) WEndAll clear? Please ask if not. M23 P.S. Once again the forum software is messing with one of the function names - it should read _GUIListViewEx_Edit+On+Click without the plus signs.1 point
-
Issues executing in silent mode a .reg file
derspinne reacted to stormbreaker for a topic
Change: ShellExecute("regedit.exe", '/s "' & @DesktopDir & 'BossENG.reg"') to ShellExecute("regedit.exe", '/s "' & @DesktopDir & 'BossENG.reg"') You see, you forgot the backslash (). One word and we are back to the business baby... Just a line I remember from a film I saw. Good day...1 point -
Start VLC minimized
Xandy reacted to abberration for a topic
Something that might work for you: $mediaFile = "test.m4v" ShellExecute("C:\Program Files\VideoLAN\VLC\vlc.exe " & '"' & @DesktopDir & "\" & $mediaFile & '"') WinWaitActive($mediaFile & " - VLC media player") WinSetState($mediaFile & " - VLC media player", "", @SW_MINIMIZE)1 point -
Don't worry about bumping and no, it's not wrong place. AutoItObject project is left behind, like you said. No one works on it any more as far as I know, but that doesn't mean it's outdated. See, AutoIt language hasn't developed enough to render AutoItObject completely obsolete. Some of the functionality AutoItObject has I added to the core language already, the rest is still there waiting for people to use it through this unique set of UDFs. The main problem here is the lack of community intelligence. I must also say that AutoIt is really a victim of wrong... sorry, bad decisions made by people with not enough healthy ambition found on all positions, even the highest. All that lead to clear and obvious brain drain. Today it's very hard to find someone in this community who's capable for sane, intelligent discussion about advanced and complex programming issues, problems or simply concepts. And so here we are, like it or not. Enjoy learning.1 point
-
You need to install the full version of SciTE4AutoIt3 to get full functionality.1 point
-
Also check in my signature for the latest version of SciTE Jump.1 point
-
Welcome to AutoIt and the forum! Check SciTEJump which can be found in the tools tab of SciTE or by Ctrl+Alt+J.1 point