nhqydlsh 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -33,4 +33,4 @@ ${a.default.gray(W)} ${H}
33
33
  `)},R={message:(H="",{symbol:T=a.default.gray(B)}={})=>{let D=[`${a.default.gray(B)}`];if(H){let[L,...p]=H.split(`
34
34
  `);D.push(`${T} ${L}`,...p.map((e)=>`${a.default.gray(B)} ${e}`))}process.stdout.write(`${D.join(`
35
35
  `)}
36
- `)},info:(H)=>{R.message(H,{symbol:a.default.blue(LT)})},success:(H)=>{R.message(H,{symbol:a.default.green(pT)})},step:(H)=>{R.message(H,{symbol:a.default.green(s$)})},warn:(H)=>{R.message(H,{symbol:a.default.yellow(mT)})},warning:(H)=>{R.warn(H)},error:(H)=>{R.message(H,{symbol:a.default.red(eT)})}},dD=`${a.default.gray(B)} `;var d$=s(aH(),1);import lH from"node:os";import ST from"node:path";function VT(){let T=lH.arch()==="x64"?"AutoItX3_x64.dll":"AutoItX3.dll";return ST.join(import.meta.dirname,"dlls",T)}var F=null,iH=null,o$=null,r$=null,X$=null,gT={async init(){if(F!==null)return;let H=VT();try{F=d$.default.load(H)}catch(T){throw Error(`Failed to load AutoIt DLL from "${H}". Make sure the DLL files exist in the src/dlls directory. Original error: ${T instanceof Error?T.message:String(T)}`)}iH=F.func("AU3_Init","void",[]),o$=F.func("AU3_MouseMove","int",["int","int","int"]),r$=F.func("AU3_ControlGetText","void",["str16","str16","str16","char16 *","int"]),X$=F.func("AU3_ControlClick","int",["str16","str16","str16","str16","int","int","int"]),iH()},async mouseMove(H,T,D=-1){if(o$===null)throw Error("AutoIt is not initialized. Call init() first.");return o$(H,T,D)},async controlGetText(H,T,D,L=1024){if(r$===null)throw Error("AutoIt is not initialized. Call init() first.");let p=Buffer.alloc(L*2);return r$(H,T,D,p,L),d$.default.decode(p,"char16",L).replace(/\0.*$/,"")},async controlClick(H,T,D,L="left",p=1,e=-2147483647,$=-2147483647){if(X$===null)throw Error("AutoIt is not initialized. Call init() first.");return X$(H,T,D,L,p,e,$)}},j=gT;async function sT(){let H=await a$({message:"Nhập X:"});if(M(H))U("Đã hủy thao tác."),process.exit(0);let T=await a$({message:"Nhập Y:"});if(M(T))U("Đã hủy thao tác."),process.exit(0);let D=parseInt(H,10),L=parseInt(T,10);if(Number.isNaN(D)||Number.isNaN(L)){console.log("Tọa độ không hợp lệ. Vui lòng nhập số hợp lệ.");return}await j.mouseMove(D,L),console.log(`Đã di chuyển chuột đến (${D}, ${L})`)}async function bT(){let H=!0;while(H){let T=await W$({message:"Chọn tùy chọn:",options:[{value:"move",label:"Di chuyển chuột"},{value:"au3info",label:"Mở Au3Info"},{value:"change-all",label:"Change all"},{value:"exit",label:"Thoát"}]});if(M(T))U("Đã hủy thao tác."),process.exit(0);switch(T){case"move":await sT();break;case"au3info":{let D=FT.join(import.meta.dirname,"dlls","Au3Info.exe");MT(D,[],{detached:!0,stdio:"ignore"}).unref(),console.log("Đã mở Au3Info.exe");break}case"change-all":{if(await j.controlClick("MiChanger Plus | v5.2.5 | offersthainguyen@gmail.com","","[CLASS:WindowsForms10.BUTTON.app.0.213697a_r8_ad1; INSTANCE:23]")===1)R.success('Đã click nút "Change ALL" thành công.');else R.error('Không thể click nút "Change ALL". Kiểm tra xem cửa sổ MiChanger Plus có đang mở không.');break}case"exit":H=!1;break}}}async function WT(){await j.init(),await bT(),j$("Tạm biệt!")}WT().catch(console.error);
36
+ `)},info:(H)=>{R.message(H,{symbol:a.default.blue(LT)})},success:(H)=>{R.message(H,{symbol:a.default.green(pT)})},step:(H)=>{R.message(H,{symbol:a.default.green(s$)})},warn:(H)=>{R.message(H,{symbol:a.default.yellow(mT)})},warning:(H)=>{R.warn(H)},error:(H)=>{R.message(H,{symbol:a.default.red(eT)})}},dD=`${a.default.gray(B)} `;var d$=s(aH(),1);import lH from"node:os";import ST from"node:path";function VT(){let T=lH.arch()==="x64"?"AutoItX3_x64.dll":"AutoItX3.dll";return ST.join(import.meta.dirname,"dlls",T)}var F=null,iH=null,o$=null,r$=null,X$=null,gT={async init(){if(F!==null)return;let H=VT();try{F=d$.default.load(H)}catch(T){throw Error(`Failed to load AutoIt DLL from "${H}". Make sure the DLL files exist in the src/dlls directory. Original error: ${T instanceof Error?T.message:String(T)}`)}iH=F.func("AU3_Init","void",[]),o$=F.func("AU3_MouseMove","int",["int","int","int"]),r$=F.func("AU3_ControlGetText","void",["str16","str16","str16","char16 *","int"]),X$=F.func("AU3_ControlClick","int",["str16","str16","str16","str16","int","int","int"]),iH()},async mouseMove(H,T,D=-1){if(o$===null)throw Error("AutoIt is not initialized. Call init() first.");return o$(H,T,D)},async controlGetText(H,T,D,L=1024){if(r$===null)throw Error("AutoIt is not initialized. Call init() first.");let p=Buffer.alloc(L*2);return r$(H,T,D,p,L),d$.default.decode(p,"char16",L).replace(/\0.*$/,"")},async controlClick(H,T,D,L="left",p=1,e=-2147483647,$=-2147483647){if(X$===null)throw Error("AutoIt is not initialized. Call init() first.");return X$(H,T,D,L,p,e,$)}},j=gT;async function sT(){let H=await a$({message:"Nhập X:"});if(M(H))U("Đã hủy thao tác."),process.exit(0);let T=await a$({message:"Nhập Y:"});if(M(T))U("Đã hủy thao tác."),process.exit(0);let D=parseInt(H,10),L=parseInt(T,10);if(Number.isNaN(D)||Number.isNaN(L)){console.log("Tọa độ không hợp lệ. Vui lòng nhập số hợp lệ.");return}await j.mouseMove(D,L),console.log(`Đã di chuyển chuột đến (${D}, ${L})`)}async function bT(){let H=!0;while(H){let T=await W$({message:"Chọn tùy chọn:",options:[{value:"move",label:"Di chuyển chuột"},{value:"au3info",label:"Mở Au3Info"},{value:"change-all",label:"Change all"},{value:"exit",label:"Thoát"}]});if(M(T))U("Đã hủy thao tác."),process.exit(0);switch(T){case"move":await sT();break;case"au3info":{let D=FT.join(import.meta.dirname,"dlls","Au3Info.exe");MT(D,[],{detached:!0,stdio:"ignore"}).unref(),console.log("Đã mở Au3Info.exe");break}case"change-all":{if(await j.controlClick("[TITLE:MiChanger Plus]","","[CLASS:WindowsForms10.Window.8.app.0.213697a_r8_ad1]")===1)R.success('Đã click nút "Change ALL" thành công.');else R.error('Không thể click nút "Change ALL". Kiểm tra xem cửa sổ MiChanger Plus có đang mở không.');break}case"exit":H=!1;break}}}async function WT(){await j.init(),await bT(),j$("Tạm biệt!")}WT().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nhqydlsh",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "private": false,