Jump to content

Double quotes vs single quotes


Gyba
 Share

Recommended Posts

$source = BinaryToString(InetRead('https://mypage.com', 1))

$string = StringRegExp($source, "javascript:GoToRealm('pki')", 3)

For $a In $string
    ConsoleWrite($a & @CRLF)
Next

What I am trying to do is to search in a web page a button and click it. In IE developer console the button looks like this:

<a class="button" style="left: 54px; background-color: rgb(153, 153, 153);" href="javascript:GoToRealm('pki');">login</a>

I have 4 buttons in total, 2 of them looking very similar:

<a class="button" style="left: 54px; background-color: rgb(153, 153, 153);" href="javascript:GoToRealm('pki');">login</a>

<a class="button" style="left: 54px; background-color: rgb(153, 153, 153);" href="javascript:GoToRealm('pkissl');">login</a>

So I cannot search for "pki" only. 

Link to comment
Share on other sites

Maybe you can try this.

$source = StringReplace(BinaryToString(InetRead('https://mypage.com', 1)), "'", "&squo;")
$string = StringRegExp($source, "javascript:GoToRealm(&squo;pki&squo;)", 3)

For $a In $string
    ConsoleWrite(StringReplace($a, "&squo;", "'") & @CRLF)
Next





 






 

Edited by CYCho
Link to comment
Share on other sites

  • Moderators

Gyba,

In future, do NOT hijack 11 year old threads - even if they are vaguely connected with your question. Just start a new thread as I have now done for you.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

1 minute ago, Melba23 said:

Gyba,

In future, do NOT hijack 11 year old threads - even if they are vaguely connected with your question. Just start a new thread as I have now done for you.

M23

Ok, I thought the opening of too many new topics might be considered spam as long as there are similar topics discussed on the forum. Will take in consideration your advice in the future. Thank you.

Link to comment
Share on other sites

1 hour ago, CYCho said:

Maybe you can try this.

$source = StringReplace(BinaryToString(InetRead('https://mypage.com', 1)), "'", "&squo;")
$string = StringRegExp($source, "javascript:GoToRealm(&squo;pki&squo;)", 3)

For $a In $string
    ConsoleWrite(StringReplace($a, "&squo;", "'") & @CRLF)
Next





 
 

Thanks for the suggestion. As I do this to get used to AutoIt I decided to go with the second button as it is unique on the page and easier to locate (pkissl). No my problem is: how to click it?

I tried something like this:

 

$source = BinaryToString(InetRead('https://mypage.com', 1))

$string = StringRegExp($source, "pkissl", 3)

For $a In $string
    ConsoleWrite($a & @CRLF)
Next

_IELinkClickByText($source, "pkissl")

It doesn't work :(.  Any suggestion? 

As can be seen it the HTML code I provided above, this is not a regular link, it has some javascript behind. Does this matters in any way?

Thank you.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...