PB.Ex WebGadget (Windows) (WebKit)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by zikitrake »

Thank you RSBasic. It's working nice.

A question to all users of it:

In the following code a text is sent to DeepL but it is not translated until you click on the TextArea source and press Enter.
How is it possible to make a simulation of this operation (send click and type "Enter")

I use the following code to simulate the enter key, but it doesn't work :S

Code: Select all

  ;Focus and press Enter
  script$ +  " textAreaOne.focus();" + #CRLF$
  script$ + ~" const ke = new KeyboardEvent(\"keydown\", {" + #CRLF$
  script$ +  " bubbles: true, cancelable: true, keyCode: 13});" + #CRLF$
  script$ +  " textAreaOne.dispatchEvent(ke);" + #CRLF$
    

Main Code

Code: Select all

;Version: 1.1.0.0

EnableExplicit

Global PBEx_WebGadget

#PBEx_WebGadgetEx_Version$ = "1.1.0.0"
#PB_Web_Zoom               = 100

CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
  PBEx_WebGadget = OpenLibrary(#PB_Any, "PB.Ex_WebGadget_x86.dll")
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
  PBEx_WebGadget = OpenLibrary(#PB_Any, "PB.Ex_WebGadget_x64.dll")
CompilerEndIf


Prototype WebGadgetEx(ID, X, Y, Width, Height, URL.p-Unicode, ParentWindowID, ErrorOutput)
Global WebGadgetEx.WebGadgetEx = GetFunction(PBEx_WebGadget, "WebGadgetEx")
Prototype SetWebGadgetExText(ID, URL.p-Unicode, ErrorOutput)
Global SetWebGadgetExText.SetWebGadgetExText = GetFunction(PBEx_WebGadget, "SetWebGadgetExText")
Prototype GetWebGadgetExText(ID, Output, ErrorOutput)
Global GetWebGadgetExText.GetWebGadgetExText = GetFunction(PBEx_WebGadget, "GetWebGadgetExText")
Prototype SetWebGadgetExState(ID, State, ErrorOutput)
Global SetWebGadgetExState.SetWebGadgetExState = GetFunction(PBEx_WebGadget, "SetWebGadgetExState")
Prototype SetWebGadgetExItemText(ID, Entry, Text.p-Unicode, ErrorOutput)
Global SetWebGadgetExItemText.SetWebGadgetExItemText = GetFunction(PBEx_WebGadget, "SetWebGadgetExItemText")
Prototype GetWebGadgetExItemText(ID, Entry, Output, ErrorOutput)
Global GetWebGadgetExItemText.GetWebGadgetExItemText = GetFunction(PBEx_WebGadget, "GetWebGadgetExItemText")
Prototype FreeWebGadgetEx(ID, ErrorOutput)
Global FreeWebGadgetEx.FreeWebGadgetEx = GetFunction(PBEx_WebGadget, "FreeWebGadgetEx")
Prototype IsWebGadgetEx(ID, ErrorOutput)
Global IsWebGadgetEx.IsWebGadgetEx = GetFunction(PBEx_WebGadget, "IsWebGadgetEx")
Prototype WebGadgetExWidth(ID, ErrorOutput)
Global WebGadgetExWidth.WebGadgetExWidth = GetFunction(PBEx_WebGadget, "WebGadgetExWidth")
Prototype WebGadgetExHeight(ID, ErrorOutput)
Global WebGadgetExHeight.WebGadgetExHeight = GetFunction(PBEx_WebGadget, "WebGadgetExHeight")
Prototype WebGadgetExX(ID, ErrorOutput)
Global WebGadgetExX.WebGadgetExX = GetFunction(PBEx_WebGadget, "WebGadgetExX")
Prototype WebGadgetExY(ID, ErrorOutput)
Global WebGadgetExY.WebGadgetExY = GetFunction(PBEx_WebGadget, "WebGadgetExY")
Prototype WebGadgetExID(ID, ErrorOutput)
Global WebGadgetExID.WebGadgetExID = GetFunction(PBEx_WebGadget, "WebGadgetExID")
Prototype HideWebGadgetEx(ID, State, ErrorOutput)
Global HideWebGadgetEx.HideWebGadgetEx = GetFunction(PBEx_WebGadget, "HideWebGadgetEx")
Prototype ResizeWebGadgetEx(ID, X, Y, Width, Height, ErrorOutput)
Global ResizeWebGadgetEx.ResizeWebGadgetEx = GetFunction(PBEx_WebGadget, "ResizeWebGadgetEx")
Prototype HideWebGadgetExDevTools(ID, State, ErrorOutput)
Global HideWebGadgetExDevTools.HideWebGadgetExDevTools = GetFunction(PBEx_WebGadget, "HideWebGadgetExDevTools")
Prototype ExecuteWebGadgetExJavaScript(ID, Code.p-Unicode, Output, ErrorOutput)
Global ExecuteWebGadgetExJavaScript.ExecuteWebGadgetExJavaScript = GetFunction(PBEx_WebGadget, "ExecuteWebGadgetExJavaScript")
Prototype BindWebGadgetExJavaScript(ID, PBProcedureName.p-Unicode, PBProcedureHandle, PID, ErrorOutput)
Global BindWebGadgetExJavaScript.BindWebGadgetExJavaScript = GetFunction(PBEx_WebGadget, "BindWebGadgetExJavaScript")
Prototype GetWebGadgetExAttribute(ID, Attribute, ErrorOutput)
Global GetWebGadgetExAttribute.GetWebGadgetExAttribute = GetFunction(PBEx_WebGadget, "GetWebGadgetExAttribute")
Prototype SetWebGadgetExAttribute(ID, Attribute, Value, ErrorOutput)
Global SetWebGadgetExAttribute.SetWebGadgetExAttribute = GetFunction(PBEx_WebGadget, "SetWebGadgetExAttribute")
Prototype EnableRemoteDebugger(Port, ErrorOutput)
Global EnableRemoteDebugger.EnableRemoteDebugger = GetFunction(PBEx_WebGadget, "EnableRemoteDebugger")
Prototype SetWebGadgetExSetUserAgent(UserAgent.p-Unicode, ErrorOutput)
Global SetWebGadgetExSetUserAgent.SetWebGadgetExSetUserAgent = GetFunction(PBEx_WebGadget, "SetWebGadgetExSetUserAgent")

Define Output$      = Space(1000000)
Define ErrorOutput$ = Space(128)

Procedure Delay2(waitTime.f)
  Protected tini.f
  tini = GetTickCount_()
  Repeat
    WindowEvent()
  Until GetTickCount_() - tini > waitTime
EndProcedure

If OpenWindow(0, 0, 0, 1200, 768, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ;SetWebGadgetExSetUserAgent("PureBasic Bot", @ErrorOutput$)
  
  WebGadgetEx(1, 0, 20, 1200, 748, "https://www.deepl.com/translator", WindowID(0), @ErrorOutput$)
  delay2(5000)
  
  
  Define textOrigin$ = "Hello, World.\n"
  
  Define script$ = "textAreaOne = document.querySelector('#dl_translator > div.lmt__sides_container > div.lmt__side_container.lmt__side_container--source > div.lmt__textarea_container > div > textarea');" + #CRLF$
  
  script$ + "textAreaOne.innerText = '" + textOrigin$ + "';"
  
  ;Focus and press Enter
  script$ +  " textAreaOne.focus();" + #CRLF$
  script$ + ~" const ke = new KeyboardEvent(\"keydown\", {" + #CRLF$
  script$ +  " bubbles: true, cancelable: true, keyCode: 13});" + #CRLF$
  script$ +  " textAreaOne.dispatchEvent(ke);" + #CRLF$
  
  
  ExecuteWebGadgetExJavaScript(1, script$, @Output$, @ErrorOutput$)
  Debug ErrorOutput$
  
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        CloseLibrary(PBEx_WebGadget)
        End
    EndSelect
  ForEver
EndIf
Thank you in advance
PureLust
Enthusiast
Enthusiast
Posts: 477
Joined: Mon Apr 16, 2007 3:57 am
Location: Germany, NRW

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by PureLust »

Hi Ray,

any chance to get or bind Events like #PB_EventType_TitleChange or #PB_EventType_DownloadEnd?

Thanx and Greets, PL.
[Dynamic-Dialogs] - create complex GUIs the easy way
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)
Mike Yurgalavage
Enthusiast
Enthusiast
Posts: 118
Joined: Thu May 17, 2007 8:35 pm
Location: USA

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by Mike Yurgalavage »

Using actual chrome browser, going to this page:

http://www.html5videoplayer.net/html5vi ... ideo-test/

You can play the video.

Using that link from within the .pb test program the video cannot be played.

https://html5test.com/

from within the .pb test program, says

H.264 support - NO

But within Chrome browser says

H.264 support - YES

Testing both chrome browser and the test .pb at version Chrome/79.0.3945.130

any idea what is missing in your version of chromium that is not allowing the video to play? Is there a .dll missing or not up to date? Or some other aspect of the the included files that needs to be updated? Both are displaying that version (actual browser and the .pb example when runs), but the .pb example is missing H.264 support. In fact that is the ONLY difference reported in the two at https://html5test.com/.

I hope you can help with this, as.. other than not being able to have the videos on my site work, everything else seems to be working. Maybe the core subprocess or the pb.ex .dll ?

EDIT: I saw this?!

https://stackoverflow.com/questions/595 ... mp4-videos
https://stackoverflow.com/questions/295 ... -framework

https://gist.github.com/jedi4ever/d0956 ... 2b331da367

Is it possible to get latest chromium compiled with wrapper updated by you and add this ability?

Many sites are using html5 and videos encoded with H264. The compile of the chromium framework you did does not have this support. However there are compiles that DO have it, and this would be very helpful to many of us!

I would do it myself but I am not sure exactly the steps you followed to get the final CEF and chromium files necessary that your wrapper .dll is looking for.

This link may give you more information:

https://superuser.com/questions/1111994 ... 64-support

For instance the version of chromium here:

https://chromium.woolyss.com/f/chrlaunc ... oogled.zip

On this page:

https://chromium.woolyss.com/

was compiled and supports h264 codec, which you can check here:

https://html5test.com/

If I could just replace files from the Chromium bin to accomplish this I would, but apparently the entire CEF sharp project has to be redone, etc. and I do not know the steps. It probably would only take you a few minutes to download the new chromium that has h264 enabled in it already and recompile, etc.


best,
Mike
firace
Addict
Addict
Posts: 900
Joined: Wed Nov 09, 2011 8:58 am

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by firace »

Is anyone successfully using this library in their programs?
For some reason it stopped working for me a while ago (even the example code now silently fails to display the browser control)
Mike Yurgalavage
Enthusiast
Enthusiast
Posts: 118
Joined: Thu May 17, 2007 8:35 pm
Location: USA

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by Mike Yurgalavage »

firace wrote:Is anyone successfully using this library in their programs?
For some reason it stopped working for me a while ago (even the example code now silently fails to display the browser control)
No sure what happened to RSBasic, but I'd be willing to take this project over and continue it if I knew his steps and had access to his source and etc. and had some ideas what/how he is compiling the latest build of chrome, etc.

I've reached out to him here, and by email to no avail.

best,
mike
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by Kuron »

Mike Yurgalavage wrote:No sure what happened to RSBasic
He last posted a week ago, he should not be considered MIA, yet. :)
Best wishes to the PB community. Thank you for the memories. ♥️
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by zikitrake »

Hello, RSBasic. First of all, I hope everything goes well.
Is there any chance to upgrade to the latest version of CEFSharp?
Thanks in advance,
User avatar
Caronte3D
Addict
Addict
Posts: 1047
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by Caronte3D »

zikitrake wrote:Is there any chance to upgrade...
In case you don't get response, take a look to this thread, I think is related:
viewtopic.php?f=7&t=75898
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by zikitrake »

Caronte3D wrote: In case you don't get response, take a look to this thread, I think is related:
viewtopic.php?f=7&t=75898
Fantastic! Thanks for the information, I'll try it out!
Johanson
User
User
Posts: 40
Joined: Sat Aug 01, 2020 9:53 am

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by Johanson »

I'm impressed 'WebGadgetEx'; I'm using it for logging system (php, mySql).
After logging in, a page appears that displays: 'Name = John'.
So I can display:

Code: Select all

Debug GetWebGadgetExItemText (webgEx, #PB_Web_HtmlCode, @Output$, @ErrorOutput$)
=> <html><head></head><body>Name=John</body> </html>
But how do you detect that a page has been changed?
EventGadget () does not detect WebGadgetEx (...)
acabrera
New User
New User
Posts: 1
Joined: Mon May 03, 2021 3:34 pm

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by acabrera »

Is not working for me.

"The debugger executable quit unexpectedly"

;Version: 1.1.0.0

EnableExplicit

Global PBEx_WebGadget

#PBEx_WebGadgetEx_Version$ = "1.1.0.0"
#PB_Web_Zoom = 100

CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
PBEx_WebGadget = OpenLibrary(#PB_Any, "C:\Program Files (x86)\PureBasic\PureLibraries\UserLibraries\PB.Ex_WebGadget_x86.dll")
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
PBEx_WebGadget = OpenLibrary(#PB_Any, "C:\Program Files (x86)\PureBasic\PureLibraries\UserLibraries\PB.Ex_WebGadget_x64.dll")
CompilerEndIf


Any ideas?
fluent
User
User
Posts: 68
Joined: Sun Jan 24, 2021 10:57 am

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by fluent »

acabrera wrote: Mon May 03, 2021 4:29 pm Is not working for me.

"The debugger executable quit unexpectedly"

;Version: 1.1.0.0

EnableExplicit

Global PBEx_WebGadget

#PBEx_WebGadgetEx_Version$ = "1.1.0.0"
#PB_Web_Zoom = 100

CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
PBEx_WebGadget = OpenLibrary(#PB_Any, "C:\Program Files (x86)\PureBasic\PureLibraries\UserLibraries\PB.Ex_WebGadget_x86.dll")
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
PBEx_WebGadget = OpenLibrary(#PB_Any, "C:\Program Files (x86)\PureBasic\PureLibraries\UserLibraries\PB.Ex_WebGadget_x64.dll")
CompilerEndIf


Any ideas?

Sadly this project appears to be abandonware - I wouldn't spend time trying to make it work.
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by dagcrack »

Any chance the author could release the sources so the community could continue working on it?, doesn't have to be a github could just be a zip file.
I've been MIA for a few years, recently got back to the forums (just lurking around) I've been working on some small projects and almost every library / code thread I encounter has been sadly abandoned.

Great community but lots of dead code all around. I know most people have it in the back of their mind to profit out of their code; money is often a great motivator so that's probably why there are lots of announced projects with demos which are great but they hardly ever become anything due to lack of time, motivation, money. I'm not sure if there's an official community github but there should be (and I'm not a fan of github however it would centralize all libraries and make it easier for everyone to collaborate).

Code libraries could be nominated and those accepted would become main projects everyone could work on. Then again there's also a lot of great working code I'm just focusing on the dead portion.

If doable, collaborators could have a "tip jar" where anyone actively using the code could throw a couple bucks into. Redeeming this cash could be done through merchandising or an equal share throughout. Lastly a wish-list could be made and gifts could be randomly redeemed (we're talking small products such as mousepads, tshirts, so on). If money is no motivation then ignore this last portion.

Just an observation... I'll go back to the shadows now!

As per errors on this particular code I think all the files must reside within the root of your project, otherwise there's an issue with the resources and libraries. Clearly it was a work in progress.
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
Bitblazer
Enthusiast
Enthusiast
Posts: 736
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by Bitblazer »

I have seen an interesting approach at another development community. Users of a library would offer bounties for a specific task. Everybody could then get a shot at doing the task and claiming the bounty. If they dont succeed within xx weeks, the task and bounty is open again.

That way multiple people could work on libraries that many profit from and if a specific addition is important to somebody, a bounty could motivate any competent person to do the work and get some money from it.

I really liked that idea and a payment system should not be a problem anymore, thanks to paypal.

Plus - new developers have an incentive to learn skills that directly reward them with bounties. win-win
User avatar
jacdelad
Addict
Addict
Posts: 1473
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by jacdelad »

Who decides which project gets the bounty?
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Post Reply