VenusProject2 Posted December 23, 2014 Share Posted December 23, 2014 Hi all, I am trying to understand why when I find auotit code in the forums that has HREF tag of this format, see below, that I get a "syntax error" & yet other don't seem to, am I missing something? Thanks in advance: #include <IE.au3> $oIE = _IECreate("www.google.com") _IELinkGetCollection($oIE) Local $oLinks = _IELinkGetCollection($oIE) Local $iNumLinks = @extended MsgBox(0, "Link Info", $iNumLinks & " links found") For $oLink In $oLinks MsgBox(0, "Link Info", $oLink.href) If $oLink.href = "<a href='http://www.youtube.com/?tab=w1' class='bbc_url' title='External link' rel='nofollow external'>http://www.youtube.com/?tab=w1"</a> Then ;click on the youtube link _IEAction($oLink, "click") ExitLoop EndIf Next OR #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("PayMeNow", 463, 153, 192, 114) $btnPayMe = GUICtrlCreateButton("Pay Me Now", 168, 48, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btnPayMe ShellExecute("<a href='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick¤cy_code=USD&hosted_button_id=<PUTBUTTONIDHERE>' class='bbc_url' title='External link' rel='nofollow external'>https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick¤cy_code=USD&hosted_button_id=<PUTBUTTONIDHERE>"</a>); EndSwitch WEnd Link to comment Share on other sites More sharing options...
Geir1983 Posted December 23, 2014 Share Posted December 23, 2014 (edited) You have a " in the wrong place: #include <IE.au3> $oIE = _IECreate("www.google.com") _IELinkGetCollection($oIE) Local $oLinks = _IELinkGetCollection($oIE) Local $iNumLinks = @extended MsgBox(0, "Link Info", $iNumLinks & " links found") For $oLink In $oLinks MsgBox(0, "Link Info", $oLink.href) If $oLink.href = "<a href='http://www.youtube.com/?tab=w1' class='bbc_url' title='External link' rel='nofollow external'>http://www.youtube.com/?tab=w1</a>" Then ;click on the youtube link _IEAction($oLink, "click") ExitLoop EndIf Next Edited December 23, 2014 by Geir1983 Link to comment Share on other sites More sharing options...
VenusProject2 Posted December 23, 2014 Author Share Posted December 23, 2014 (edited) Thx Geir1983 that worked . The thing that threw me was almost everywhere I found a HREF tag the code was WRONG as in the 2 examples above Edited December 23, 2014 by VenusProject2 Link to comment Share on other sites More sharing options...
VenusProject2 Posted January 14, 2015 Author Share Posted January 14, 2015 Ok I'm seeing this syntax error more and more, how does everyone not get the syntax error, am I missing something? Please help clear this up for me, is this a version issue? This is a code extract from> Best SMS Sender yet! If $s_Username <> "" Then $objEmail.Configuration.Fields.Item("<a href='http://schemas.microsoft.com/cdo/configuration/smtpauthenticate' class='bbc_url' title='External link' rel='nofollow external'>http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"</a>) = 1 $objEmail.Configuration.Fields.Item("<a href='http://schemas.microsoft.com/cdo/configuration/sendusername' class='bbc_url' title='External link' rel='nofollow external'>http://schemas.microsoft.com/cdo/configuration/sendusername"</a>) = $s_Username $objEmail.Configuration.Fields.Item("<a href='http://schemas.microsoft.com/cdo/configuration/sendpassword' class='bbc_url' title='External link' rel='nofollow external'>http://schemas.microsoft.com/cdo/configuration/sendpassword"</a>) = $s_Password EndIf This is just 1 example & above of many I find on the forums here..... Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted January 14, 2015 Share Posted January 14, 2015 where do you get the error? please be more specific Link to comment Share on other sites More sharing options...
Geir1983 Posted January 14, 2015 Share Posted January 14, 2015 same problem again, you need to move the " to after the </a> Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted January 14, 2015 Share Posted January 14, 2015 (edited) I saw that too but since I'm not familiar with what he was doing, wasn't sure, thy Geir1983, If I may ask (sorry for the stupidity very little HTML skill) but that </a> is the closing thingy for the <a href... and as basicly part of the HTML he was trying to work with right? I just have some incling that this code would "configure" said control to have its field filled with the variable, much like innertext but I'm not sure, but here to learn first and for most so I ask Edit: and sorry for th unprofessional language Edited January 14, 2015 by SorryButImaNewbie Link to comment Share on other sites More sharing options...
Geir1983 Posted January 14, 2015 Share Posted January 14, 2015 Yes, its the end of the html, but the problem here is not related to html, it is passing a variable to the object that is failing. A string variable is always between two " (or '), when he closes the string and then writes the <a> after it creates a syntax error. SorryButImaNewbie 1 Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted January 14, 2015 Share Posted January 14, 2015 Thanks I wans't 100% sure that my assumption is correct, now I'm Link to comment Share on other sites More sharing options...
VenusProject2 Posted January 14, 2015 Author Share Posted January 14, 2015 Yes, its the end of the html, but the problem here is not related to html, it is passing a variable to the object that is failing. A string variable is always between two " (or '), when he closes the string and then writes the <a> after it creates a syntax error. Thx guys. Sorry for my late reply, the thing is, why are there so many instances of what is discussed as 'legitmate' code posted in the forums with this syntactical error, e.g. in Scite if you past the code/s as I posted it gives a syntax error. It is the closing </a> that is outside the "". Another example $sTitle = "Test GUI" GUICreate($sTitle) $Menu_help = GUICtrlCreateMenu("&Help") $Menu_Donate = GUICtrlCreateMenuItem("&Donate", $Menu_Help);; you can do the same with a button but the menu item is less obtrusive IMO. GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 Exit Case $Menu_Donate ShellExecute("<a href='http://dundats.mvps.org/donating.aspx?app=' class='bbc_url' title='External link' rel='nofollow external'>http://dundats.mvps.org/donating.aspx?app="</a> & $sTitle) ;;The ?app= query string is only to make it more flexible for me. If blank then it assumes donation to the website EndSwitch WEnd & another $Url = "<a href='http://dundats.mvps.org/autoit' class='bbc_url' title='External link' rel='nofollow external'>http://dundats.mvps.org/autoit"</a> ShellExecute(@programFilesDir & "\Internet Explorer\iexplore.exe", $Url, "", "", @SW_Minimize) I'm trying to use the "ShellExecute" This doesn't work even though there is no syntax error, move the " to enclose the last </a> tag, not sure how others got these scripts to work.... $Url = "<a href='http://dundats.mvps.org/autoit' class='bbc_url' title='External link' rel='nofollow external'>http://dundats.mvps.org/autoit</a>" ShellExecute(@programFilesDir & "\Internet Explorer\iexplore.exe", $Url, "", "", @SW_Minimize) Any ideas? Are you guys seeing the syntax error in Scite when using "AU3Check"/"SyntaxCheck Prod"? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now