Jump to content

saldous

Active Members
  • Posts

    82
  • Joined

  • Last visited

saldous's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. ok, putting it all on one line has got rid of the error, it was an error about multi line but I couldn't work out where. It also gave a syntax error on the Else command, no idea why, error has now gone BUT... Using your version above always gives the output that the email address entered is invalid, even when it should be correct. No matter what I type it gives the invalid response. The formula had got broken, I've fixed it below. Now working great, thank you all >_< Func _IsValidEmail($email) If StringRegExp($email, "^([a-zA-Z0-9_\-])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}|((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])$") Then MsgBox(4096, "", "Valid email address.") Else MsgBox(4096, "", "Error, invalid email address") EndIf EndFunc
  2. Thanks AoRaToS but that doesn't work, it throws up all sorts of errors when I do that, I already tried the same thing.
  3. Thanks for your help. I'm still a bit stuck though, when I enter a valid email it now gives me both messages: While 1 $msg = GUIGetMsg() Select ; Exit if the user closes the dialogue box or clicks on Exit button Case $msg = $GUI_EVENT_CLOSE Or $msg = $ExitButton Exit Case $msg = $Check $email = GUICtrlRead($EmailInput) _IsValidEmail($email) EndSelect WEnd Func _IsValidEmail($email) If StringRegExp($email, "^([a-zA-Z0-9_\-])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}|" & _ "((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])$") Then MsgBox(4096,"ok", "Valid email address.") MsgBox(4096,"", "Error, invalid email address") EndFunc I tried putting "else" infront of the second msgbox but it doesn't like it. Think I've been looking at this too long and my brain is confused!
  4. I've got the following code and I'm pretty sure I'm 99% there, but it isn't working and so I'm looking for help. Any ideas what I've done wrong? I don't get either message pop-up at the moment. thanks. $Form1 = GUICreate("Check if entered email address is valid", 429, 218, -1, -1, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) $EmailInput = GUICtrlCreateInput ("", 184, 23, 217, 21) $ExitButton = GUICtrlCreateButton("Exit", 104, 176, 75, 25) $Check = GUICtrlCreateButton("Check if valid", 240, 176, 75, 25, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP)) $Label1 = GUICtrlCreateLabel("Enter an email address:", 32, 24, 145, 17) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select ; Exit if the user closes the dialogue box or clicks on Exit button Case $msg = $GUI_EVENT_CLOSE Or $msg = $ExitButton Exit Case $msg = $Check Call ("_IsVailidEmail") EndSelect WEnd Func _IsVailidEmail($EmailInput) If StringRegExp($EmailInput, "^([a-zA-Z0-9_\-])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}|" & _ "((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])$") Then MsgBox(4096,"Error", "Invalid email address entered.") MsgBox(4096,"ok", "Valid email address") EndFunc
  5. Hope someone can help here: My script puts a GUI up with two buttons, "Exit" and "Install" I don't have any code using the _IsPressed command, yet whilst the GUI is up if I press the Enter key on my keyboard the script exits. I'm assuming this is because the Exit button (which does exit the script) is selected by default somehow. I tried changing this to the other button but I still can't get it to work. Ideas? #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Include <Misc.au3> ; Create UI with input boxes to capture user details $Form1 = GUICreate("Installation utility", 429, 218, 368, 197, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) $EmailInput = GUICtrlCreateInput ("", 184, 23, 217, 21) $pw1 = GUICtrlCreateInput("", 184, 71, 217, 21) $pw2 = GUICtrlCreateInput("", 184, 118, 217, 21) $InstallButton = GUICtrlCreateButton("Install", 240, 176, 75, 25, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP)) $ExitButton = GUICtrlCreateButton("Exit", 104, 176, 75, 25, BitOR($BS_DEFPUSHBUTTON,$WS_GROUP)) $Label1 = GUICtrlCreateLabel("Enter the users email address:", 32, 24, 145, 17) $Label2 = GUICtrlCreateLabel("Enter a password for this account:", 16, 72, 165, 17) $Label3 = GUICtrlCreateLabel("(min 8 characters)", 48, 88, 88, 17) $Label4 = GUICtrlCreateLabel("(e.g. user@company.com)", 40, 40, 128, 17) $Label5 = GUICtrlCreateLabel("Confirm password:", 88, 120, 90, 17) GUISetState(@SW_SHOW) $completed = 0 While 1 $msg = GUIGetMsg() Select ; Exit if the user closes the dialogue box or clicks on Exit button Case $msg = $GUI_EVENT_CLOSE Or $msg = $ExitButton Exit ; Exit if the installation process completed Case $completed = 1 Exit ; Validate that the two passwords entered match Case $msg = $InstallButton If (GUICtrlRead($pw1)) == (GUICtrlRead($pw2)) and (GUICtrlRead($EmailInput)) <> "" then MsgBox(262144, "Installing...", "Using this email address: " & GUICtrlRead($EmailInput) & @CRLF & " and this password: " & GUICtrlRead($pw1)) ;need to write command line part still $completed = 1 ElseIF (GUICtrlRead($pw1)) <> (GUICtrlRead($pw2)) then MsgBox(262144+48, "Password error", "Passwords do not match, please try again.") $completed = 0 ElseIf (GUICtrlRead($EmailInput)) == "" then MsgBox(262144+48, "Email address error", "Please enter an email address and try again.") $completed = 0 EndIf EndSelect WEnd
  6. Perfect, thank you for the quick reply M23.
  7. Hi, quick question, I'm sure this is simple, I know I've done it before but I'm stumped. How can I make a msg box display that contains more than one value? e.g. I can do it with one just fine: MsgBox(262144, "Email Address", "You Entered this email address", GUICtrlRead($EmailInput)) But how can I get it to do something like: You entered this email address "$EmailInput" and this password "$password" ? I can't get it to accept more than one field. thanks.
  8. Can you post for the rest of us to see?
  9. How about: runwait("msiexec /qn /i C:\copy fileabc.exe h:\network share")
  10. Big_daddy, you are a star, I got it working perfectly now using that
  11. ok, I may be getting there by trying: $SaveButton = _IELinkGetCollection ($oIE, "editProfileForm:okButton") _IEAction ($SaveButton, "click") It clicks something, but isn't doing what I want it to do, maybe as this is a java script link?
  12. If I run this: $oxLinks = _IELinkGetCollection ($oIE) For $oLink In $oxLinks MsgBox(0, "Link Info", $oLink.id) Next It returns me a list of links by their ID. The question is how do I then perform an _IEAction on one of those ID's in the collection? I've looked in the help and I'm stumped. I know when using IEFormGetCollection I then have to use IEFormElementGetObjByName, but when I use IELinkGetCollection what do I use? This is the HTML code of the link / button I'm wanting to click on: CODE<a href="#" onclick="clear_editProfileForm();document.forms['editProfileForm'].elements['editProfileForm:_link_hidden_'].value='editProfileForm:okButton';if(document.forms['editProfileForm'].onsubmit){var result=document.forms['editProfileForm'].onsubmit(); if( (typeof result == 'undefined') || result ) {document.forms['editProfileForm'].submit();}}else{document.forms['editProfileForm'].submit();}return false;" id="editProfileForm:okButton" onmousedown="java script: this.className='sswsbutton sswsbutton-down'" onmouseup="java script: this.className='sswsbutton sswsbutton-hover'" onmouseover="java script: this.className='sswsbutton sswsbutton-hover'" onmouseout="java script: this.className='sswsbutton'" class="sswsbutton">Save</a> So the link ID = editProfileForm:okButton but how do I get IEAction to click it? Any ideas? thanks
  13. When I'm using IE7 my script runs fine with: $oPLinks = _IELinkGetCollection ($oIE, 9) _IEAction ($oPLinks, "click") But when I run the same script on a machine running the IE6 browser the link number 9 is different and it clicks the wrong link / not the one I'm wanting it to click. How can I get the results of IELinkGetCollection to be the same when using these two browser versions? Otherwise my script will not work correctly on all the machines deployed in my environment. The only other work around I can think of is doing a check on which browser is install on the users PC and then running the appropriate link script for that browser, but I don't really want to have to do this, and I don't know how to find out which version is running either. Thanks.
×
×
  • Create New...