#Region #AutoIt3Wrapper_Icon=C:\Program Files\AutoIt3\Icons\Dell.ico #AutoIt3Wrapper_OutFile=CacheCredentials.exe #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseAnsi=y #AutoIt3Wrapper_Res_Comment=Creates local profile and caches credentials #AutoIt3Wrapper_Res_Description=Caches user credentials locally on the Windows machine #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_LegalCopyright=Dell Inc. #AutoIt3Wrapper_Res_Language=1033 #EndRegion $omyerror = ObjEvent("AutoIt.Error", "ComError") Global Const $gui_event_close = -3 Global Const $gui_event_minimize = -4 Global Const $gui_event_restore = -5 Global Const $gui_event_maximize = -6 Global Const $gui_event_primarydown = -7 Global Const $gui_event_primaryup = -8 Global Const $gui_event_secondarydown = -9 Global Const $gui_event_secondaryup = -10 Global Const $gui_event_mousemove = -11 Global Const $gui_event_resized = -12 Global Const $gui_event_dropped = -13 Global Const $gui_rundefmsg = "GUI_RUNDEFMSG" Global Const $gui_avistop = 0 Global Const $gui_avistart = 1 Global Const $gui_aviclose = 2 Global Const $gui_checked = 1 Global Const $gui_indeterminate = 2 Global Const $gui_unchecked = 4 Global Const $gui_dropaccepted = 8 Global Const $gui_nodropaccepted = 4096 Global Const $gui_acceptfiles = $gui_dropaccepted Global Const $gui_show = 16 Global Const $gui_hide = 32 Global Const $gui_enable = 64 Global Const $gui_disable = 128 Global Const $gui_focus = 256 Global Const $gui_nofocus = 8192 Global Const $gui_defbutton = 512 Global Const $gui_expand = 1024 Global Const $gui_ontop = 2048 Global Const $gui_fontitalic = 2 Global Const $gui_fontunder = 4 Global Const $gui_fontstrike = 8 Global Const $gui_dockauto = 1 Global Const $gui_dockleft = 2 Global Const $gui_dockright = 4 Global Const $gui_dockhcenter = 8 Global Const $gui_docktop = 32 Global Const $gui_dockbottom = 64 Global Const $gui_dockvcenter = 128 Global Const $gui_dockwidth = 256 Global Const $gui_dockheight = 512 Global Const $gui_docksize = 768 Global Const $gui_dockmenubar = 544 Global Const $gui_dockstatebar = 576 Global Const $gui_dockall = 802 Global Const $gui_dockborders = 102 Global Const $gui_gr_close = 1 Global Const $gui_gr_line = 2 Global Const $gui_gr_bezier = 4 Global Const $gui_gr_move = 6 Global Const $gui_gr_color = 8 Global Const $gui_gr_rect = 10 Global Const $gui_gr_ellipse = 12 Global Const $gui_gr_pie = 14 Global Const $gui_gr_dot = 16 Global Const $gui_gr_pixel = 18 Global Const $gui_gr_hint = 20 Global Const $gui_gr_refresh = 22 Global Const $gui_gr_pensize = 24 Global Const $gui_gr_nobkcolor = -2 Global Const $gui_bkcolor_default = -1 Global Const $gui_bkcolor_transparent = -2 Global Const $gui_bkcolor_lv_alternate = -33554432 Global Const $gui_ws_ex_parentdrag = 1048576 Global Const $bs_groupbox = 7 Global Const $bs_bottom = 2048 Global Const $bs_center = 768 Global Const $bs_defpushbutton = 1 Global Const $bs_left = 256 Global Const $bs_multiline = 8192 Global Const $bs_pushbox = 10 Global Const $bs_pushlike = 4096 Global Const $bs_right = 512 Global Const $bs_rightbutton = 32 Global Const $bs_top = 1024 Global Const $bs_vcenter = 3072 Global Const $bs_flat = 32768 Global Const $bs_icon = 64 Global Const $bs_bitmap = 128 Global Const $bs_notify = 16384 Global Const $bs_splitbutton = 12 Global Const $bs_defsplitbutton = 13 Global Const $bs_commandlink = 14 Global Const $bs_defcommandlink = 15 Global Const $bcsif_glyph = 1 Global Const $bcsif_image = 2 Global Const $bcsif_style = 4 Global Const $bcsif_size = 8 Global Const $bcss_nosplit = 1 Global Const $bcss_stretch = 2 Global Const $bcss_alignleft = 4 Global Const $bcss_image = 8 Global Const $button_imagelist_align_left = 0 Global Const $button_imagelist_align_right = 1 Global Const $button_imagelist_align_top = 2 Global Const $button_imagelist_align_bottom = 3 Global Const $button_imagelist_align_center = 4 Global Const $bs_3state = 5 Global Const $bs_auto3state = 6 Global Const $bs_autocheckbox = 3 Global Const $bs_checkbox = 2 Global Const $bs_radiobutton = 4 Global Const $bs_autoradiobutton = 9 Global Const $bs_ownerdraw = 11 Global Const $gui_ss_default_button = 0 Global Const $gui_ss_default_checkbox = 0 Global Const $gui_ss_default_group = 0 Global Const $gui_ss_default_radio = 0 Global Const $bcm_first = 5632 Global Const $bcm_getidealsize = ($bcm_first + 1) Global Const $bcm_getimagelist = ($bcm_first + 3) Global Const $bcm_getnote = ($bcm_first + 10) Global Const $bcm_getnotelength = ($bcm_first + 11) Global Const $bcm_getsplitinfo = ($bcm_first + 8) Global Const $bcm_gettextmargin = ($bcm_first + 5) Global Const $bcm_setdropdownstate = ($bcm_first + 6) Global Const $bcm_setimagelist = ($bcm_first + 2) Global Const $bcm_setnote = ($bcm_first + 9) Global Const $bcm_setshield = ($bcm_first + 12) Global Const $bcm_setsplitinfo = ($bcm_first + 7) Global Const $bcm_settextmargin = ($bcm_first + 4) Global Const $bm_click = 245 Global Const $bm_getcheck = 240 Global Const $bm_getimage = 246 Global Const $bm_getstate = 242 Global Const $bm_setcheck = 241 Global Const $bm_setdontclick = 248 Global Const $bm_setimage = 247 Global Const $bm_setstate = 243 Global Const $bm_setstyle = 244 Global Const $bcn_first = -1250 Global Const $bcn_dropdown = ($bcn_first + 2) Global Const $bcn_hotitemchange = ($bcn_first + 1) Global Const $bn_clicked = 0 Global Const $bn_paint = 1 Global Const $bn_hilite = 2 Global Const $bn_unhilite = 3 Global Const $bn_disable = 4 Global Const $bn_doubleclicked = 5 Global Const $bn_setfocus = 6 Global Const $bn_killfocus = 7 Global Const $bn_pushed = $bn_hilite Global Const $bn_unpushed = $bn_unhilite Global Const $bn_dblclk = $bn_doubleclicked Global Const $bst_checked = 1 Global Const $bst_indeterminate = 2 Global Const $bst_unchecked = 0 Global Const $bst_focus = 8 Global Const $bst_pushed = 4 Global Const $bst_dontclick = 128 Global Const $ws_tiled = 0 Global Const $ws_overlapped = 0 Global Const $ws_maximizebox = 65536 Global Const $ws_minimizebox = 131072 Global Const $ws_tabstop = 65536 Global Const $ws_group = 131072 Global Const $ws_sizebox = 262144 Global Const $ws_thickframe = 262144 Global Const $ws_sysmenu = 524288 Global Const $ws_hscroll = 1048576 Global Const $ws_vscroll = 2097152 Global Const $ws_dlgframe = 4194304 Global Const $ws_border = 8388608 Global Const $ws_caption = 12582912 Global Const $ws_overlappedwindow = 13565952 Global Const $ws_tiledwindow = 13565952 Global Const $ws_maximize = 16777216 Global Const $ws_clipchildren = 33554432 Global Const $ws_clipsiblings = 67108864 Global Const $ws_disabled = 134217728 Global Const $ws_visible = 268435456 Global Const $ws_minimize = 536870912 Global Const $ws_child = 1073741824 Global Const $ws_popup = -2147483648 Global Const $ws_popupwindow = -2138570752 Global Const $ds_modalframe = 128 Global Const $ds_setforeground = 512 Global Const $ds_contexthelp = 8192 Global Const $ws_ex_acceptfiles = 16 Global Const $ws_ex_mdichild = 64 Global Const $ws_ex_appwindow = 262144 Global Const $ws_ex_composited = 33554432 Global Const $ws_ex_clientedge = 512 Global Const $ws_ex_contexthelp = 1024 Global Const $ws_ex_dlgmodalframe = 1 Global Const $ws_ex_leftscrollbar = 16384 Global Const $ws_ex_overlappedwindow = 768 Global Const $ws_ex_right = 4096 Global Const $ws_ex_staticedge = 131072 Global Const $ws_ex_toolwindow = 128 Global Const $ws_ex_topmost = 8 Global Const $ws_ex_transparent = 32 Global Const $ws_ex_windowedge = 256 Global Const $ws_ex_layered = 524288 Global Const $ws_ex_controlparent = 65536 Global Const $ws_ex_layoutrtl = 4194304 Global Const $ws_ex_rtlreading = 8192 Global Const $wm_gettextlength = 14 Global Const $wm_gettext = 13 Global Const $wm_size = 5 Global Const $wm_sizing = 532 Global Const $wm_user = 1024 Global Const $wm_create = 1 Global Const $wm_destroy = 2 Global Const $wm_move = 3 Global Const $wm_activate = 6 Global Const $wm_setfocus = 7 Global Const $wm_killfocus = 8 Global Const $wm_enable = 10 Global Const $wm_setredraw = 11 Global Const $wm_settext = 12 Global Const $wm_paint = 15 Global Const $wm_close = 16 Global Const $wm_quit = 18 Global Const $wm_erasebkgnd = 20 Global Const $wm_syscolorchange = 21 Global Const $wm_showwindow = 24 Global Const $wm_wininichange = 26 Global Const $wm_devmodechange = 27 Global Const $wm_activateapp = 28 Global Const $wm_fontchange = 29 Global Const $wm_timechange = 30 Global Const $wm_cancelmode = 31 Global Const $wm_setcursor = 32 Global Const $wm_mouseactivate = 33 Global Const $wm_childactivate = 34 Global Const $wm_queuesync = 35 Global Const $wm_getminmaxinfo = 36 Global Const $wm_painticon = 38 Global Const $wm_iconerasebkgnd = 39 Global Const $wm_nextdlgctl = 40 Global Const $wm_spoolerstatus = 42 Global Const $wm_drawitem = 43 Global Const $wm_measureitem = 44 Global Const $wm_deleteitem = 45 Global Const $wm_vkeytoitem = 46 Global Const $wm_chartoitem = 47 Global Const $wm_setfont = 48 Global Const $wm_getfont = 49 Global Const $wm_sethotkey = 50 Global Const $wm_gethotkey = 51 Global Const $wm_querydragicon = 55 Global Const $wm_compareitem = 57 Global Const $wm_getobject = 61 Global Const $wm_compacting = 65 Global Const $wm_commnotify = 68 Global Const $wm_windowposchanging = 70 Global Const $wm_windowposchanged = 71 Global Const $wm_power = 72 Global Const $wm_notify = 78 Global Const $wm_copydata = 74 Global Const $wm_canceljournal = 75 Global Const $wm_inputlangchangerequest = 80 Global Const $wm_inputlangchange = 81 Global Const $wm_tcard = 82 Global Const $wm_help = 83 Global Const $wm_userchanged = 84 Global Const $wm_notifyformat = 85 Global Const $wm_cut = 768 Global Const $wm_copy = 769 Global Const $wm_paste = 770 Global Const $wm_clear = 771 Global Const $wm_undo = 772 Global Const $wm_contextmenu = 123 Global Const $wm_stylechanging = 124 Global Const $wm_stylechanged = 125 Global Const $wm_displaychange = 126 Global Const $wm_geticon = 127 Global Const $wm_seticon = 128 Global Const $wm_nccreate = 129 Global Const $wm_ncdestroy = 130 Global Const $wm_nccalcsize = 131 Global Const $wm_nchittest = 132 Global Const $wm_ncpaint = 133 Global Const $wm_ncactivate = 134 Global Const $wm_getdlgcode = 135 Global Const $wm_syncpaint = 136 Global Const $wm_ncmousemove = 160 Global Const $wm_nclbuttondown = 161 Global Const $wm_nclbuttonup = 162 Global Const $wm_nclbuttondblclk = 163 Global Const $wm_ncrbuttondown = 164 Global Const $wm_ncrbuttonup = 165 Global Const $wm_ncrbuttondblclk = 166 Global Const $wm_ncmbuttondown = 167 Global Const $wm_ncmbuttonup = 168 Global Const $wm_ncmbuttondblclk = 169 Global Const $wm_keydown = 256 Global Const $wm_keyup = 257 Global Const $wm_char = 258 Global Const $wm_deadchar = 259 Global Const $wm_syskeydown = 260 Global Const $wm_syskeyup = 261 Global Const $wm_syschar = 262 Global Const $wm_sysdeadchar = 263 Global Const $wm_initdialog = 272 Global Const $wm_command = 273 Global Const $wm_syscommand = 274 Global Const $wm_timer = 275 Global Const $wm_hscroll = 276 Global Const $wm_vscroll = 277 Global Const $wm_initmenu = 278 Global Const $wm_initmenupopup = 279 Global Const $wm_menuselect = 287 Global Const $wm_menuchar = 288 Global Const $wm_enteridle = 289 Global Const $wm_menurbuttonup = 290 Global Const $wm_menudrag = 291 Global Const $wm_menugetobject = 292 Global Const $wm_uninitmenupopup = 293 Global Const $wm_menucommand = 294 Global Const $wm_changeuistate = 295 Global Const $wm_updateuistate = 296 Global Const $wm_queryuistate = 297 Global Const $wm_ctlcolormsgbox = 306 Global Const $wm_ctlcoloredit = 307 Global Const $wm_ctlcolorlistbox = 308 Global Const $wm_ctlcolorbtn = 309 Global Const $wm_ctlcolordlg = 310 Global Const $wm_ctlcolorscrollbar = 311 Global Const $wm_ctlcolorstatic = 312 Global Const $wm_ctlcolor = 25 Global Const $mn_gethmenu = 481 Global Const $nm_first = 0 Global Const $nm_outofmemory = $nm_first - 1 Global Const $nm_click = $nm_first - 2 Global Const $nm_dblclk = $nm_first - 3 Global Const $nm_return = $nm_first - 4 Global Const $nm_rclick = $nm_first - 5 Global Const $nm_rdblclk = $nm_first - 6 Global Const $nm_setfocus = $nm_first - 7 Global Const $nm_killfocus = $nm_first - 8 Global Const $nm_customdraw = $nm_first - 12 Global Const $nm_hover = $nm_first - 13 Global Const $nm_nchittest = $nm_first - 14 Global Const $nm_keydown = $nm_first - 15 Global Const $nm_releasedcapture = $nm_first - 16 Global Const $nm_setcursor = $nm_first - 17 Global Const $nm_char = $nm_first - 18 Global Const $nm_tooltipscreated = $nm_first - 19 Global Const $nm_ldown = $nm_first - 20 Global Const $nm_rdown = $nm_first - 21 Global Const $nm_themechanged = $nm_first - 22 Global Const $wm_mousemove = 512 Global Const $wm_lbuttondown = 513 Global Const $wm_lbuttonup = 514 Global Const $wm_lbuttondblclk = 515 Global Const $wm_rbuttondown = 516 Global Const $wm_rbuttonup = 517 Global Const $wm_rbuttondblck = 518 Global Const $wm_mbuttondown = 519 Global Const $wm_mbuttonup = 520 Global Const $wm_mbuttondblck = 521 Global Const $wm_mousewheel = 522 Global Const $wm_xbuttondown = 523 Global Const $wm_xbuttonup = 524 Global Const $wm_xbuttondblclk = 525 Global Const $wm_mousehwheel = 526 Global Const $ps_solid = 0 Global Const $ps_dash = 1 Global Const $ps_dot = 2 Global Const $ps_dashdot = 3 Global Const $ps_dashdotdot = 4 Global Const $ps_null = 5 Global Const $ps_insideframe = 6 Global Const $lwa_alpha = 2 Global Const $lwa_colorkey = 1 Global Const $rgn_and = 1 Global Const $rgn_or = 2 Global Const $rgn_xor = 3 Global Const $rgn_diff = 4 Global Const $rgn_copy = 5 Global Const $errorregion = 0 Global Const $nullregion = 1 Global Const $simpleregion = 2 Global Const $complexregion = 3 Global Const $transparent = 1 Global Const $opaque = 2 Global Const $ccm_first = 8192 Global Const $ccm_getunicodeformat = ($ccm_first + 6) Global Const $ccm_setunicodeformat = ($ccm_first + 5) Global Const $ccm_setbkcolor = $ccm_first + 1 Global Const $ccm_setcolorscheme = $ccm_first + 2 Global Const $ccm_getcolorscheme = $ccm_first + 3 Global Const $ccm_getdroptarget = $ccm_first + 4 Global Const $ccm_setwindowtheme = $ccm_first + 11 Global Const $ga_parent = 1 Global Const $ga_root = 2 Global Const $ga_rootowner = 3 Global Const $sm_cxscreen = 0 Global Const $sm_cyscreen = 1 Global Const $sm_cxvscroll = 2 Global Const $sm_cyhscroll = 3 Global Const $sm_cycaption = 4 Global Const $sm_cxborder = 5 Global Const $sm_cyborder = 6 Global Const $sm_cxdlgframe = 7 Global Const $sm_cydlgframe = 8 Global Const $sm_cyvthumb = 9 Global Const $sm_cxhthumb = 10 Global Const $sm_cxicon = 11 Global Const $sm_cyicon = 12 Global Const $sm_cxcursor = 13 Global Const $sm_cycursor = 14 Global Const $sm_cymenu = 15 Global Const $sm_cxfullscreen = 16 Global Const $sm_cyfullscreen = 17 Global Const $sm_cykanjiwindow = 18 Global Const $sm_mousepresent = 19 Global Const $sm_cyvscroll = 20 Global Const $sm_cxhscroll = 21 Global Const $sm_debug = 22 Global Const $sm_swapbutton = 23 Global Const $sm_reserved1 = 24 Global Const $sm_reserved2 = 25 Global Const $sm_reserved3 = 26 Global Const $sm_reserved4 = 27 Global Const $sm_cxmin = 28 Global Const $sm_cymin = 29 Global Const $sm_cxsize = 30 Global Const $sm_cysize = 31 Global Const $sm_cxframe = 32 Global Const $sm_cyframe = 33 Global Const $sm_cxmintrack = 34 Global Const $sm_cymintrack = 35 Global Const $sm_cxdoubleclk = 36 Global Const $sm_cydoubleclk = 37 Global Const $sm_cxiconspacing = 38 Global Const $sm_cyiconspacing = 39 Global Const $sm_menudropalignment = 40 Global Const $sm_penwindows = 41 Global Const $sm_dbcsenabled = 42 Global Const $sm_cmousebuttons = 43 Global Const $sm_secure = 44 Global Const $sm_cxedge = 45 Global Const $sm_cyedge = 46 Global Const $sm_cxminspacing = 47 Global Const $sm_cyminspacing = 48 Global Const $sm_cxsmicon = 49 Global Const $sm_cysmicon = 50 Global Const $sm_cysmcaption = 51 Global Const $sm_cxsmsize = 52 Global Const $sm_cysmsize = 53 Global Const $sm_cxmenusize = 54 Global Const $sm_cymenusize = 55 Global Const $sm_arrange = 56 Global Const $sm_cxminimized = 57 Global Const $sm_cyminimized = 58 Global Const $sm_cxmaxtrack = 59 Global Const $sm_cymaxtrack = 60 Global Const $sm_cxmaximized = 61 Global Const $sm_cymaximized = 62 Global Const $sm_network = 63 Global Const $sm_cleanboot = 67 Global Const $sm_cxdrag = 68 Global Const $sm_cydrag = 69 Global Const $sm_showsounds = 70 Global Const $sm_cxmenucheck = 71 Global Const $sm_cymenucheck = 72 Global Const $sm_slowmachine = 73 Global Const $sm_mideastenabled = 74 Global Const $sm_mousewheelpresent = 75 Global Const $sm_xvirtualscreen = 76 Global Const $sm_yvirtualscreen = 77 Global Const $sm_cxvirtualscreen = 78 Global Const $sm_cyvirtualscreen = 79 Global Const $sm_cmonitors = 80 Global Const $sm_samedisplayformat = 81 Global Const $sm_immenabled = 82 Global Const $sm_cxfocusborder = 83 Global Const $sm_cyfocusborder = 84 Global Const $sm_tabletpc = 86 Global Const $sm_mediacenter = 87 Global Const $sm_starter = 88 Global Const $sm_serverr2 = 89 Global Const $sm_cmetrics = 90 Global Const $sm_remotesession = 4096 Global Const $sm_shuttingdown = 8192 Global Const $sm_remotecontrol = 8193 Global Const $sm_caretblinkingenabled = 8194 Global Const $blackness = 66 Global Const $captureblt = 1073741824 Global Const $dstinvert = 5570569 Global Const $mergecopy = 12583114 Global Const $mergepaint = 12255782 Global Const $nomirrorbitmap = -2147483648 Global Const $notsrccopy = 3342344 Global Const $notsrcerase = 1114278 Global Const $patcopy = 15728673 Global Const $patinvert = 5898313 Global Const $patpaint = 16452105 Global Const $srcand = 8913094 Global Const $srccopy = 13369376 Global Const $srcerase = 4457256 Global Const $srcinvert = 6684742 Global Const $srcpaint = 15597702 Global Const $whiteness = 16711778 Global Const $dt_bottom = 8 Global Const $dt_calcrect = 1024 Global Const $dt_center = 1 Global Const $dt_editcontrol = 8192 Global Const $dt_end_ellipsis = 32768 Global Const $dt_expandtabs = 64 Global Const $dt_externalleading = 512 Global Const $dt_hideprefix = 1048576 Global Const $dt_internal = 4096 Global Const $dt_left = 0 Global Const $dt_modifystring = 65536 Global Const $dt_noclip = 256 Global Const $dt_nofullwidthcharbreak = 524288 Global Const $dt_noprefix = 2048 Global Const $dt_path_ellipsis = 16384 Global Const $dt_prefixonly = 2097152 Global Const $dt_right = 2 Global Const $dt_rtlreading = 131072 Global Const $dt_singleline = 32 Global Const $dt_tabstop = 128 Global Const $dt_top = 0 Global Const $dt_vcenter = 4 Global Const $dt_wordbreak = 16 Global Const $dt_word_ellipsis = 262144 Global Const $rdw_erase = 4 Global Const $rdw_frame = 1024 Global Const $rdw_internalpaint = 2 Global Const $rdw_invalidate = 1 Global Const $rdw_noerase = 32 Global Const $rdw_noframe = 2048 Global Const $rdw_nointernalpaint = 16 Global Const $rdw_validate = 8 Global Const $rdw_erasenow = 512 Global Const $rdw_updatenow = 256 Global Const $rdw_allchildren = 128 Global Const $rdw_nochildren = 64 Global Const $wm_renderformat = 773 Global Const $wm_renderallformats = 774 Global Const $wm_destroyclipboard = 775 Global Const $wm_drawclipboard = 776 Global Const $wm_paintclipboard = 777 Global Const $wm_vscrollclipboard = 778 Global Const $wm_sizeclipboard = 779 Global Const $wm_askcbformatname = 780 Global Const $wm_changecbchain = 781 Global Const $wm_hscrollclipboard = 782 Global Const $hterror = -2 Global Const $httransparent = -1 Global Const $htnowhere = 0 Global Const $htclient = 1 Global Const $htcaption = 2 Global Const $htsysmenu = 3 Global Const $htgrowbox = 4 Global Const $htsize = $htgrowbox Global Const $htmenu = 5 Global Const $hthscroll = 6 Global Const $htvscroll = 7 Global Const $htminbutton = 8 Global Const $htmaxbutton = 9 Global Const $htleft = 10 Global Const $htright = 11 Global Const $httop = 12 Global Const $httopleft = 13 Global Const $httopright = 14 Global Const $htbottom = 15 Global Const $htbottomleft = 16 Global Const $htbottomright = 17 Global Const $htborder = 18 Global Const $htreduce = $htminbutton Global Const $htzoom = $htmaxbutton Global Const $htsizefirst = $htleft Global Const $htsizelast = $htbottomright Global Const $htobject = 19 Global Const $htclose = 20 Global Const $hthelp = 21 Global Const $color_scrollbar = 0 Global Const $color_background = 1 Global Const $color_activecaption = 2 Global Const $color_inactivecaption = 3 Global Const $color_menu = 4 Global Const $color_window = 5 Global Const $color_windowframe = 6 Global Const $color_menutext = 7 Global Const $color_windowtext = 8 Global Const $color_captiontext = 9 Global Const $color_activeborder = 10 Global Const $color_inactiveborder = 11 Global Const $color_appworkspace = 12 Global Const $color_highlight = 13 Global Const $color_highlighttext = 14 Global Const $color_btnface = 15 Global Const $color_btnshadow = 16 Global Const $color_graytext = 17 Global Const $color_btntext = 18 Global Const $color_inactivecaptiontext = 19 Global Const $color_btnhighlight = 20 Global Const $color_3ddkshadow = 21 Global Const $color_3dlight = 22 Global Const $color_infotext = 23 Global Const $color_infobk = 24 Global Const $color_hotlight = 26 Global Const $color_gradientactivecaption = 27 Global Const $color_gradientinactivecaption = 28 Global Const $color_menuhilight = 29 Global Const $color_menubar = 30 Global Const $color_desktop = 1 Global Const $color_3dface = 15 Global Const $color_3dshadow = 16 Global Const $color_3dhighlight = 20 Global Const $color_3dhilight = 20 Global Const $color_btnhilight = 20 Global Const $hinst_commctrl = -1 Global Const $idb_std_small_color = 0 Global Const $idb_std_large_color = 1 Global Const $idb_view_small_color = 4 Global Const $idb_view_large_color = 5 Global Const $idb_hist_small_color = 8 Global Const $idb_hist_large_color = 9 Global Const $startf_forceofffeedback = 128 Global Const $startf_forceonfeedback = 64 Global Const $startf_runfullscreen = 32 Global Const $startf_usecountchars = 8 Global Const $startf_usefillattribute = 16 Global Const $startf_usehotkey = 512 Global Const $startf_useposition = 4 Global Const $startf_useshowwindow = 1 Global Const $startf_usesize = 2 Global Const $startf_usestdhandles = 256 Global Const $cdds_prepaint = 1 Global Const $cdds_postpaint = 2 Global Const $cdds_preerase = 3 Global Const $cdds_posterase = 4 Global Const $cdds_item = 65536 Global Const $cdds_itemprepaint = 65537 Global Const $cdds_itempostpaint = 65538 Global Const $cdds_itempreerase = 65539 Global Const $cdds_itemposterase = 65540 Global Const $cdds_subitem = 131072 Global Const $cdis_selected = 1 Global Const $cdis_grayed = 2 Global Const $cdis_disabled = 4 Global Const $cdis_checked = 8 Global Const $cdis_focus = 16 Global Const $cdis_default = 32 Global Const $cdis_hot = 64 Global Const $cdis_marked = 128 Global Const $cdis_indeterminate = 256 Global Const $cdis_showkeyboardcues = 512 Global Const $cdis_nearhot = 1024 Global Const $cdis_othersidehot = 2048 Global Const $cdis_drophilited = 4096 Global Const $cdrf_dodefault = 0 Global Const $cdrf_newfont = 2 Global Const $cdrf_skipdefault = 4 Global Const $cdrf_notifypostpaint = 16 Global Const $cdrf_notifyitemdraw = 32 Global Const $cdrf_notifysubitemdraw = 32 Global Const $cdrf_notifyposterase = 64 Global Const $cdrf_doerase = 8 Global Const $cdrf_skippostpaint = 256 Global Const $gui_ss_default_gui = BitOR($ws_minimizebox, $ws_caption, $ws_popup, $ws_sysmenu) Global Const $es_left = 0 Global Const $es_center = 1 Global Const $es_right = 2 Global Const $es_multiline = 4 Global Const $es_uppercase = 8 Global Const $es_lowercase = 16 Global Const $es_password = 32 Global Const $es_autovscroll = 64 Global Const $es_autohscroll = 128 Global Const $es_nohidesel = 256 Global Const $es_oemconvert = 1024 Global Const $es_readonly = 2048 Global Const $es_wantreturn = 4096 Global Const $es_number = 8192 Global Const $ec_err = -1 Global Const $ecm_first = 5376 Global Const $em_canundo = 198 Global Const $em_charfrompos = 215 Global Const $em_emptyundobuffer = 205 Global Const $em_fmtlines = 200 Global Const $em_getcuebanner = ($ecm_first + 2) Global Const $em_getfirstvisibleline = 206 Global Const $em_gethandle = 189 Global Const $em_getimestatus = 217 Global Const $em_getlimittext = 213 Global Const $em_getline = 196 Global Const $em_getlinecount = 186 Global Const $em_getmargins = 212 Global Const $em_getmodify = 184 Global Const $em_getpasswordchar = 210 Global Const $em_getrect = 178 Global Const $em_getsel = 176 Global Const $em_getthumb = 190 Global Const $em_getwordbreakproc = 209 Global Const $em_hideballoontip = ($ecm_first + 4) Global Const $em_limittext = 197 Global Const $em_linefromchar = 201 Global Const $em_lineindex = 187 Global Const $em_linelength = 193 Global Const $em_linescroll = 182 Global Const $em_posfromchar = 214 Global Const $em_replacesel = 194 Global Const $em_scroll = 181 Global Const $em_scrollcaret = 183 Global Const $em_setcuebanner = ($ecm_first + 1) Global Const $em_sethandle = 188 Global Const $em_setimestatus = 216 Global Const $em_setlimittext = $em_limittext Global Const $em_setmargins = 211 Global Const $em_setmodify = 185 Global Const $em_setpasswordchar = 204 Global Const $em_setreadonly = 207 Global Const $em_setrect = 179 Global Const $em_setrectnp = 180 Global Const $em_setsel = 177 Global Const $em_settabstops = 203 Global Const $em_setwordbreakproc = 208 Global Const $em_showballoontip = ($ecm_first + 3) Global Const $em_undo = 199 Global Const $ec_leftmargin = 1 Global Const $ec_rightmargin = 2 Global Const $ec_usefontinfo = 65535 Global Const $emsis_compositionstring = 1 Global Const $eimes_getcompstratonce = 1 Global Const $eimes_cancelcompstrinfocus = 2 Global Const $eimes_completecompstrkillfocus = 4 Global Const $en_align_ltr_ec = 1792 Global Const $en_align_rtl_ec = 1793 Global Const $en_change = 768 Global Const $en_errspace = 1280 Global Const $en_hscroll = 1537 Global Const $en_killfocus = 512 Global Const $en_maxtext = 1281 Global Const $en_setfocus = 256 Global Const $en_update = 1024 Global Const $en_vscroll = 1538 Global Const $tti_none = 0 Global Const $tti_info = 1 Global Const $tti_warning = 2 Global Const $tti_error = 3 Global Const $tti_info_large = 4 Global Const $tti_warning_large = 5 Global Const $tti_error_large = 6 Global Const $__editconstant_ws_vscroll = 2097152 Global Const $__editconstant_ws_hscroll = 1048576 Global Const $gui_ss_default_edit = BitOR($es_wantreturn, $__editconstant_ws_vscroll, $__editconstant_ws_hscroll, $es_autovscroll, $es_autohscroll) Global Const $gui_ss_default_input = BitOR($es_left, $es_autohscroll) Global Const $fc_nooverwrite = 0 Global Const $fc_overwrite = 1 Global Const $ft_modified = 0 Global Const $ft_created = 1 Global Const $ft_accessed = 2 Global Const $fo_read = 0 Global Const $fo_append = 1 Global Const $fo_overwrite = 2 Global Const $fo_binary = 16 Global Const $fo_unicode = 32 Global Const $fo_utf16_le = 32 Global Const $fo_utf16_be = 64 Global Const $fo_utf8 = 128 Global Const $fo_utf8_nobom = 256 Global Const $eof = -1 Global Const $fd_filemustexist = 1 Global Const $fd_pathmustexist = 2 Global Const $fd_multiselect = 4 Global Const $fd_promptcreatenew = 8 Global Const $fd_promptoverwrite = 16 Global Const $create_new = 1 Global Const $create_always = 2 Global Const $open_existing = 3 Global Const $open_always = 4 Global Const $truncate_existing = 5 Global Const $invalid_set_file_pointer = -1 Global Const $file_begin = 0 Global Const $file_current = 1 Global Const $file_end = 2 Global Const $file_attribute_readonly = 1 Global Const $file_attribute_hidden = 2 Global Const $file_attribute_system = 4 Global Const $file_attribute_directory = 16 Global Const $file_attribute_archive = 32 Global Const $file_attribute_device = 64 Global Const $file_attribute_normal = 128 Global Const $file_attribute_temporary = 256 Global Const $file_attribute_sparse_file = 512 Global Const $file_attribute_reparse_point = 1024 Global Const $file_attribute_compressed = 2048 Global Const $file_attribute_offline = 4096 Global Const $file_attribute_not_content_indexed = 8192 Global Const $file_attribute_encrypted = 16384 Global Const $file_share_read = 1 Global Const $file_share_write = 2 Global Const $file_share_delete = 4 Global Const $generic_all = 268435456 Global Const $generic_execute = 536870912 Global Const $generic_write = 1073741824 Global Const $generic_read = -2147483648 Func _filecountlines($sfilepath) Local $hfile = FileOpen($sfilepath, $fo_read) If $hfile = -1 Then Return SetError(1, 0, 0) Local $sfilecontent = StringStripWS(FileRead($hfile), 2) FileClose($hfile) Local $atmp If StringInStr($sfilecontent, @LF) Then $atmp = StringSplit(StringStripCR($sfilecontent), @LF) ElseIf StringInStr($sfilecontent, @CR) Then $atmp = StringSplit($sfilecontent, @CR) Else If StringLen($sfilecontent) Then Return 1 Else Return SetError(2, 0, 0) EndIf EndIf Return $atmp[0] EndFunc Func _filecreate($sfilepath) Local $hopenfile = FileOpen($sfilepath, $fo_overwrite) If $hopenfile = -1 Then Return SetError(1, 0, 0) Local $hwritefile = FileWrite($hopenfile, "") FileClose($hopenfile) If $hwritefile = -1 Then Return SetError(2, 0, 0) Return 1 EndFunc Func _filelisttoarray($spath, $sfilter = "*", $iflag = 0) Local $hsearch, $sfile, $sfilelist, $sdelim = "|" $spath = StringRegExpReplace($spath, "[\\/]+\z", "") & "\" If NOT FileExists($spath) Then Return SetError(1, 1, "") If StringRegExp($sfilter, "[\\/:><\|]|(?s)\A\s*\z") Then Return SetError(2, 2, "") If NOT ($iflag = 0 OR $iflag = 1 OR $iflag = 2) Then Return SetError(3, 3, "") $hsearch = FileFindFirstFile($spath & $sfilter) If @error Then Return SetError(4, 4, "") While 1 $sfile = FileFindNextFile($hsearch) If @error Then ExitLoop If ($iflag + @extended = 2) Then ContinueLoop $sfilelist &= $sdelim & $sfile WEnd FileClose($hsearch) If NOT $sfilelist Then Return SetError(4, 4, "") Return StringSplit(StringTrimLeft($sfilelist, 1), "|") EndFunc Func _fileprint($s_file, $i_show = @SW_HIDE) Local $a_ret = DllCall("shell32.dll", "int", "ShellExecuteW", "hwnd", 0, "wstr", "print", "wstr", $s_file, "wstr", "", "wstr", "", "int", $i_show) If @error Then Return SetError(@error, @extended, 0) If $a_ret[0] <= 32 Then Return SetError(10, $a_ret[0], 0) Return 1 EndFunc Func _filereadtoarray($sfilepath, ByRef $aarray) Local $hfile = FileOpen($sfilepath, $fo_read) If $hfile = -1 Then Return SetError(1, 0, 0) Local $afile = FileRead($hfile, FileGetSize($sfilepath)) If StringRight($afile, 1) = @LF Then $afile = StringTrimRight($afile, 1) If StringRight($afile, 1) = @CR Then $afile = StringTrimRight($afile, 1) FileClose($hfile) If StringInStr($afile, @LF) Then $aarray = StringSplit(StringStripCR($afile), @LF) ElseIf StringInStr($afile, @CR) Then $aarray = StringSplit($afile, @CR) Else If StringLen($afile) Then Dim $aarray[2] = [1, $afile] Else Return SetError(2, 0, 0) EndIf EndIf Return 1 EndFunc Func _filewritefromarray($file, $a_array, $i_base = 0, $i_ubound = 0) If NOT IsArray($a_array) Then Return SetError(2, 0, 0) Local $last = UBound($a_array) - 1 If $i_ubound < 1 OR $i_ubound > $last Then $i_ubound = $last If $i_base < 0 OR $i_base > $last Then $i_base = 0 Local $hfile If IsString($file) Then $hfile = FileOpen($file, $fo_overwrite) Else $hfile = $file EndIf If $hfile = -1 Then Return SetError(1, 0, 0) Local $errorsav = 0 For $x = $i_base To $i_ubound If FileWrite($hfile, $a_array[$x] & @CRLF) = 0 Then $errorsav = 3 ExitLoop EndIf Next If IsString($file) Then FileClose($hfile) If $errorsav Then Return SetError($errorsav, 0, 0) Return 1 EndFunc Func _filewritelog($slogpath, $slogmsg, $iflag = -1) Local $iopenmode = $fo_append Local $sdatenow = @YEAR & "-" & @MON & "-" & @MDAY Local $stimenow = @HOUR & ":" & @MIN & ":" & @SEC Local $smsg = $sdatenow & " " & $stimenow & " : " & $slogmsg If $iflag <> -1 Then $smsg &= @CRLF & FileRead($slogpath) $iopenmode = $fo_overwrite EndIf Local $hopenfile = FileOpen($slogpath, $iopenmode) If $hopenfile = -1 Then Return SetError(1, 0, 0) Local $iwritefile = FileWriteLine($hopenfile, $smsg) Local $iret = FileClose($hopenfile) If $iwritefile = -1 Then Return SetError(2, $iret, 0) Return $iret EndFunc Func _filewritetoline($sfile, $iline, $stext, $foverwrite = 0) If $iline <= 0 Then Return SetError(4, 0, 0) If NOT IsString($stext) Then $stext = String($stext) If $stext = "" Then Return SetError(6, 0, 0) EndIf If $foverwrite <> 0 AND $foverwrite <> 1 Then Return SetError(5, 0, 0) If NOT FileExists($sfile) Then Return SetError(2, 0, 0) Local $sread_file = FileRead($sfile) Local $asplit_file = StringSplit(StringStripCR($sread_file), @LF) If UBound($asplit_file) < $iline Then Return SetError(1, 0, 0) Local $hfile = FileOpen($sfile, $fo_overwrite) If $hfile = -1 Then Return SetError(3, 0, 0) $sread_file = "" For $i = 1 To $asplit_file[0] If $i = $iline Then If $foverwrite = 1 Then If $stext <> "" Then $sread_file &= $stext & @CRLF Else $sread_file &= $stext & @CRLF & $asplit_file[$i] & @CRLF EndIf ElseIf $i < $asplit_file[0] Then $sread_file &= $asplit_file[$i] & @CRLF ElseIf $i = $asplit_file[0] Then $sread_file &= $asplit_file[$i] EndIf Next FileWrite($hfile, $sread_file) FileClose($hfile) Return 1 EndFunc Func _pathfull($srelativepath, $sbasepath = @WorkingDir) If NOT $srelativepath OR $srelativepath = "." Then Return $sbasepath Local $sfullpath = StringReplace($srelativepath, "/", "\") Local Const $sfullpathconst = $sfullpath Local $spath Local $brootonly = StringLeft($sfullpath, 1) = "\" AND StringMid($sfullpath, 2, 1) <> "\" For $i = 1 To 2 $spath = StringLeft($sfullpath, 2) If $spath = "\\" Then $sfullpath = StringTrimLeft($sfullpath, 2) Local $nserverlen = StringInStr($sfullpath, "\") - 1 $spath = "\\" & StringLeft($sfullpath, $nserverlen) $sfullpath = StringTrimLeft($sfullpath, $nserverlen) ExitLoop ElseIf StringRight($spath, 1) = ":" Then $sfullpath = StringTrimLeft($sfullpath, 2) ExitLoop Else $sfullpath = $sbasepath & "\" & $sfullpath EndIf Next If $i = 3 Then Return "" If StringLeft($sfullpath, 1) <> "\" Then If StringLeft($sfullpathconst, 2) = StringLeft($sbasepath, 2) Then $sfullpath = $sbasepath & "\" & $sfullpath Else $sfullpath = "\" & $sfullpath EndIf EndIf Local $atemp = StringSplit($sfullpath, "\") Local $apathparts[$atemp[0]], $j = 0 For $i = 2 To $atemp[0] If $atemp[$i] = ".." Then If $j Then $j -= 1 ElseIf NOT ($atemp[$i] = "" AND $i <> $atemp[0]) AND $atemp[$i] <> "." Then $apathparts[$j] = $atemp[$i] $j += 1 EndIf Next $sfullpath = $spath If NOT $brootonly Then For $i = 0 To $j - 1 $sfullpath &= "\" & $apathparts[$i] Next Else $sfullpath &= $sfullpathconst If StringInStr($sfullpath, "..") Then $sfullpath = _pathfull($sfullpath) EndIf While StringInStr($sfullpath, ".\") $sfullpath = StringReplace($sfullpath, ".\", "\") WEnd Return $sfullpath EndFunc Func _pathgetrelative($sfrom, $sto) If StringRight($sfrom, 1) <> "\" Then $sfrom &= "\" If StringRight($sto, 1) <> "\" Then $sto &= "\" If $sfrom = $sto Then Return SetError(1, 0, StringTrimRight($sto, 1)) Local $asfrom = StringSplit($sfrom, "\") Local $asto = StringSplit($sto, "\") If $asfrom[1] <> $asto[1] Then Return SetError(2, 0, StringTrimRight($sto, 1)) Local $i = 2 Local $idiff = 1 While 1 If $asfrom[$i] <> $asto[$i] Then $idiff = $i ExitLoop EndIf $i += 1 WEnd $i = 1 Local $srelpath = "" For $j = 1 To $asto[0] If $i >= $idiff Then $srelpath &= "\" & $asto[$i] EndIf $i += 1 Next $srelpath = StringTrimLeft($srelpath, 1) $i = 1 For $j = 1 To $asfrom[0] If $i > $idiff Then $srelpath = "..\" & $srelpath EndIf $i += 1 Next If StringRight($srelpath, 1) == "\" Then $srelpath = StringTrimRight($srelpath, 1) Return $srelpath EndFunc Func _pathmake($szdrive, $szdir, $szfname, $szext) If StringLen($szdrive) Then If NOT (StringLeft($szdrive, 2) = "\\") Then $szdrive = StringLeft($szdrive, 1) & ":" EndIf If StringLen($szdir) Then If NOT (StringRight($szdir, 1) = "\") AND NOT (StringRight($szdir, 1) = "/") Then $szdir = $szdir & "\" EndIf If StringLen($szext) Then If NOT (StringLeft($szext, 1) = ".") Then $szext = "." & $szext EndIf Return $szdrive & $szdir & $szfname & $szext EndFunc Func _pathsplit($szpath, ByRef $szdrive, ByRef $szdir, ByRef $szfname, ByRef $szext) Local $drive = "" Local $dir = "" Local $fname = "" Local $ext = "" Local $pos Local $array[5] $array[0] = $szpath If StringMid($szpath, 2, 1) = ":" Then $drive = StringLeft($szpath, 2) $szpath = StringTrimLeft($szpath, 2) ElseIf StringLeft($szpath, 2) = "\\" Then $szpath = StringTrimLeft($szpath, 2) $pos = StringInStr($szpath, "\") If $pos = 0 Then $pos = StringInStr($szpath, "/") If $pos = 0 Then $drive = "\\" & $szpath $szpath = "" Else $drive = "\\" & StringLeft($szpath, $pos - 1) $szpath = StringTrimLeft($szpath, $pos - 1) EndIf EndIf Local $nposforward = StringInStr($szpath, "/", 0, -1) Local $nposbackward = StringInStr($szpath, "\", 0, -1) If $nposforward >= $nposbackward Then $pos = $nposforward Else $pos = $nposbackward EndIf $dir = StringLeft($szpath, $pos) $fname = StringRight($szpath, StringLen($szpath) - $pos) If StringLen($dir) = 0 Then $fname = $szpath $pos = StringInStr($fname, ".", 0, -1) If $pos Then $ext = StringRight($fname, StringLen($fname) - ($pos - 1)) $fname = StringLeft($fname, $pos - 1) EndIf $szdrive = $drive $szdir = $dir $szfname = $fname $szext = $ext $array[1] = $drive $array[2] = $dir $array[3] = $fname $array[4] = $ext Return $array EndFunc Func _replacestringinfile($szfilename, $szsearchstring, $szreplacestring, $fcaseness = 0, $foccurance = 1) Local $iretval = 0 Local $ncount, $sendswith If StringInStr(FileGetAttrib($szfilename), "R") Then Return SetError(6, 0, -1) Local $hfile = FileOpen($szfilename, $fo_read) If $hfile = -1 Then Return SetError(1, 0, -1) Local $s_totfile = FileRead($hfile, FileGetSize($szfilename)) If StringRight($s_totfile, 2) = @CRLF Then $sendswith = @CRLF ElseIf StringRight($s_totfile, 1) = @CR Then $sendswith = @CR ElseIf StringRight($s_totfile, 1) = @LF Then $sendswith = @LF Else $sendswith = "" EndIf Local $afilelines = StringSplit(StringStripCR($s_totfile), @LF) FileClose($hfile) Local $hwritehandle = FileOpen($szfilename, $fo_overwrite) If $hwritehandle = -1 Then Return SetError(2, 0, -1) For $ncount = 1 To $afilelines[0] If StringInStr($afilelines[$ncount], $szsearchstring, $fcaseness) Then $afilelines[$ncount] = StringReplace($afilelines[$ncount], $szsearchstring, $szreplacestring, 1 - $foccurance, $fcaseness) $iretval = $iretval + 1 If $foccurance = 0 Then $iretval = 1 ExitLoop EndIf EndIf Next For $ncount = 1 To $afilelines[0] - 1 If FileWriteLine($hwritehandle, $afilelines[$ncount]) = 0 Then FileClose($hwritehandle) Return SetError(3, 0, -1) EndIf Next If $afilelines[$ncount] <> "" Then FileWrite($hwritehandle, $afilelines[$ncount] & $sendswith) FileClose($hwritehandle) Return $iretval EndFunc Func _tempfile($s_directoryname = @TempDir, $s_fileprefix = "~", $s_fileextension = ".tmp", $i_randomlength = 7) If NOT FileExists($s_directoryname) Then $s_directoryname = @TempDir If NOT FileExists($s_directoryname) Then $s_directoryname = @ScriptDir If StringRight($s_directoryname, 1) <> "\" Then $s_directoryname = $s_directoryname & "\" Local $s_tempname Do $s_tempname = "" While StringLen($s_tempname) < $i_randomlength $s_tempname = $s_tempname & Chr(Random(97, 122, 1)) WEnd $s_tempname = $s_directoryname & $s_fileprefix & $s_tempname & $s_fileextension Until NOT FileExists($s_tempname) Return $s_tempname EndFunc Func _arrayadd(ByRef $avarray, $vvalue) If NOT IsArray($avarray) Then Return SetError(1, 0, -1) If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, -1) Local $iubound = UBound($avarray) ReDim $avarray[$iubound + 1] $avarray[$iubound] = $vvalue Return $iubound EndFunc Func _arraybinarysearch(Const ByRef $avarray, $vvalue, $istart = 0, $iend = 0) If NOT IsArray($avarray) Then Return SetError(1, 0, -1) If UBound($avarray, 0) <> 1 Then Return SetError(5, 0, -1) Local $iubound = UBound($avarray) - 1 If $iend < 1 OR $iend > $iubound Then $iend = $iubound If $istart < 0 Then $istart = 0 If $istart > $iend Then Return SetError(4, 0, -1) Local $imid = Int(($iend + $istart) / 2) If $avarray[$istart] > $vvalue OR $avarray[$iend] < $vvalue Then Return SetError(2, 0, -1) While $istart <= $imid AND $vvalue <> $avarray[$imid] If $vvalue < $avarray[$imid] Then $iend = $imid - 1 Else $istart = $imid + 1 EndIf $imid = Int(($iend + $istart) / 2) WEnd If $istart > $iend Then Return SetError(3, 0, -1) Return $imid EndFunc Func _arraycombinations(ByRef $avarray, $iset, $sdelim = "") If NOT IsArray($avarray) Then Return SetError(1, 0, 0) If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, 0) Local $in = UBound($avarray) Local $ir = $iset Local $aidx[$ir] For $i = 0 To $ir - 1 $aidx[$i] = $i Next Local $itotal = __array_combinations($in, $ir) Local $ileft = $itotal Local $aresult[$itotal + 1] $aresult[0] = $itotal Local $icount = 1 While $ileft > 0 __array_getnext($in, $ir, $ileft, $itotal, $aidx) For $i = 0 To $iset - 1 $aresult[$icount] &= $avarray[$aidx[$i]] & $sdelim Next If $sdelim <> "" Then $aresult[$icount] = StringTrimRight($aresult[$icount], 1) $icount += 1 WEnd Return $aresult EndFunc Func _arrayconcatenate(ByRef $avarraytarget, Const ByRef $avarraysource, $istart = 0) If NOT IsArray($avarraytarget) Then Return SetError(1, 0, 0) If NOT IsArray($avarraysource) Then Return SetError(2, 0, 0) If UBound($avarraytarget, 0) <> 1 Then If UBound($avarraysource, 0) <> 1 Then Return SetError(5, 0, 0) Return SetError(3, 0, 0) EndIf If UBound($avarraysource, 0) <> 1 Then Return SetError(4, 0, 0) Local $iuboundtarget = UBound($avarraytarget) - $istart, $iuboundsource = UBound($avarraysource) ReDim $avarraytarget[$iuboundtarget + $iuboundsource] For $i = $istart To $iuboundsource - 1 $avarraytarget[$iuboundtarget + $i] = $avarraysource[$i] Next Return $iuboundtarget + $iuboundsource EndFunc Func _arraycreate($v_0, $v_1 = 0, $v_2 = 0, $v_3 = 0, $v_4 = 0, $v_5 = 0, $v_6 = 0, $v_7 = 0, $v_8 = 0, $v_9 = 0, $v_10 = 0, $v_11 = 0, $v_12 = 0, $v_13 = 0, $v_14 = 0, $v_15 = 0, $v_16 = 0, $v_17 = 0, $v_18 = 0, $v_19 = 0, $v_20 = 0) Local $av_array[21] = [$v_0, $v_1, $v_2, $v_3, $v_4, $v_5, $v_6, $v_7, $v_8, $v_9, $v_10, $v_11, $v_12, $v_13, $v_14, $v_15, $v_16, $v_17, $v_18, $v_19, $v_20] ReDim $av_array[@NumParams] Return $av_array EndFunc Func _arraydelete(ByRef $avarray, $ielement) If NOT IsArray($avarray) Then Return SetError(1, 0, 0) Local $iubound = UBound($avarray, 1) - 1 If NOT $iubound Then $avarray = "" Return 0 EndIf If $ielement < 0 Then $ielement = 0 If $ielement > $iubound Then $ielement = $iubound Switch UBound($avarray, 0) Case 1 For $i = $ielement To $iubound - 1 $avarray[$i] = $avarray[$i + 1] Next ReDim $avarray[$iubound] Case 2 Local $isubmax = UBound($avarray, 2) - 1 For $i = $ielement To $iubound - 1 For $j = 0 To $isubmax $avarray[$i][$j] = $avarray[$i + 1][$j] Next Next ReDim $avarray[$iubound][$isubmax + 1] Case Else Return SetError(3, 0, 0) EndSwitch Return $iubound EndFunc Func _arraydisplay(Const ByRef $avarray, $stitle = "Array: ListView Display", $iitemlimit = -1, $itranspose = 0, $sseparator = "", $sreplace = "|", $sheader = "") If NOT IsArray($avarray) Then Return SetError(1, 0, 0) Local $idimension = UBound($avarray, 0), $iubound = UBound($avarray, 1) - 1, $isubmax = UBound($avarray, 2) - 1 If $idimension > 2 Then Return SetError(2, 0, 0) If $sseparator = "" Then $sseparator = Chr(124) If _arraysearch($avarray, $sseparator, 0, 0, 0, 1) <> -1 Then For $x = 1 To 255 If $x >= 32 AND $x <= 127 Then ContinueLoop Local $sfind = _arraysearch($avarray, Chr($x), 0, 0, 0, 1) If $sfind = -1 Then $sseparator = Chr($x) ExitLoop EndIf Next EndIf Local $vtmp, $ibuffer = 64 Local $icollimit = 250 Local $ioneventmode = Opt("GUIOnEventMode", 0), $sdataseparatorchar = Opt("GUIDataSeparatorChar", $sseparator) If $isubmax < 0 Then $isubmax = 0 If $itranspose Then $vtmp = $iubound $iubound = $isubmax $isubmax = $vtmp EndIf If $isubmax > $icollimit Then $isubmax = $icollimit If $iitemlimit < 1 Then $iitemlimit = $iubound If $iubound > $iitemlimit Then $iubound = $iitemlimit If $sheader = "" Then $sheader = "Row " For $i = 0 To $isubmax $sheader &= $sseparator & "Col " & $i Next EndIf Local $avarraytext[$iubound + 1] For $i = 0 To $iubound $avarraytext[$i] = "[" & $i & "]" For $j = 0 To $isubmax If $idimension = 1 Then If $itranspose Then $vtmp = $avarray[$j] Else $vtmp = $avarray[$i] EndIf Else If $itranspose Then $vtmp = $avarray[$j][$i] Else $vtmp = $avarray[$i][$j] EndIf EndIf $vtmp = StringReplace($vtmp, $sseparator, $sreplace, 0, 1) $avarraytext[$i] &= $sseparator & $vtmp $vtmp = StringLen($vtmp) If $vtmp > $ibuffer Then $ibuffer = $vtmp Next Next $ibuffer += 1 Local Const $_arrayconstant_gui_dockborders = 102 Local Const $_arrayconstant_gui_dockbottom = 64 Local Const $_arrayconstant_gui_dockheight = 512 Local Const $_arrayconstant_gui_dockleft = 2 Local Const $_arrayconstant_gui_dockright = 4 Local Const $_arrayconstant_gui_event_close = -3 Local Const $_arrayconstant_lvif_param = 4 Local Const $_arrayconstant_lvif_text = 1 Local Const $_arrayconstant_lvm_getcolumnwidth = (4096 + 29) Local Const $_arrayconstant_lvm_getitemcount = (4096 + 4) Local Const $_arrayconstant_lvm_getitemstate = (4096 + 44) Local Const $_arrayconstant_lvm_insertitemw = (4096 + 77) Local Const $_arrayconstant_lvm_setextendedlistviewstyle = (4096 + 54) Local Const $_arrayconstant_lvm_setitemw = (4096 + 76) Local Const $_arrayconstant_lvs_ex_fullrowselect = 32 Local Const $_arrayconstant_lvs_ex_gridlines = 1 Local Const $_arrayconstant_lvs_showselalways = 8 Local Const $_arrayconstant_ws_ex_clientedge = 512 Local Const $_arrayconstant_ws_maximizebox = 65536 Local Const $_arrayconstant_ws_minimizebox = 131072 Local Const $_arrayconstant_ws_sizebox = 262144 Local Const $_arrayconstant_taglvitem = "int Mask;int Item;int SubItem;int State;int StateMask;ptr Text;int TextMax;int Image;int Param;int Indent;int GroupID;int Columns;ptr pColumns" Local $iaddmask = BitOR($_arrayconstant_lvif_text, $_arrayconstant_lvif_param) Local $tbuffer = DllStructCreate("wchar Text[" & $ibuffer & "]"), $pbuffer = DllStructGetPtr($tbuffer) Local $titem = DllStructCreate($_arrayconstant_taglvitem), $pitem = DllStructGetPtr($titem) DllStructSetData($titem, "Param", 0) DllStructSetData($titem, "Text", $pbuffer) DllStructSetData($titem, "TextMax", $ibuffer) Local $iwidth = 640, $iheight = 480 Local $hgui = GUICreate($stitle, $iwidth, $iheight, Default, Default, BitOR($_arrayconstant_ws_sizebox, $_arrayconstant_ws_minimizebox, $_arrayconstant_ws_maximizebox)) Local $aiguisize = WinGetClientSize($hgui) Local $hlistview = GUICtrlCreateListView($sheader, 0, 0, $aiguisize[0], $aiguisize[1] - 26, $_arrayconstant_lvs_showselalways) Local $hcopy = GUICtrlCreateButton("Copy Selected", 3, $aiguisize[1] - 23, $aiguisize[0] - 6, 20) GUICtrlSetResizing($hlistview, $_arrayconstant_gui_dockborders) GUICtrlSetResizing($hcopy, $_arrayconstant_gui_dockleft + $_arrayconstant_gui_dockright + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight) GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_lvs_ex_gridlines, $_arrayconstant_lvs_ex_gridlines) GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_lvs_ex_fullrowselect, $_arrayconstant_lvs_ex_fullrowselect) GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_ws_ex_clientedge, $_arrayconstant_ws_ex_clientedge) Local $aitem For $i = 0 To $iubound If GUICtrlCreateListViewItem($avarraytext[$i], $hlistview) = 0 Then $aitem = StringSplit($avarraytext[$i], $sseparator) DllStructSetData($tbuffer, "Text", $aitem[1]) DllStructSetData($titem, "Item", $i) DllStructSetData($titem, "SubItem", 0) DllStructSetData($titem, "Mask", $iaddmask) GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_insertitemw, 0, $pitem) DllStructSetData($titem, "Mask", $_arrayconstant_lvif_text) For $j = 2 To $aitem[0] DllStructSetData($tbuffer, "Text", $aitem[$j]) DllStructSetData($titem, "SubItem", $j - 1) GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_setitemw, 0, $pitem) Next EndIf Next $iwidth = 0 For $i = 0 To $isubmax + 1 $iwidth += GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_getcolumnwidth, $i, 0) Next If $iwidth < 250 Then $iwidth = 230 $iwidth += 20 If $iwidth > @DesktopWidth Then $iwidth = @DesktopWidth - 100 WinMove($hgui, "", (@DesktopWidth - $iwidth) / 2, Default, $iwidth) GUISetState(@SW_SHOW, $hgui) While 1 Switch GUIGetMsg() Case $_arrayconstant_gui_event_close ExitLoop Case $hcopy Local $sclip = "" Local $aicuritems[1] = [0] For $i = 0 To GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_getitemcount, 0, 0) If GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_getitemstate, $i, 2) Then $aicuritems[0] += 1 ReDim $aicuritems[$aicuritems[0] + 1] $aicuritems[$aicuritems[0]] = $i EndIf Next If NOT $aicuritems[0] Then For $sitem In $avarraytext $sclip &= $sitem & @CRLF Next Else For $i = 1 To UBound($aicuritems) - 1 $sclip &= $avarraytext[$aicuritems[$i]] & @CRLF Next EndIf ClipPut($sclip) EndSwitch WEnd GUIDelete($hgui) Opt("GUIOnEventMode", $ioneventmode) Opt("GUIDataSeparatorChar", $sdataseparatorchar) Return 1 EndFunc Func _arrayfindall(Const ByRef $avarray, $vvalue, $istart = 0, $iend = 0, $icase = 0, $ipartial = 0, $isubitem = 0) $istart = _arraysearch($avarray, $vvalue, $istart, $iend, $icase, $ipartial, 1, $isubitem) If @error Then Return SetError(@error, 0, -1) Local $iindex = 0, $avresult[UBound($avarray)] Do $avresult[$iindex] = $istart $iindex += 1 $istart = _arraysearch($avarray, $vvalue, $istart + 1, $iend, $icase, $ipartial, 1, $isubitem) Until @error ReDim $avresult[$iindex] Return $avresult EndFunc Func _arrayinsert(ByRef $avarray, $ielement, $vvalue = "") If NOT IsArray($avarray) Then Return SetError(1, 0, 0) If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, 0) Local $iubound = UBound($avarray) + 1 ReDim $avarray[$iubound] For $i = $iubound - 1 To $ielement + 1 Step -1 $avarray[$i] = $avarray[$i - 1] Next $avarray[$ielement] = $vvalue Return $iubound EndFunc Func _arraymax(Const ByRef $avarray, $icompnumeric = 0, $istart = 0, $iend = 0) Local $iresult = _arraymaxindex($avarray, $icompnumeric, $istart, $iend) If @error Then Return SetError(@error, 0, "") Return $avarray[$iresult] EndFunc Func _arraymaxindex(Const ByRef $avarray, $icompnumeric = 0, $istart = 0, $iend = 0) If NOT IsArray($avarray) OR UBound($avarray, 0) <> 1 Then Return SetError(1, 0, -1) If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, -1) Local $iubound = UBound($avarray) - 1 If $iend < 1 OR $iend > $iubound Then $iend = $iubound If $istart < 0 Then $istart = 0 If $istart > $iend Then Return SetError(2, 0, -1) Local $imaxindex = $istart If $icompnumeric Then For $i = $istart To $iend If Number($avarray[$imaxindex]) < Number($avarray[$i]) Then $imaxindex = $i Next Else For $i = $istart To $iend If $avarray[$imaxindex] < $avarray[$i] Then $imaxindex = $i Next EndIf Return $imaxindex EndFunc Func _arraymin(Const ByRef $avarray, $icompnumeric = 0, $istart = 0, $iend = 0) Local $iresult = _arrayminindex($avarray, $icompnumeric, $istart, $iend) If @error Then Return SetError(@error, 0, "") Return $avarray[$iresult] EndFunc Func _arrayminindex(Const ByRef $avarray, $icompnumeric = 0, $istart = 0, $iend = 0) If NOT IsArray($avarray) Then Return SetError(1, 0, -1) If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, -1) Local $iubound = UBound($avarray) - 1 If $iend < 1 OR $iend > $iubound Then $iend = $iubound If $istart < 0 Then $istart = 0 If $istart > $iend Then Return SetError(2, 0, -1) Local $iminindex = $istart If $icompnumeric Then For $i = $istart To $iend If Number($avarray[$iminindex]) > Number($avarray[$i]) Then $iminindex = $i Next Else For $i = $istart To $iend If $avarray[$iminindex] > $avarray[$i] Then $iminindex = $i Next EndIf Return $iminindex EndFunc Func _arraypermute(ByRef $avarray, $sdelim = "") If NOT IsArray($avarray) Then Return SetError(1, 0, 0) If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, 0) Local $isize = UBound($avarray), $ifactorial = 1, $aidx[$isize], $aresult[1], $icount = 1 For $i = 0 To $isize - 1 $aidx[$i] = $i Next For $i = $isize To 1 Step -1 $ifactorial *= $i Next ReDim $aresult[$ifactorial + 1] $aresult[0] = $ifactorial __array_exeterinternal($avarray, 0, $isize, $sdelim, $aidx, $aresult, $icount) Return $aresult EndFunc Func _arraypop(ByRef $avarray) If (NOT IsArray($avarray)) Then Return SetError(1, 0, "") If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, "") Local $iubound = UBound($avarray) - 1, $slastval = $avarray[$iubound] If NOT $iubound Then $avarray = "" Else ReDim $avarray[$iubound] EndIf Return $slastval EndFunc Func _arraypush(ByRef $avarray, $vvalue, $idirection = 0) If (NOT IsArray($avarray)) Then Return SetError(1, 0, 0) If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, 0) Local $iubound = UBound($avarray) - 1 If IsArray($vvalue) Then Local $iubounds = UBound($vvalue) If ($iubounds - 1) > $iubound Then Return SetError(2, 0, 0) If $idirection Then For $i = $iubound To $iubounds Step -1 $avarray[$i] = $avarray[$i - $iubounds] Next For $i = 0 To $iubounds - 1 $avarray[$i] = $vvalue[$i] Next Else For $i = 0 To $iubound - $iubounds $avarray[$i] = $avarray[$i + $iubounds] Next For $i = 0 To $iubounds - 1 $avarray[$i + $iubound - $iubounds + 1] = $vvalue[$i] Next EndIf Else If $idirection Then For $i = $iubound To 1 Step -1 $avarray[$i] = $avarray[$i - 1] Next $avarray[0] = $vvalue Else For $i = 0 To $iubound - 1 $avarray[$i] = $avarray[$i + 1] Next $avarray[$iubound] = $vvalue EndIf EndIf Return 1 EndFunc Func _arrayreverse(ByRef $avarray, $istart = 0, $iend = 0) If NOT IsArray($avarray) Then Return SetError(1, 0, 0) If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, 0) Local $vtmp, $iubound = UBound($avarray) - 1 If $iend < 1 OR $iend > $iubound Then $iend = $iubound If $istart < 0 Then $istart = 0 If $istart > $iend Then Return SetError(2, 0, 0) For $i = $istart To Int(($istart + $iend - 1) / 2) $vtmp = $avarray[$i] $avarray[$i] = $avarray[$iend] $avarray[$iend] = $vtmp $iend -= 1 Next Return 1 EndFunc Func _arraysearch(Const ByRef $avarray, $vvalue, $istart = 0, $iend = 0, $icase = 0, $ipartial = 0, $iforward = 1, $isubitem = -1) If NOT IsArray($avarray) Then Return SetError(1, 0, -1) If UBound($avarray, 0) > 2 OR UBound($avarray, 0) < 1 Then Return SetError(2, 0, -1) Local $iubound = UBound($avarray) - 1 If $iend < 1 OR $iend > $iubound Then $iend = $iubound If $istart < 0 Then $istart = 0 If $istart > $iend Then Return SetError(4, 0, -1) Local $istep = 1 If NOT $iforward Then Local $itmp = $istart $istart = $iend $iend = $itmp $istep = -1 EndIf Switch UBound($avarray, 0) Case 1 If NOT $ipartial Then If NOT $icase Then For $i = $istart To $iend Step $istep If $avarray[$i] = $vvalue Then Return $i Next Else For $i = $istart To $iend Step $istep If $avarray[$i] == $vvalue Then Return $i Next EndIf Else For $i = $istart To $iend Step $istep If StringInStr($avarray[$i], $vvalue, $icase) > 0 Then Return $i Next EndIf Case 2 Local $iuboundsub = UBound($avarray, 2) - 1 If $isubitem > $iuboundsub Then $isubitem = $iuboundsub If $isubitem < 0 Then $isubitem = 0 Else $iuboundsub = $isubitem EndIf For $j = $isubitem To $iuboundsub If NOT $ipartial Then If NOT $icase Then For $i = $istart To $iend Step $istep If $avarray[$i][$j] = $vvalue Then Return $i Next Else For $i = $istart To $iend Step $istep If $avarray[$i][$j] == $vvalue Then Return $i Next EndIf Else For $i = $istart To $iend Step $istep If StringInStr($avarray[$i][$j], $vvalue, $icase) > 0 Then Return $i Next EndIf Next Case Else Return SetError(7, 0, -1) EndSwitch Return SetError(6, 0, -1) EndFunc Func _arraysort(ByRef $avarray, $idescending = 0, $istart = 0, $iend = 0, $isubitem = 0) If NOT IsArray($avarray) Then Return SetError(1, 0, 0) Local $iubound = UBound($avarray) - 1 If $iend < 1 OR $iend > $iubound Then $iend = $iubound If $istart < 0 Then $istart = 0 If $istart > $iend Then Return SetError(2, 0, 0) Switch UBound($avarray, 0) Case 1 __arrayquicksort1d($avarray, $istart, $iend) If $idescending Then _arrayreverse($avarray, $istart, $iend) Case 2 Local $isubmax = UBound($avarray, 2) - 1 If $isubitem > $isubmax Then Return SetError(3, 0, 0) If $idescending Then $idescending = -1 Else $idescending = 1 EndIf __arrayquicksort2d($avarray, $idescending, $istart, $iend, $isubitem, $isubmax) Case Else Return SetError(4, 0, 0) EndSwitch Return 1 EndFunc Func __arrayquicksort1d(ByRef $avarray, ByRef $istart, ByRef $iend) If $iend <= $istart Then Return Local $vtmp If ($iend - $istart) < 15 Then Local $vcur For $i = $istart + 1 To $iend $vtmp = $avarray[$i] If IsNumber($vtmp) Then For $j = $i - 1 To $istart Step -1 $vcur = $avarray[$j] If ($vtmp >= $vcur AND IsNumber($vcur)) OR (NOT IsNumber($vcur) AND StringCompare($vtmp, $vcur) >= 0) Then ExitLoop $avarray[$j + 1] = $vcur Next Else For $j = $i - 1 To $istart Step -1 If (StringCompare($vtmp, $avarray[$j]) >= 0) Then ExitLoop $avarray[$j + 1] = $avarray[$j] Next EndIf $avarray[$j + 1] = $vtmp Next Return EndIf Local $l = $istart, $r = $iend, $vpivot = $avarray[Int(($istart + $iend) / 2)], $fnum = IsNumber($vpivot) Do If $fnum Then While ($avarray[$l] < $vpivot AND IsNumber($avarray[$l])) OR (NOT IsNumber($avarray[$l]) AND StringCompare($avarray[$l], $vpivot) < 0) $l += 1 WEnd While ($avarray[$r] > $vpivot AND IsNumber($avarray[$r])) OR (NOT IsNumber($avarray[$r]) AND StringCompare($avarray[$r], $vpivot) > 0) $r -= 1 WEnd Else While (StringCompare($avarray[$l], $vpivot) < 0) $l += 1 WEnd While (StringCompare($avarray[$r], $vpivot) > 0) $r -= 1 WEnd EndIf If $l <= $r Then $vtmp = $avarray[$l] $avarray[$l] = $avarray[$r] $avarray[$r] = $vtmp $l += 1 $r -= 1 EndIf Until $l > $r __arrayquicksort1d($avarray, $istart, $r) __arrayquicksort1d($avarray, $l, $iend) EndFunc Func __arrayquicksort2d(ByRef $avarray, ByRef $istep, ByRef $istart, ByRef $iend, ByRef $isubitem, ByRef $isubmax) If $iend <= $istart Then Return Local $vtmp, $l = $istart, $r = $iend, $vpivot = $avarray[Int(($istart + $iend) / 2)][$isubitem], $fnum = IsNumber($vpivot) Do If $fnum Then While ($istep * ($avarray[$l][$isubitem] - $vpivot) < 0 AND IsNumber($avarray[$l][$isubitem])) OR (NOT IsNumber($avarray[$l][$isubitem]) AND $istep * StringCompare($avarray[$l][$isubitem], $vpivot) < 0) $l += 1 WEnd While ($istep * ($avarray[$r][$isubitem] - $vpivot) > 0 AND IsNumber($avarray[$r][$isubitem])) OR (NOT IsNumber($avarray[$r][$isubitem]) AND $istep * StringCompare($avarray[$r][$isubitem], $vpivot) > 0) $r -= 1 WEnd Else While ($istep * StringCompare($avarray[$l][$isubitem], $vpivot) < 0) $l += 1 WEnd While ($istep * StringCompare($avarray[$r][$isubitem], $vpivot) > 0) $r -= 1 WEnd EndIf If $l <= $r Then For $i = 0 To $isubmax $vtmp = $avarray[$l][$i] $avarray[$l][$i] = $avarray[$r][$i] $avarray[$r][$i] = $vtmp Next $l += 1 $r -= 1 EndIf Until $l > $r __arrayquicksort2d($avarray, $istep, $istart, $r, $isubitem, $isubmax) __arrayquicksort2d($avarray, $istep, $l, $iend, $isubitem, $isubmax) EndFunc Func _arrayswap(ByRef $vitem1, ByRef $vitem2) Local $vtmp = $vitem1 $vitem1 = $vitem2 $vitem2 = $vtmp EndFunc Func _arraytoclip(Const ByRef $avarray, $istart = 0, $iend = 0) Local $sresult = _arraytostring($avarray, @CR, $istart, $iend) If @error Then Return SetError(@error, 0, 0) Return ClipPut($sresult) EndFunc Func _arraytostring(Const ByRef $avarray, $sdelim = "|", $istart = 0, $iend = 0) If NOT IsArray($avarray) Then Return SetError(1, 0, "") If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, "") Local $sresult, $iubound = UBound($avarray) - 1 If $iend < 1 OR $iend > $iubound Then $iend = $iubound If $istart < 0 Then $istart = 0 If $istart > $iend Then Return SetError(2, 0, "") For $i = $istart To $iend $sresult &= $avarray[$i] & $sdelim Next Return StringTrimRight($sresult, StringLen($sdelim)) EndFunc Func _arraytrim(ByRef $avarray, $itrimnum, $idirection = 0, $istart = 0, $iend = 0) If NOT IsArray($avarray) Then Return SetError(1, 0, 0) If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, 0) Local $iubound = UBound($avarray) - 1 If $iend < 1 OR $iend > $iubound Then $iend = $iubound If $istart < 0 Then $istart = 0 If $istart > $iend Then Return SetError(5, 0, 0) If $idirection Then For $i = $istart To $iend $avarray[$i] = StringTrimRight($avarray[$i], $itrimnum) Next Else For $i = $istart To $iend $avarray[$i] = StringTrimLeft($avarray[$i], $itrimnum) Next EndIf Return 1 EndFunc Func _arrayunique($aarray, $idimension = 1, $ibase = 0, $icase = 0, $vdelim = "|") Local $iubounddim If $vdelim = "|" Then $vdelim = Chr(1) If NOT IsArray($aarray) Then Return SetError(1, 0, 0) If NOT $idimension > 0 Then Return SetError(3, 0, 0) Else $iubounddim = UBound($aarray, 1) If @error Then Return SetError(3, 0, 0) If $idimension > 1 Then Local $aarraytmp[1] For $i = 0 To $iubounddim - 1 _arrayadd($aarraytmp, $aarray[$i][$idimension - 1]) Next _arraydelete($aarraytmp, 0) Else If UBound($aarray, 0) = 1 Then Dim $aarraytmp[1] For $i = 0 To $iubounddim - 1 _arrayadd($aarraytmp, $aarray[$i]) Next _arraydelete($aarraytmp, 0) Else Dim $aarraytmp[1] For $i = 0 To $iubounddim - 1 _arrayadd($aarraytmp, $aarray[$i][$idimension - 1]) Next _arraydelete($aarraytmp, 0) EndIf EndIf EndIf Local $shold For $icc = $ibase To UBound($aarraytmp) - 1 If NOT StringInStr($vdelim & $shold, $vdelim & $aarraytmp[$icc] & $vdelim, $icase) Then $shold &= $aarraytmp[$icc] & $vdelim Next If $shold Then $aarraytmp = StringSplit(StringTrimRight($shold, StringLen($vdelim)), $vdelim, 1) Return $aarraytmp EndIf Return SetError(2, 0, 0) EndFunc Func __array_exeterinternal(ByRef $avarray, $istart, $isize, $sdelim, ByRef $aidx, ByRef $aresult, ByRef $icount) If $istart == $isize - 1 Then For $i = 0 To $isize - 1 $aresult[$icount] &= $avarray[$aidx[$i]] & $sdelim Next If $sdelim <> "" Then $aresult[$icount] = StringTrimRight($aresult[$icount], 1) $icount += 1 Else Local $itemp For $i = $istart To $isize - 1 $itemp = $aidx[$i] $aidx[$i] = $aidx[$istart] $aidx[$istart] = $itemp __array_exeterinternal($avarray, $istart + 1, $isize, $sdelim, $aidx, $aresult, $icount) $aidx[$istart] = $aidx[$i] $aidx[$i] = $itemp Next EndIf EndFunc Func __array_combinations($in, $ir) Local $i_total = 1 For $i = $ir To 1 Step -1 $i_total *= ($in / $i) $in -= 1 Next Return Round($i_total) EndFunc Func __array_getnext($in, $ir, ByRef $ileft, $itotal, ByRef $aidx) If $ileft == $itotal Then $ileft -= 1 Return EndIf Local $i = $ir - 1 While $aidx[$i] == $in - $ir + $i $i -= 1 WEnd $aidx[$i] += 1 For $j = $i + 1 To $ir - 1 $aidx[$j] = $aidx[$i] + $j - $i Next $ileft -= 1 EndFunc Global Const $cb_err = -1 Global Const $cb_errattribute = -3 Global Const $cb_errrequired = -4 Global Const $cb_errspace = -2 Global Const $cb_okay = 0 Global Const $state_system_invisible = 32768 Global Const $state_system_pressed = 8 Global Const $cbs_autohscroll = 64 Global Const $cbs_disablenoscroll = 2048 Global Const $cbs_dropdown = 2 Global Const $cbs_dropdownlist = 3 Global Const $cbs_hasstrings = 512 Global Const $cbs_lowercase = 16384 Global Const $cbs_nointegralheight = 1024 Global Const $cbs_oemconvert = 128 Global Const $cbs_ownerdrawfixed = 16 Global Const $cbs_ownerdrawvariable = 32 Global Const $cbs_simple = 1 Global Const $cbs_sort = 256 Global Const $cbs_uppercase = 8192 Global Const $cbm_first = 5888 Global Const $cb_addstring = 323 Global Const $cb_deletestring = 324 Global Const $cb_dir = 325 Global Const $cb_findstring = 332 Global Const $cb_findstringexact = 344 Global Const $cb_getcomboboxinfo = 356 Global Const $cb_getcount = 326 Global Const $cb_getcuebanner = ($cbm_first + 4) Global Const $cb_getcursel = 327 Global Const $cb_getdroppedcontrolrect = 338 Global Const $cb_getdroppedstate = 343 Global Const $cb_getdroppedwidth = 351 Global Const $cb_geteditsel = 320 Global Const $cb_getextendedui = 342 Global Const $cb_gethorizontalextent = 349 Global Const $cb_getitemdata = 336 Global Const $cb_getitemheight = 340 Global Const $cb_getlbtext = 328 Global Const $cb_getlbtextlen = 329 Global Const $cb_getlocale = 346 Global Const $cb_getminvisible = 5890 Global Const $cb_gettopindex = 347 Global Const $cb_initstorage = 353 Global Const $cb_limittext = 321 Global Const $cb_resetcontent = 331 Global Const $cb_insertstring = 330 Global Const $cb_selectstring = 333 Global Const $cb_setcuebanner = ($cbm_first + 3) Global Const $cb_setcursel = 334 Global Const $cb_setdroppedwidth = 352 Global Const $cb_seteditsel = 322 Global Const $cb_setextendedui = 341 Global Const $cb_sethorizontalextent = 350 Global Const $cb_setitemdata = 337 Global Const $cb_setitemheight = 339 Global Const $cb_setlocale = 345 Global Const $cb_setminvisible = 5889 Global Const $cb_settopindex = 348 Global Const $cb_showdropdown = 335 Global Const $cbn_closeup = 8 Global Const $cbn_dblclk = 2 Global Const $cbn_dropdown = 7 Global Const $cbn_editchange = 5 Global Const $cbn_editupdate = 6 Global Const $cbn_errspace = (-1) Global Const $cbn_killfocus = 4 Global Const $cbn_selchange = 1 Global Const $cbn_selendcancel = 10 Global Const $cbn_selendok = 9 Global Const $cbn_setfocus = 3 Global Const $cbes_ex_casesensitive = 16 Global Const $cbes_ex_noeditimage = 1 Global Const $cbes_ex_noeditimageindent = 2 Global Const $cbes_ex_nosizelimit = 8 Global Const $cbes_ex_pathwordbreakproc = 4 Global Const $__comboboxconstant_wm_user = 1024 Global Const $cbem_deleteitem = $cb_deletestring Global Const $cbem_getcombocontrol = ($__comboboxconstant_wm_user + 6) Global Const $cbem_geteditcontrol = ($__comboboxconstant_wm_user + 7) Global Const $cbem_getexstyle = ($__comboboxconstant_wm_user + 9) Global Const $cbem_getextendedstyle = ($__comboboxconstant_wm_user + 9) Global Const $cbem_getimagelist = ($__comboboxconstant_wm_user + 3) Global Const $cbem_getitema = ($__comboboxconstant_wm_user + 4) Global Const $cbem_getitemw = ($__comboboxconstant_wm_user + 13) Global Const $cbem_getunicodeformat = 8192 + 6 Global Const $cbem_haseditchanged = ($__comboboxconstant_wm_user + 10) Global Const $cbem_insertitema = ($__comboboxconstant_wm_user + 1) Global Const $cbem_insertitemw = ($__comboboxconstant_wm_user + 11) Global Const $cbem_setexstyle = ($__comboboxconstant_wm_user + 8) Global Const $cbem_setextendedstyle = ($__comboboxconstant_wm_user + 14) Global Const $cbem_setimagelist = ($__comboboxconstant_wm_user + 2) Global Const $cbem_setitema = ($__comboboxconstant_wm_user + 5) Global Const $cbem_setitemw = ($__comboboxconstant_wm_user + 12) Global Const $cbem_setunicodeformat = 8192 + 5 Global Const $cbem_setwindowtheme = 8192 + 11 Global Const $cben_first = (-800) Global Const $cben_last = (-830) Global Const $cben_beginedit = ($cben_first - 4) Global Const $cben_deleteitem = ($cben_first - 2) Global Const $cben_dragbegina = ($cben_first - 8) Global Const $cben_dragbeginw = ($cben_first - 9) Global Const $cben_endedita = ($cben_first - 5) Global Const $cben_endeditw = ($cben_first - 6) Global Const $cben_getdispinfo = ($cben_first - 0) Global Const $cben_getdispinfoa = ($cben_first - 0) Global Const $cben_getdispinfow = ($cben_first - 7) Global Const $cben_insertitem = ($cben_first - 1) Global Const $cbeif_di_setitem = 268435456 Global Const $cbeif_image = 2 Global Const $cbeif_indent = 16 Global Const $cbeif_lparam = 32 Global Const $cbeif_overlay = 8 Global Const $cbeif_selectedimage = 4 Global Const $cbeif_text = 1 Global Const $__comboboxconstant_ws_vscroll = 2097152 Global Const $gui_ss_default_combo = BitOR($cbs_dropdown, $cbs_autohscroll, $__comboboxconstant_ws_vscroll) Dim $ss_notify, $uname, $domain, $pword, $daddrive $domain = "PHYSIO" $logfile = @ScriptDir & "\CacheCredentials.Log" $modulename = "CacheCredentials" $statuscode = 0 $statusmessage = $modulename & " completed successfully" _filewritelog($logfile, "Start " & @ScriptFullPath) _activatewindows() _userform() _cachecreds() Func _stopdad() $retcode = FileExists("dae.txt") If $retcode = 0 Then _filewritelog($logfile, "DAE.txt flag not found, will stop DAE, DAEUI and StartDAD processes for updates to take affect") #Region ### START Koda GUI section ### Form=p:\profile\my documents\dell dad stuff\autoit code\makeitstop\source code\daeui_form.kxf $form1_1 = GUICreate("", 1024, 768, -1, -1, BitOR($ws_maximizebox, $ws_popup, $ws_tabstop), 0) $pic1 = GUICtrlCreatePic("DAEUI.JPG", 0, 0, 1024, 768, BitOR($ss_notify, $ws_group, $ws_clipsiblings)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _filewritelog($logfile, "Creating DAE.txt flag to prevent stopping service again after task is rerun") $daefile = FileOpen("dae.txt", 2) FileClose($daefile) _deldaefromrunkey() _filewritelog($logfile, "Stopping StartDAD.exe") ProcessClose("StartDAD.exe") _filewritelog($logfile, "Stopping DAE.exe") ProcessClose("DAE.exe") _filewritelog($logfile, "Stopping DAEUI.exe") ProcessClose("DAEUI.exe") _filewritelog($logfile, "Stopping Breakout.exe") ProcessClose("Breakout.exe") _userform() Else $retcode = FileExists("profileerror.txt") If $retcode = 0 Then $retcode = FileDelete("dae.txt") $statuscode = 0 $statusmessage = "Successfully completed Profile Check" _writestatus() Else $retcode = FileDelete("dae.txt") $retcode = FileDelete("profileerror.txt") $statuscode = 2 $statusmessage = "Error creating profile locally" _writestatus() EndIf EndIf EndFunc Func _deldaefromrunkey() Dim $returncode _filewritelog($logfile, "Removing DAE from the Run key...") $returncode = RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "DAE") If $returncode = 0 Then _filewritelog($logfile, "DAE Run Key did not exist in registry") If $returncode = 1 Then _filewritelog($logfile, "Removed DAE Run Key from registry") If $returncode = 2 Then _filewritelog($logfile, "Error: Removing the DAE Run Key from registry") EndFunc Func _adddaetorunkey() Dim $rundad _filewritelog($logfile, "Adding DAE back to the Run key...") $rundad = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\run", "DAE") If $rundad = "" Then $addrundad = RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "DAE", "REG_SZ", "C:\distribution\engines\task\StartDAD.exe") _filewritelog($logfile, "Added StartDAD.exe to HKLM\SOFTWARE\Micrsoft\Windows\CurrentVersion\Run key with return code: " & $addrundad) Else _filewritelog($logfile, "DAE key already exists in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run") EndIf EndFunc Func _userform() HotKeySet("{Enter}", "_Submit") #Region ### START Koda GUI section ### Form=C:\Documents and Settings\dnolfo\Desktop\ASM\Scripts\forms\password_domain.kxf $form1_1 = GUICreate("Please enter your Username and Password", 362, 265, -1, -1, BitOR($ws_caption, $ws_popup, $ws_border, $ws_clipsiblings), BitOR($ws_ex_topmost, $ws_ex_windowedge)) $unamecode = GUICtrlCreateInput("", 120, 96, 193, 21) $pwordcode = GUICtrlCreateInput("", 120, 136, 193, 21, BitOR($es_password, $es_autohscroll)) $label1 = GUICtrlCreateLabel("Enter Username:", 32, 100, 80, 17) $label2 = GUICtrlCreateLabel("Enter Password:", 32, 141, 78, 17) $label4 = GUICtrlCreateLabel("Please enter your Physio Username and Password", 32, 24, 296, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $label5 = GUICtrlCreateLabel("to initialize your profile on your new PC.", 32, 48, 296, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $button1 = GUICtrlCreateButton("Submit", 136, 216, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nmsg = GUIGetMsg() If $nmsg = $button1 Then $uname = GUICtrlRead($unamecode) $pword = GUICtrlRead($pwordcode) If $uname = "" OR $pword = "" Then GUIDelete($form1_1) HotKeySet("{Enter}") MsgBox(48, "Blank value", "Username and Password cannot be blank" & @CRLF & "Click OK to re-enter") _filewritelog($logfile, "Blank username or password entered, prompt again") _userform() Else _filewritelog($logfile, "Username and password entered. About to validate credentials...") GUIDelete($form1_1) ExitLoop EndIf EndIf WEnd HotKeySet("{Enter}") _uservalidate($uname, $pword) EndFunc Func _uservalidate($username, $password) SplashTextOn("Dell Automated Deployment", "Verifying username and password, please wait...", -1, 20, -1, -1, 32, "", 12) Local $namespace = ObjGet("WinNT:") Local $ads_secure_authentication = 1 Local $domobj = $namespace.opendsobject("WinNT://" & $domain, $username, $password, $ads_secure_authentication) $retcode = @error If $retcode = 0 Then _filewritelog($logfile, "Credentials were verified!") SplashOff() _cachecreds() Else SplashOff() _filewritelog($logfile, "Could not verify entered credentials, prompt to retry or cancel") $retcode = MsgBox(53, "", "Could not verify credentials" & @CRLF & "Click OK to Retry") If $retcode = 4 Then _filewritelog($logfile, "Retrying, prompt again") _userform() Else _filewritelog($logfile, "User cancelled, start DAD and fail task") _filewritelog($logfile, "Write profileerror.txt flag") $pferror = FileOpen("profileerror.txt", 2) FileClose($pferror) Exit EndIf EndIf EndFunc Func comerror() If IsObj($omyerror) Then $hexnumber = Hex($omyerror.number, 8) SetError($hexnumber) Else SetError(1) EndIf Return 0 EndFunc Func _cachecreds() SplashTextOn("Dell Automated Deployment", "Creating local profile, please wait...", -1, 20, -1, -1, 32, "", 12) _filewritelog($logfile, "Caching credentials...") RunAs($uname, $domain, $pword, 1, "ipconfig.exe", @SystemDir, @SW_HIDE) $retcode = @error _filewritelog($logfile, "Return code = " & $retcode) If $retcode <> 0 Then _filewritelog($logfile, "Error caching credentials") SplashOff() Else ProcessWait("ipconfig.exe", 300) Sleep(1000) ProcessClose("ipconfig.exe") SplashOff() _filewritelog($logfile, "Credentials successfully cached!") EndIf EndFunc Func _startdad() SplashTextOn("Dell Automated Deployment", "Restarting DAD, please wait...", -1, 20, -1, -1, 32, "", 12) Sleep(1000) _adddaetorunkey() _filewritelog($logfile, "Restarting MOVEMOUSE.EXE...") $retcode = Run($daddrive & ":\Distribution\Data\Dell\MOVEMOUSE.EXE") _filewritelog($logfile, "Restarting Breakout.exe...") $retcode = Run($daddrive & ":\Distribution\Data\Dell\Breakout.exe") _filewritelog($logfile, "Restarting DAE.exe...") $retcode = Run($daddrive & ":\Distribution\Engines\DAE\DAE.exe") Sleep(5000) SplashOff() Exit EndFunc Func _findusb() $avarray = _arraycreate("C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "W", "X") For $i = 0 To 21 $returncode = FileExists($avarray[$i] & ":\distribution\engines\task\dad.ini") If $returncode = 1 Then $daddrive = $avarray[$i] _filewritelog($logfile, "The DAD Container was located on drive: " & $avarray[$i]) EndIf If $returncode = 1 Then ExitLoop Next If $returncode = 0 Then $statusmessage = "Unable to locate the distribution container" _filewritelog($logfile, "The DAD Container was not located") Exit EndIf Return $daddrive EndFunc Func _writestatus() $date = @MON & "-" & @MDAY & "-" & @YEAR $time = @HOUR & ":" & @MIN & ":" & @SEC #Region *** Creates a copy of what is about to be written to the status.xml file inside of the Module log file *** _filewritelog($logfile, "Gathered the following module information...") _filewritelog($logfile, " ModuleName: " & $modulename) _filewritelog($logfile, " Execution Date: " & $date) _filewritelog($logfile, " Execution Time: " & $time) _filewritelog($logfile, " Execution Status Code: " & $statuscode) _filewritelog($logfile, " Execution Status Message: " & $statusmessage) #EndRegion *** Creates a copy of what is about to be written to the status.xml file inside of the Module log file *** _filewritelog($logfile, "_WriteStatus function has been started") $file = FileOpen($daddrive & ":\distribution\engines\dae\status.xml", 2) If $file = -1 Then _filewritelog($logfile, "Error opening status.xml") $statusmessage = "Can't open status.xml for writing" EndIf FileWrite($file, "" & @CRLF) FileWrite($file, " " & $modulename & "" & @CRLF) FileWrite($file, " " & $date & "" & @CRLF) FileWrite($file, " " & @CRLF) FileWrite($file, " " & $statuscode & "" & @CRLF) FileWrite($file, " " & $statusmessage & "" & @CRLF) FileWrite($file, " 0" & @CRLF) FileWrite($file, "" & @CRLF) FileClose($file) Exit EndFunc Func _submit() $retcode = ControlClick("Please enter your Username and Password", "", "[CLASS:Button; TEXT:Submit; INSTANCE:1]") EndFunc Func _activatewindows() Dim $cmd, $dir $dir = "C:\Windows\system32" $cmd = $dir & "\slmgr.vbs /ato" RunWait('cscript "' & $cmd & '"', $dir) EndFunc