Jump to content

Get Url from Opera browser


Recommended Posts

Hi all,

Here is function on delphi, this function is allow to get the URL from current page (tab) of Opera browser:

function Get_URL(Servicio: string): string;
var
Cliente_DDE: TDDEClientConv;
temp: PChar;      
begin
Result := '';
Cliente_DDE:= TDDEClientConv.Create( nil );
with Cliente_DDE do
begin
  SetLink( Servicio,'WWW_GetWindowInfo');
  temp := RequestData('0xFFFFFFFF');
  Result := StrPas(temp);
  StrDispose(temp);  // <<-- Предотвращаем утечку памяти
  CloseLink;
end;
Cliente_DDE.Free;
end;

It is possible to make such function on AutoIT?

Thanks.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Hi all,

Here is function on delphi, this function is allow to get the URL from current page (tab) of Opera browser:

function Get_URL(Servicio: string): string;
var
Cliente_DDE: TDDEClientConv;
temp: PChar;      
begin
Result := '';
Cliente_DDE:= TDDEClientConv.Create( nil );
with Cliente_DDE do
begin
  SetLink( Servicio,'WWW_GetWindowInfo');
  temp := RequestData('0xFFFFFFFF');
  Result := StrPas(temp);
  StrDispose(temp);  // <<-- Предотвращаем утечку памяти
  CloseLink;
end;
Cliente_DDE.Free;
end;

It is possible to make such function on AutoIT?

Thanks.

look here, but i dont think that window.opera is the object in 9.22 version...
Link to comment
Share on other sites

Is there other Opera object documentation available?

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

  • 2 months later...

Ok, here it is (thanks to amel27)...

#include <Array.au3>

$Ret = OperaOpenGetURL("", -1, 1)
_ArrayDisplay($Ret)

