Code Monkey home page Code Monkey logo

Comments (7)

thqby avatar thqby commented on August 10, 2024

Map supports case sensitivity, while object is not case sensitive, although it is rare to have keys with different cases at the same time.
And run Map.Prototype.DefineProp('__get', {call: Map.Prototype.Get}), you can use map just like object.

from ahk2_lib.

dmtr99 avatar dmtr99 commented on August 10, 2024

Interesting trick, thanks a lot.
Strange how it stays case sensitive, or you need to set the CaseSense Off before filling the object. in some strange cases you would indeed lose data and that is indeed a disadvantage to this approach, and maybe it is better to keep the code cleaner.

oMap := Map()
oMap.CaseSense := "Off"
oMap.Set("Red", "ff0000" , "Green", "00ff00", "Deep Blue", "0000ff")
oMap.DefineProp('__get', { call: oMap.Get })
MsgBox("oMap.red:" oMap.red "`noMap.Red:" oMap.Red)

from ahk2_lib.

dmtr99 avatar dmtr99 commented on August 10, 2024

I however have another question, I want to connect to chrome without opening a new tab, but it seems this version always opens a new tab.

If I remember correctly, I used to connect to Chrome with:
PageInst := Chrome.GetPage()

But I now get the error "This value of type ''Class" has no method named "GetPage".

This code seems to work, but always opens a new tab:

ChromeInst :=  Chrome()
ChromeTab := ChromeInst.GetPage()

from ahk2_lib.

thqby avatar thqby commented on August 10, 2024

Use an existing browser that starts in debug mode?

from ahk2_lib.

dmtr99 avatar dmtr99 commented on August 10, 2024

Yes, I have the habit to run my browser always in debug mode. In the V1 version you could connect to the existing debug window with this code.

from ahk2_lib.

thqby avatar thqby commented on August 10, 2024

This problem has been fixed. Chrome.FindInstances

from ahk2_lib.

dmtr99 avatar dmtr99 commented on August 10, 2024

Tested and approved.

Just for clarity, my previous code still does not work.

this seems to work perfectly:

ChromeInst := Chrome.FindInstances()
ChromeTab := ChromeInst.GetPage()
result := ChromeTab.Evaluate("window.location.href")
msgbox(result["value"])

from ahk2_lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.