简单网站css或js下载练习

tanzh 2023-8-15 1250

Code AardioLine:30复制
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
    • import win.ui;
    • /*DSG{{*/
    • var winform = win.form(text="下载网站css或js";right=664;bottom=290;max=false)
    • winform.add(
    • buttonClose={cls="button";text="退出";left=348;top=204;right=498;bottom=262;color=14120960;font=LOGFONT(h=-14);note=" ";z=4};
    • buttonSave={cls="button";text="保存";left=162;top=204;right=312;bottom=262;color=14120960;font=LOGFONT(h=-14);note=" ";z=2};
    • editUrl={cls="edit";left=79;top=36;right=538;bottom=182;edge=1;multiline=1;style=1539;z=1};
    • static={cls="static";text="下载网址(自动换行)";left=79;top=12;right=368;bottom=33;transparent=1;z=3}
    • )
    • /*}}*/
    • import process;
    • import inet.http;
    • http = inet.http()
    • winform.editUrl.text = "http://cdn.staticfile.org/layui/2.8.12/layui.js";
    • winform.buttonSave.oncommand = function(id,event){
    • path = "/"++string.match(winform.editUrl.text,".*\/(.*)")
    • string.save(path,http.get(url));
    • winform.msgbox("保存完成");
    • process.exploreSelect(path)
    • }
    • winform.buttonClose.oncommand = function(id,event){
    • win.quitMessage()
    • }
    • winform.show();
    • win.loopMessage();


    最新回复 (4)
    • 光庆 2023-8-15
      0 2
      顶顶更健康
    • 小肥羊 2023-8-16
      0 3

      两个建议哈。

      1、下载单文件可以用,inet.httpFile

      2、process.exploreSelect 在win11中实测是存在问题的,稳定性不太对

      Code AardioLine:34复制
    • 1.
    • 2.
    • 3.
    • 4.
    • 5.
    • 6.
    • 7.
    • 8.
    • 9.
    • 10.
    • 11.
    • 12.
    • 13.
    • 14.
    • 15.
    • 16.
    • 17.
    • 18.
    • 19.
    • 20.
    • 21.
    • 22.
    • 23.
    • 24.
    • 25.
    • 26.
    • 27.
    • 28.
    • 29.
    • 30.
    • 31.
    • 32.
    • 33.
    • 34.
      • import win.ui;
      • /*DSG{{*/
      • var winform = win.form(text="下载网站css或js";right=664;bottom=290;max=false)
      • winform.add(
      • buttonClose={cls="button";text="退出";left=348;top=204;right=498;bottom=262;color=14120960;font=LOGFONT(h=-14);note=" ";z=4};
      • buttonSave={cls="button";text="保存";left=162;top=204;right=312;bottom=262;color=14120960;font=LOGFONT(h=-14);note=" ";z=2};
      • editUrl={cls="edit";left=79;top=36;right=538;bottom=182;edge=1;multiline=1;style=1539;z=1};
      • static={cls="static";text="下载网址(自动换行)";left=79;top=12;right=368;bottom=33;transparent=1;z=3}
      • )
      • /*}}*/
      • import process;
      • import inet.httpFile;
      • import console;
      • winform.editUrl.text = "http://cdn.staticfile.org/layui/2.8.12/layui.js";
      • winform.buttonSave.oncommand = function(id,event){
      • path = "/"++string.match(winform.editUrl.text,".*\/(.*)")
      • http = inet.httpFile(winform.editUrl.text,path);
      • res = http.download()
      • if(res && http.complete){
      • http.close();
      • process.execute('/')
      • }
      • }
      • winform.buttonClose.oncommand = function(id,event){
      • win.quitMessage()
      • }
      • winform.show();
      • win.loopMessage();


    • Viewer8122 2023-8-17
      0 4
      666,学习了。
    • tanzh 2023-8-17
      0 5
      感谢大佬指点
    返回