Alpha Video Training
Results 1 to 8 of 8

Thread: getting non-alpha window titles and navigating to non-alpha windows

  1. #1
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,168

    Default getting non-alpha window titles and navigating to non-alpha windows

    I have searched hi and low and have tried to use various sys functions in all different ways to try and get the window navigate from Alpha desktop app to an open web page. I am trying to script opening a web page, going back to alpha, do something in alpha, then go back to the web page.

    If you open a website with sys_open() how do you get the window title of that window so you can use sys_focus_put() to navigate back to that page? Or any other possible method. Also, is there a method that can check to see if a non-alpha window exists. I sense somehow sys_id_enum() fits in here but having a hard time getting it to work. Thanks.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  2. #2
    "Certified" Alphaholic Clunes's Avatar
    Real Name
    Mark Pearson
    Join Date
    Jan 2010
    Location
    Brisbane, Queensland, Australia
    Posts
    1,001

    Default Re: getting non-alpha window titles and navigating to non-alpha windows

    Not sure if this helps, but copy the following into a new code. When you run it opens a web page in an xdialog and then populates a set number of fields

    It may give you some help in your directions. While it open a web page for an Australian site, there are no issues with the data etc as it does not take you past the point. It was simply my way of controlling a user to enter standard registration details. In this case it only uses my details.

    From my point of view, it does expend the power of the xdialog

    'Date Created: 04-Oct-2011 09:12:18 AM
    'Last Updated: 13-Nov-2012 01:33:15 PM
    'Created By : MXpearso
    'Updated By : mxpearso
    'Create an XDialog dialog box to prompt for parameters.
    DIM myurl as P
    dim myurl.object as p
    dim myurl.class as c
    dim ww as n


    DIM SHARED Coy as C
    dim lname as c
    dim fname as c
    dim userid1 as c
    dim userpw as c
    DIM SHARED Add1 as C
    DIM SHARED Add2 as C
    DIM SHARED City as C
    DIM SHARED State as C
    DIM SHARED zip as C
    DIM SHARED ph as C
    DIM SHARED fax as C
    DIM SHARED mob as C
    DIM SHARED Email as C
    DIM SHARED Web as C
    DIM SHARED ABN as C
    DIM SHARED GST as n
    DIM SHARED GST1 as C
    DIM SHARED BSB as C
    DIM SHARED accno as C
    DIM SHARED accname as C
    DIM SHARED varC_resultpro as C
    dim myt as p
    dim ch1 as n
    'myt = table.open("defaults",FILE_RO_SHARED)
    Coy = "One Stop Solutions" 'alltrim(myt.company)
    fname = "Mark" 'alltrim(myt.first_name)
    lname = "Pearson" ' alltrim(myt.last_name)
    Add1 = "8 Benton Crt" 'alltrim(myt.street)
    Add2 = "" 'alltrim(myt.street2)
    City = "Douglas" 'alltrim(myt.city)
    State = "Qld" 'alltrim(myt.state)
    zip = "4814" ' alltrim(myt.zip)
    ph = "0747757013" 'alltrim(myt.phone)
    fax = "" ' alltrim(myt.fax)
    mob = "0434602372"'alltrim(myt.mobile)
    Email = "mark.pearson@onestopsolutions.com.au" 'alltrim(myt.email)
    userid1 = "Mark" 'alltrim(myt.userid)
    userpw = "******" 'alltrim(myt.upw)
    'myt.close()
    if coy = "" .or. fname = "" .or. lname = "" .or. add1 = "" .or. city = "" .or. state = "" .or. zip = "" .or. ph = "" .or. mob = "" .or. email = "" .or. userid1 = "" .or. userpw = "" then
    ui_msg_box("Need to complete a valid propfile","Not all profile fields marked with '*' are filled in. You must do this first.")
    script_play("profile")
    end
    end if

    myurl.class = "shell.explorer.2"

    dim myurl.events as c
    myurl.events = <<%code%
    function beforenavigate2 as v (pDisp as P,URL as A,Flags as A,TargetFrameName as A,PostData as A,Headers as A,Cancel as L)
    end function

    function clienttohostwindow as v (CX as N,CY as N)
    end function

    function commandstatechange as v (Command as N,Enable as L)
    end function

    function documentcomplete as v (pDisp as P,URL as A)
    myurl.object.document.getElementById("firstname")=fname
    myurl.object.document.getElementById("lastname")=lname
    myurl.object.document.getElementById("company")=coy
    myurl.object.document.getElementById("regusername")=userid1
    myurl.object.document.getElementById("regpassword")=userpw
    myurl.object.document.getElementById("confirm")=userpw
    myurl.object.document.getElementById("address1")=add1
    myurl.object.document.getElementById("address2")=add2
    myurl.object.document.getElementById("suburb")=city
    myurl.object.document.getElementById("state")=state
    myurl.object.document.getElementById("postcode")=zip
    myurl.object.document.getElementById("phone")=ph
    myurl.object.document.getElementById("email")=email
    myurl.object.document.getElementById("mobile")=mob
    myurl.object.document.getElementById("sender")=mob

    end function

    function downloadbegin as v ()
    end function

    function downloadcomplete as v ()
    end function

    function filedownload as v (ActiveDocument as L,Cancel as L)
    end function

    function navigatecomplete2 as v (pDisp as P,URL as A)
    end function

    function navigateerror as v (pDisp as P,URL as A,Frame as A,StatusCode as A,Cancel as L)
    end function

    function newwindow2 as v (ppDisp as OLE::webbrowser::IWebBrowser,Cancel as L)
    end function

    function newwindow3 as v (ppDisp as OLE::webbrowser::IWebBrowser,Cancel as L,dwFlags as N,bstrUrlContext as C,bstrUrl as C)
    end function

    function onfullscreen as v (FullScreen as L)
    end function

    function onmenubar as v (MenuBar as L)
    end function

    function onquit as v ()
    end function

    function onstatusbar as v (StatusBar as L)
    end function

    function ontheatermode as v (TheaterMode as L)
    end function

    function ontoolbar as v (ToolBar as L)
    end function

    function onvisible as v (Visible as L)
    end function

    function printtemplateinstantiation as v (pDisp as P)
    end function

    function printtemplateteardown as v (pDisp as P)
    end function

    function privacyimpactedstatechange as v (bImpacted as L)
    end function

    function progresschange as v (Progress as N,ProgressMax as N)
    end function

    function propertychange as v (szProperty as C)
    end function

    function setphishingfilterstatus as v (PhishingFilterStatus as N)
    end function

    function setsecurelockicon as v (SecureLockIcon as N)
    end function

    function statustextchange as v (Text as C)
    end function

    function titlechange as v (Text as C)
    end function

    function updatepagestatus as v (pDisp as P,nPage as A,fDone as A)
    end function

    function windowclosing as v (IsChildWindow as L,Cancel as L)
    end function

    function windowsetheight as v (Height as N)
    end function

    function windowsetleft as v (Left as N)
    end function

    function windowsetresizable as v (Resizable as L)
    end function

    function windowsettop as v (Top as N)
    end function

    function windowsetwidth as v (Width as N)
    end function

    function windowstatechanged as v (dwWindowStateFlags as N,dwValidFlagsMask as N)
    end function


    %code%
    DIM SHARED varC_result as C
    DIM myurl_url as c
    myurl_url = "https://www.smsbroadcast.com.au/signup"
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_modeless_dlg_box("Register",<<%dlg%
    {startup=init}
    {can_exit=go1}
    {on_activate=fil1}
    {stretch=width,height}


    {region}
    {activex=100,40myurl?.t.};
    {endregion};

    %dlg%,<<%code%
    If a_dlg_button = "go1" then

    ui_modeless_dlg_close("Register")


    end if



    if a_dlg_button="document" then
    a_dlg_button=""
    showvar(properties_enum(myurl.object.document),"document")
    end if
    if a_dlg_button = "init" then
    a_dlg_button = ""
    a_dlg_button = ""
    hourglass_cursor(.t.)
    if myurl_url <> "" then
    on error goto myurl_error
    myurl.object.navigate(shellExplorer_url(myurl_url))
    on error goto 0
    end if
    hourglass_cursor(.f.)

    end if
    end

    myurl_error:
    ui_msg_box("Error","Invalid URL.",UI_STOP_SYMBOL)
    end
    %code%)
    UI_DLG_MAXIMIZE("Register")
    -----------------------------------------------
    Regards
    Mark Pearson
    mark.pearson@onestopsolutions.com.au
    Youtube channel
    Website

  3. #3
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,168

    Default Re: getting non-alpha window titles and navigating to non-alpha windows

    Thanks Mark,
    That's pretty intense code. I'll have to pour over it for a while and see if I can understand it. Did you write that code, or did that come from a genie or a resource?

    Thanks a gain.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  4. #4
    "Certified" Alphaholic Clunes's Avatar
    Real Name
    Mark Pearson
    Join Date
    Jan 2010
    Location
    Brisbane, Queensland, Australia
    Posts
    1,001

    Default Re: getting non-alpha window titles and navigating to non-alpha windows

    I can't claim full ownership. I got a lot of help from putting an activx control onto a form and the looked at the functions in the code explorer. The I matched by trial and error with adding a web browser to an xdialog using the xdialog genie and then converting to xbasic.

    Took some time but I got there. My real issue with this example was the getting field names from teh source code of the web page. The page was embedded, so sort had to get to at first.
    -----------------------------------------------
    Regards
    Mark Pearson
    mark.pearson@onestopsolutions.com.au
    Youtube channel
    Website

  5. #5
    Member
    Real Name
    Bill Jordan
    Join Date
    Feb 2001
    Posts
    279

    Default Re: getting non-alpha window titles and navigating to non-alpha windows

    Hi Mark,
    Very cool. I tried it but on a site with dropdowns and dynamic content (you click on the dropdown and when you select something other fields appear on the form). Let me preface what follows with "I know next to nothing about code or html". Is there a way to code this so the dropdown opens and the other fields that appear get populated?

    I'm assuming I have to look at the html to get the field names so I'm looking at the input line, for example;
    <input name="ctl00$ctl00$body$body$txtBarCode" type="text" maxlength="30" id="txtBarCode" /> and thinking the "id=" contains the pointer data for the "myurl.object.document.getElementById" in your code. Is this correct?

    Thanks,
    Bill

  6. #6
    "Certified" Alphaholic Clunes's Avatar
    Real Name
    Mark Pearson
    Join Date
    Jan 2010
    Location
    Brisbane, Queensland, Australia
    Posts
    1,001

    Default Re: getting non-alpha window titles and navigating to non-alpha windows

    I did this so long ago. I think you are corect. The id iswhat the code looks for on the page

    I am not sure what you mean about the drop down bit. Can you give ascreen shot or something. All fields get populated by their id. Is the drop down stoppling the code or something like that?
    -----------------------------------------------
    Regards
    Mark Pearson
    mark.pearson@onestopsolutions.com.au
    Youtube channel
    Website

  7. #7
    Member
    Real Name
    Bill Jordan
    Join Date
    Feb 2001
    Posts
    279

    Default Re: getting non-alpha window titles and navigating to non-alpha windows

    Mark, screenshot attached.
    Yes it does stop it by virtue of the fact that the fields we need to populate stay hidden on the form until the "not one of these?" link is pressed. If it's possible to send a left mouse click to it, in the code, then that would be a work around but I can't figure out how to do it.
    Thanks again,
    Bill


    order_form.png

  8. #8
    "Certified" Alphaholic Clunes's Avatar
    Real Name
    Mark Pearson
    Join Date
    Jan 2010
    Location
    Brisbane, Queensland, Australia
    Posts
    1,001

    Default Re: getting non-alpha window titles and navigating to non-alpha windows

    as a trial, try hard coding the result for the drop down field. This may trigger the rest of your options work. If this is the case and works, you may need to have a user interface that allows a step for selecting the result you want. I can help with that, if the test works
    -----------------------------------------------
    Regards
    Mark Pearson
    mark.pearson@onestopsolutions.com.au
    Youtube channel
    Website

Similar Threads

  1. Alpha Five Window
    By Kerry Bugger in forum Alpha Five Version 9 - Desktop Applications
    Replies: 4
    Last Post: 04-16-2011, 01:38 PM
  2. Browse Window Titles
    By DRW in forum Alpha Five Version 9 - Desktop Applications
    Replies: 7
    Last Post: 07-03-2008, 11:17 PM
  3. How to open a windows window in a alpha form?
    By Digitaled in forum Alpha Five Version 8
    Replies: 3
    Last Post: 03-29-2008, 10:43 PM
  4. Window Titles
    By Jeff, Richards in forum Alpha Five Version 5
    Replies: 9
    Last Post: 11-30-2003, 11:26 AM
  5. Can't window Alpha 5
    By Ronald Anusiewicz in forum Alpha Five Version 5
    Replies: 8
    Last Post: 01-07-2003, 04:49 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •