Jump to content
Sign in to follow this  
Gyba

Double quotes vs single quotes

Recommended Posts

Gyba

Hello,

How can I search for this string:

Quote

GoToRealm('pki');

If I tried the below combinations, both of them generated errors:

Quote

 

"GoToRealm(''pki'');"

"GoToRealm("'pki'");"

 

Any ideas? 

Thank you.

Share this post


Link to post
Share on other sites
SplashFlo

Try  'GoToRealm(''pki'');'

Share this post


Link to post
Share on other sites
Gyba
1 minute ago, SplashFlo said:

Try  'GoToRealm(''pki'');'

Not working :(

Share this post


Link to post
Share on other sites
SplashFlo
2 minutes ago, Gyba said:

Not working :(

Can you post the part of the script where you seach for the string?

Share this post


Link to post
Share on other sites
Gyba
$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. 

Share this post


Link to post
Share on other sites
CYCho

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

Share this post


Link to post
Share on other sites
Melba23

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


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Gyba
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.

Share this post


Link to post
Share on other sites
Gyba
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.

Share this post


Link to post
Share on other sites
CYCho

I am not an expert either. I had difficulties in reading the text of a window created by  javascript. With help from this forum, I solved my problem with WebDriver. WebDriver may be a solution for you, too. You may like to take a look at below article.

 

Share this post


Link to post
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
Sign in to follow this  

×