Jump to content

Recommended Posts

Posted

Do you have any sample on how IUIAutomation do this similar task? so I can study this approach.

Do you have any suggestions?
Thank you very much for any suggestions (^v^)

 

Posted
1 hour ago, Jos said:

So what do you want to use: AutoIt3 or powershell since you cross posted the same question in both?

Jos

I prefer powershell or batchfile, could this downloaded task be implemented by scripting? Please help

Do you have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

 

  • Developers
Posted

Have you done as proposed and looked at 

8 hours ago, Earthshine said:

 Look up IUIAutomation.

... Doubt anybody will code it for you unless you give it a start yourself first and have something to show us. ;)
The other option could be to check out WinHttp.au3 by @trancexx.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

Based on following image, it is hard to find the source link related to Excel file for download.

So it is hard to find where to start. I cannot even find following function exportFutures() at all.

function() {
  that._exportFutures();
}

Could you please give me any hint?
Thanks, to everyone very much for any suggestions (^v^)

 

 

Export2.png

Edited by oemript
Posted (edited)
9 hours ago, Danp2 said:

It's located in equity.js AFAICS.

 

I find the source code, but there is no direct link to access the file, which go through a lot of coding in between.  I would like to download the files using script, at this stage, I find out the working paths, but get no idea on how to convert into PowerShell or BatchFile script.  Does anyone have any suggestions on what I can do next?

 

view-source:https://www.hkex.com.hk/lhkexw/js/equity.js

//export to excel future
        that.$equity_future.find(".ete").on('click',function(){
            that._exportFutures();
        });

//export futures
    _exportFutures: function() {
        var that=this;
        
        var span=that.$hsirow.find(".interval").attr("data-id");
        var interval=that.$hsirow.find(".hsichart").attr("data-id");
        var ric=that.$equity_future.find("table#equity_future").attr("data-id");
        that.$pageobj.loaddata("getchartdata2", "getchartdata2",
        {
            "span": span,
            "int": interval,
            "ric": ric,
            "token": LabCI.getToken()
        },
        function(result) {
//          console.log(result.data.datalist);
            var html='';
            var flag=that.$hsirow.find(".hsichart .period.selected").html();
            if(flag == '1 D' || flag == '5 D'){
                html+='<tr>'+
                    '<th class="">Time</th>'+
                    '<th class="">Last Traded Price</th>'+
                    '<th class="">Volume</th>'+
                    '<th class="">Open Interest</th>' + 
                '</tr>';
                html+=that._exportFuturesHtml(result.data.datalist,0);
            }else{
                html+='<tr>'+
                    '<th class="">Time</th>'+
                    '<th class="">Settlement Price</th>'+
                    '<th class="">Volume</th>'+
                    '<th class="">Open Interest</th>' + 
                '</tr>';
                html+=that._exportFuturesHtml(result.data.datalist,1);
            }
            
            that.$equity_future.find("#equity_future_export").html(html);
            
            //export
            that._eTTE('equity_future_export','xlsx',''+that.product+'_Futures');
         //  (1)'equity_future_export', (2)'xlsx',(3)''+that.product+'_Futures'); 
         //  there is only 3 parameters instead of 4, would it be correct?
        },
        0,
        {
            datatype: "jsonp"
        });
    },
    _s2ab : function(s){
        if(typeof ArrayBuffer !== 'undefined') {
            var buf = new ArrayBuffer(s.length);
            var view = new Uint8Array(buf);
            for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
            return buf;
        }else{
            var buf = new Array(s.length);
            for (var i=0; i!=s.length; ++i) buf[i] = s.charCodeAt(i) & 0xFF;
            return buf;
        }
    },
_eTTE : function(id, type, name, fn){
        // id = equity_future_export
        // type = xlsx
        // name = where is "'+that.product+'_Futures" defined? There is no _Futures function here.
        // fn = where is "fn" defined? there is only 3 parameter when calling eTTE function? so no fn?
    	var that=this;
        var wb = XLSX.utils.table_to_book(document.getElementById(id), {sheet:"Sheet JS"});
        // what is wb as returned result?
        var wbout = XLSX.write(wb, {bookType:type, bookSST:true, type: 'binary'});
        // what is wbout as returned result?
        var fname = fn || name + '.' + type;
        // what is fname as returned result? fn or ???.xlsx
        try {
            saveAs(new Blob([that._s2ab(wbout)],{type:"application/octet-stream"}), fname);
        } catch(e) { if(typeof console != 'undefined') console.log(e, wbout); }
        return wbout;
    },

 

Do you have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

 

Edited by oemript
Posted (edited)

I think all you have to do is click that HTTP link that that function is linked to and you can do that with that winhttp.au3 file probably 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Posted (edited)
53 minutes ago, Earthshine said:

I think all you have to do is click that HTTP link that that function is linked to and you can do that with that winhttp.au3 file probably 

Could you please provide any example to show how winhttp.au3 achieve the download process?

It would be the best if it could be done using PowerShell or BatchFile.

Do you have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

 

Edited by oemript
Posted (edited)

Would it be possible back to the JQuery coding?

I have highlight what I don't understand in red color

Could you please help?
Thanks, to everyone very much for any suggestions (^v^)

 

Edited by oemript
Posted (edited)

Does anyone have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

 

Edited by oemript
Posted (edited)
10 minutes ago, Earthshine said:

Is there a function you can call that takes a html link and clicks on it in winhttp.au3? 🧐

I would like to know on what winhttp.au3 is, is winhttp.au3 a AutoIT program for download? just like PowerShell?

If yes, I prefer using PowerShell.  At this moment, I need to understand on what JQuery do first, could you please help for those highlight area which I don't understand?

Do you have any suggestions?

I am very appreciated your help for this learning process.
Thanks, to everyone very much for any suggestions (^v^)

 

 

Edited by oemript
Posted

I would look into WinHTTP for coding implementation. 

if there is a direct link provided + cookies format, then that is easy and go directly to coding implementation.

such as www.abc.com/temp.xls&cookies=hd3d74j2

Since there is no directly link for download from HKEX,  firstly I need to understand on what JQuery coding do as described above before implementation.

Could you please help on what JQuery coding do on highlight area?

I am very appreciated your help for this learning process.
Thanks, to everyone very much for any suggestions (^v^)

Posted

Do you have any suggestions?

I am very appreciated your help for this learning process.
Thanks, to everyone very much for any suggestions (^v^)

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...