;===============================================================================
;
; Function Name:  OperaOpenGetURL()
;
; Parameter(s):     $sURL           - [optional] Address of page to open,
;                                   if this is empty string (default), then returned Url from address field of particular tab.
;                   $hWin           - [optional] Number of tab:
;                                       -1 = Current tab.
;                                       0 = New tab (when opening).
;                   $RetType        - [optional] Definds returned value:
;                                       0 = String with Title and URL address.
;                                       1 = Array with 3 elements...
;                                           [0] = Title
;                                           [1] = URL address
;                                           [2] = String with Title And URL address.
;                   $iWait - [optional] Waiting Timeout in milliseconds, on overload will return an error.
;
; Requirement(s):   None
; Return Value(s):  On Success -  See 'Parameter(s)'.
;                   On Failure -  Empty string and set @error as following:
;                       1 = Error to open Dll (user32.dll)
;                       2 = Error Initializing DDE (@extended include more details about the returned value from DllCall).
;                       3 = Othe DDE Errors (@extended include more details about the returned value from DllCall).
; Author(s):        amel27
;
;=====================================================================
Func OperaOpenGetURL($sURL = "", $hWin = -1, $RetType = 0, $iWait = 10000)
    Local $ret, $err, $uIdInst = DllStructCreate("int")
    Local $hServer[1], $hTopic[1], $hItem[1], $hConv[1], $hData[1], $sData[1]
    Local $sTopic = "WWW_OpenURL", $sItem = $sURL & ',,0x' & Hex($hWin)
    If $sURL='' Then
        $sTopic = "WWW_GetWindowInfo"
        $sItem = "0x" & Hex($hWin)
    EndIf
    Local $hDll = DllOpen("user32.dll")
    If $hDll=-1 Then Return SetError(1, 0, "") ; Error to open Dll
    $ret = DllCall("user32.dll", "int", "DdeInitialize", "ptr", DllStructGetPtr($uIdInst), "ptr", 0, "int", 0, "int", 0)
    If $ret[0] Then Return SetError(2, $ret[0], "") ; Error Initializing DDE
    $hServer = DllCall($hDll, "int", "DdeCreateStringHandle", "int", DllStructGetData($uIdInst,1), "str", "opera", "int", 1004)
    If $hServer[0] Then
        $hTopic = DllCall($hDll, "int", "DdeCreateStringHandle", "int", DllStructGetData($uIdInst,1), "str", $sTopic, "int", 1004)
        If $hTopic[0] Then
            $hItem = DllCall($hDll, "int", "DdeCreateStringHandle", "int", DllStructGetData($uIdInst,1), "str", $sItem, "int", 1004)
            If $hItem[0] Then
                $hConv = DllCall($hDll, "int", "DdeConnect", "int", _
                    DllStructGetData($uIdInst,1), "int", $hServer[0], "int", $hTopic[0], "int", 0)
                If $hConv[0] Then
                    $hData = DllCall($hDll, "int", "DdeClientTransaction", "ptr", 0, "int", 0, _
                        "int", $hConv[0], "int", $hItem[0], "int", 1, "int", 0x20B0, "int", $iWait, "ptr", 0)
                    If $hData[0] Then
                        $sData = DllCall($hDll, "str", "DdeAccessData", "int", $hData[0], "ptr", 0)
                    EndIf
                EndIf
            EndIf
        EndIf
    EndIf
    $err = DllCall($hDll, "int", "DdeGetLastError", "int", DllStructGetData($uIdInst,1))
    If $hData[0] Then DllCall($hDll, "int", "DdeFreeDataHandle", "int", $hData[0])
    If $hConv[0] Then DllCall($hDll, "int", "DdeFreeDataHandle", "int", $hConv[0])
    If $hItem[0] Then DllCall($hDll, "int", "DdeFreeDataHandle", "int", $hItem[0])
    If $hTopic[0] Then DllCall($hDll, "int", "DdeFreeDataHandle", "int", $hTopic[0])
    If $hServer[0] Then DllCall($hDll, "int", "DdeFreeDataHandle", "int", $hServer[0])
    If $err[0] Then Return SetError(3, $err[0], "") ; Othe DDE Errors
    DllCall($hDll, "int", "DdeUninitialize", "int", DllStructGetData($uIdInst,1))
    DllClose($hDll)
    If $sURL = '' Then $sURL = StringRegExpReplace($sData[0], '^"([^"]*?)".*','"\1"')
    If $RetType = 1 Then
        Local $RetURL[3] = [$sData[0], $sURL, StringTrimLeft($sData[0], StringLen($sURL)+1)]
        Return $RetURL
    EndIf
    Return $sURL
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Great work! I need this very thing for a project I'm working on. Doing this in IE is very easy since we already have functions for IE but could someone show me how you would do this for Firefox? Since firefox is a bit tricky to deal with I don't have the faintest idea where to get stared.

AutoIt changed my life.

Link to comment
Share on other sites

I've just finished a generic UDF library for Windows DDE (client and server).

Here: DDEML.

Edited by doudou

UDFS & Apps:

Spoiler

DDEML.au3 - DDE Client + Server
Localization.au3 - localize your scripts
TLI.au3 - type information on COM objects (TLBINF emulation)
TLBAutoEnum.au3 - auto-import of COM constants (enums)
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector - OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE 

Link to comment
Share on other sites

Great work! I need this very thing for a project I'm working on. Doing this in IE is very easy since we already have functions for IE but could someone show me how you would do this for Firefox? Since firefox is a bit tricky to deal with I don't have the faintest idea where to get stared.

Changing

$hServer = DllCall($hDll, "int", "DdeCreateStringHandle", "int", DllStructGetData($uIdInst,1), "str", "[b]opera[/b]", "int", 1004)oÝ÷ ÚÚºÚ"µÍÌÍÚÙHØ[
    ÌÍÚ  ][ÝÚ[ ][ÝË  ][ÝÑPÜX]TÝ[Ò[I][ÝË   ][ÝÚ[ ][ÝËÝXÝÙ]]J    ÌÍÝRY[ÝJK   ][ÝÜÝ][ÝË  ][ÝÖØYYÞËØI][ÝË ][ÝÚ[ ][ÝËL

works for me.

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...