Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $account = IniRead("config.ini", "Main", "Account", "")
- $password = IniRead("config.ini", "Main", "Password", "")
- $realm = IniRead("config.ini", "Main", "Realm", "")
- Global Const $opt_coordsrelative = 0
- Global Const $opt_coordsabsolute = 1
- Global Const $opt_coordsclient = 2
- Global Const $opt_errorsilent = 0
- Global Const $opt_errorfatal = 1
- Global Const $opt_capsnostore = 0
- Global Const $opt_capsstore = 1
- Global Const $opt_matchstart = 1
- Global Const $opt_matchany = 2
- Global Const $opt_matchexact = 3
- Global Const $opt_matchadvanced = 4
- Global Const $ccs_top = 1
- Global Const $ccs_nomovey = 2
- Global Const $ccs_bottom = 3
- Global Const $ccs_noresize = 4
- Global Const $ccs_noparentalign = 8
- Global Const $ccs_nohilite = 16
- Global Const $ccs_adjustable = 32
- Global Const $ccs_nodivider = 64
- Global Const $ccs_vert = 128
- Global Const $ccs_left = 129
- Global Const $ccs_nomovex = 130
- Global Const $ccs_right = 131
- Global Const $dt_drivetype = 1
- Global Const $dt_ssdstatus = 2
- Global Const $dt_bustype = 3
- Global Const $proxy_ie = 0
- Global Const $proxy_none = 1
- Global Const $proxy_specified = 2
- Global Const $objid_window = 0
- Global Const $objid_titlebar = -2
- Global Const $objid_sizegrip = -7
- Global Const $objid_caret = -8
- Global Const $objid_cursor = -9
- Global Const $objid_alert = -10
- Global Const $objid_sound = -11
- Global Const $dlg_centerontop = 0
- Global Const $dlg_notitle = 1
- Global Const $dlg_notontop = 2
- Global Const $dlg_textleft = 4
- Global Const $dlg_textright = 8
- Global Const $dlg_moveable = 16
- Global Const $dlg_textvcenter = 32
- Global Const $idc_unknown = 0
- Global Const $idc_appstarting = 1
- Global Const $idc_arrow = 2
- Global Const $idc_cross = 3
- Global Const $idc_hand = 32649
- Global Const $idc_help = 4
- Global Const $idc_ibeam = 5
- Global Const $idc_icon = 6
- Global Const $idc_no = 7
- Global Const $idc_size = 8
- Global Const $idc_sizeall = 9
- Global Const $idc_sizenesw = 10
- Global Const $idc_sizens = 11
- Global Const $idc_sizenwse = 12
- Global Const $idc_sizewe = 13
- Global Const $idc_uparrow = 14
- Global Const $idc_wait = 15
- Global Const $idi_application = 32512
- Global Const $idi_asterisk = 32516
- Global Const $idi_exclamation = 32515
- Global Const $idi_hand = 32513
- Global Const $idi_question = 32514
- Global Const $idi_winlogo = 32517
- Global Const $idi_shield = 32518
- Global Const $idi_error = $idi_hand
- Global Const $idi_information = $idi_asterisk
- Global Const $idi_warning = $idi_exclamation
- Global Const $sd_logoff = 0
- Global Const $sd_shutdown = 1
- Global Const $sd_reboot = 2
- Global Const $sd_force = 4
- Global Const $sd_powerdown = 8
- Global Const $sd_forcehung = 16
- Global Const $sd_standby = 32
- Global Const $sd_hibernate = 64
- Global Const $stdin_child = 1
- Global Const $stdout_child = 2
- Global Const $stderr_child = 4
- Global Const $stderr_merged = 8
- Global Const $stdio_inherit_parent = 16
- Global Const $run_create_new_console = 65536
- Global Const $ubound_dimensions = 0
- Global Const $ubound_rows = 1
- Global Const $ubound_columns = 2
- Global Const $mouseeventf_absolute = 32768
- Global Const $mouseeventf_move = 1
- Global Const $mouseeventf_leftdown = 2
- Global Const $mouseeventf_leftup = 4
- Global Const $mouseeventf_rightdown = 8
- Global Const $mouseeventf_rightup = 16
- Global Const $mouseeventf_middledown = 32
- Global Const $mouseeventf_middleup = 64
- Global Const $mouseeventf_wheel = 2048
- Global Const $mouseeventf_xdown = 128
- Global Const $mouseeventf_xup = 256
- Global Const $reg_none = 0
- Global Const $reg_sz = 1
- Global Const $reg_expand_sz = 2
- Global Const $reg_binary = 3
- Global Const $reg_dword = 4
- Global Const $reg_dword_little_endian = 4
- Global Const $reg_dword_big_endian = 5
- Global Const $reg_link = 6
- Global Const $reg_multi_sz = 7
- Global Const $reg_resource_list = 8
- Global Const $reg_full_resource_descriptor = 9
- Global Const $reg_resource_requirements_list = 10
- Global Const $reg_qword = 11
- Global Const $reg_qword_little_endian = 11
- Global Const $hwnd_bottom = 1
- Global Const $hwnd_notopmost = -2
- Global Const $hwnd_top = 0
- Global Const $hwnd_topmost = -1
- Global Const $swp_nosize = 1
- Global Const $swp_nomove = 2
- Global Const $swp_nozorder = 4
- Global Const $swp_noredraw = 8
- Global Const $swp_noactivate = 16
- Global Const $swp_framechanged = 32
- Global Const $swp_drawframe = 32
- Global Const $swp_showwindow = 64
- Global Const $swp_hidewindow = 128
- Global Const $swp_nocopybits = 256
- Global Const $swp_noownerzorder = 512
- Global Const $swp_noreposition = 512
- Global Const $swp_nosendchanging = 1024
- Global Const $swp_defererase = 8192
- Global Const $swp_asyncwindowpos = 16384
- Global Const $keyword_default = 1
- Global Const $keyword_null = 2
- Global Const $declared_local = -1
- Global Const $declared_unknown = 0
- Global Const $declared_global = 1
- Global Const $assign_create = 0
- Global Const $assign_forcelocal = 1
- Global Const $assign_forceglobal = 2
- Global Const $assign_existfail = 4
- Global Const $bi_enable = 0
- Global Const $bi_disable = 1
- Global Const $break_enable = 1
- Global Const $break_disable = 0
- Global Const $cdtray_open = "open"
- Global Const $cdtray_closed = "closed"
- Global Const $send_default = 0
- Global Const $send_raw = 1
- Global Const $dir_default = 0
- Global Const $dir_extended = 1
- Global Const $dir_norecurse = 2
- Global Const $dir_remove = 1
- Global Const $dt_all = "ALL"
- Global Const $dt_cdrom = "CDROM"
- Global Const $dt_removable = "REMOVABLE"
- Global Const $dt_fixed = "FIXED"
- Global Const $dt_network = "NETWORK"
- Global Const $dt_ramdisk = "RAMDISK"
- Global Const $dt_unknown = "UNKNOWN"
- Global Const $dt_undefined = 1
- Global Const $dt_fat = "FAT"
- Global Const $dt_fat32 = "FAT32"
- Global Const $dt_exfat = "exFAT"
- Global Const $dt_ntfs = "NTFS"
- Global Const $dt_nwfs = "NWFS"
- Global Const $dt_cdfs = "CDFS"
- Global Const $dt_udf = "UDF"
- Global Const $dma_default = 0
- Global Const $dma_persistent = 1
- Global Const $dma_authentication = 8
- Global Const $ds_unknown = "UNKNOWN"
- Global Const $ds_ready = "READY"
- Global Const $ds_notready = "NOTREADY"
- Global Const $ds_invalid = "INVALID"
- Global Const $mouse_click_left = "left"
- Global Const $mouse_click_right = "right"
- Global Const $mouse_click_middle = "middle"
- Global Const $mouse_click_main = "main"
- Global Const $mouse_click_menu = "menu"
- Global Const $mouse_click_primary = "primary"
- Global Const $mouse_click_secondary = "secondary"
- Global Const $mouse_wheel_up = "up"
- Global Const $mouse_wheel_down = "down"
- Global Const $number_auto = 0
- Global Const $number_32bit = 1
- Global Const $number_64bit = 2
- Global Const $number_double = 3
- Global Const $obj_name = 1
- Global Const $obj_string = 2
- Global Const $obj_progid = 3
- Global Const $obj_file = 4
- Global Const $obj_module = 5
- Global Const $obj_clsid = 6
- Global Const $obj_iid = 7
- Global Const $exitclose_normal = 0
- Global Const $exitclose_byexit = 1
- Global Const $exitclose_byclick = 2
- Global Const $exitclose_bylogoff = 3
- Global Const $exitclose_byshutdown = 4
- Global Const $process_stats_memory = 0
- Global Const $process_stats_io = 1
- Global Const $process_low = 0
- Global Const $process_belownormal = 1
- Global Const $process_normal = 2
- Global Const $process_abovenormal = 3
- Global Const $process_high = 4
- Global Const $process_realtime = 5
- Global Const $run_logon_noprofile = 0
- Global Const $run_logon_profile = 1
- Global Const $run_logon_network = 2
- Global Const $run_logon_inherit = 4
- Global Const $sound_nowait = 0
- Global Const $sound_wait = 1
- Global Const $shex_open = "open"
- Global Const $shex_edit = "edit"
- Global Const $shex_print = "print"
- Global Const $shex_properties = "properties"
- Global Const $tcp_data_default = 0
- Global Const $tcp_data_binary = 1
- Global Const $udp_open_default = 0
- Global Const $udp_open_broadcast = 1
- Global Const $udp_data_default = 0
- Global Const $udp_data_binary = 1
- Global Const $udp_data_array = 2
- Global Const $tip_noicon = 0
- Global Const $tip_infoicon = 1
- Global Const $tip_warningicon = 2
- Global Const $tip_erroricon = 3
- Global Const $tip_balloon = 1
- Global Const $tip_center = 2
- Global Const $tip_forcevisible = 4
- Global Const $windows_noontop = 0
- Global Const $windows_ontop = 1
- Global Const $win_state_exists = 1
- Global Const $win_state_visible = 2
- Global Const $win_state_enabled = 4
- Global Const $win_state_active = 8
- Global Const $win_state_minimized = 16
- Global Const $win_state_maximized = 32
- Global Const $fc_nooverwrite = 0
- Global Const $fc_overwrite = 1
- Global Const $fc_createpath = 8
- Global Const $ft_modified = 0
- Global Const $ft_created = 1
- Global Const $ft_accessed = 2
- Global Const $ft_array = 0
- Global Const $ft_string = 1
- Global Const $fsf_createbutton = 1
- Global Const $fsf_newdialog = 2
- Global Const $fsf_editcontrol = 4
- Global Const $ft_nonrecursive = 0
- Global Const $ft_recursive = 1
- Global Const $fo_read = 0
- Global Const $fo_append = 1
- Global Const $fo_overwrite = 2
- Global Const $fo_createpath = 8
- 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 $fo_ansi = 512
- Global Const $fo_utf16_le_nobom = 1024
- Global Const $fo_utf16_be_nobom = 2048
- Global Const $fo_utf8_full = 16384
- Global Const $fo_fullfile_detect = 16384
- 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 $file_share_readwrite = BitOR($file_share_read, $file_share_write)
- Global Const $file_share_any = BitOR($file_share_read, $file_share_write, $file_share_delete)
- Global Const $generic_all = 268435456
- Global Const $generic_execute = 536870912
- Global Const $generic_write = 1073741824
- Global Const $generic_read = -2147483648
- Global Const $generic_readwrite = BitOR($generic_read, $generic_write)
- Global Const $file_encoding_utf16le = 32
- Global Const $fe_entire_utf8 = 1
- Global Const $fe_partialfirst_utf8 = 2
- Global Const $fn_fullpath = 0
- Global Const $fn_relativepath = 1
- Global Const $fv_comments = "Comments"
- Global Const $fv_companyname = "CompanyName"
- Global Const $fv_filedescription = "FileDescription"
- Global Const $fv_fileversion = "FileVersion"
- Global Const $fv_internalname = "InternalName"
- Global Const $fv_legalcopyright = "LegalCopyright"
- Global Const $fv_legaltrademarks = "LegalTrademarks"
- Global Const $fv_originalfilename = "OriginalFilename"
- Global Const $fv_productname = "ProductName"
- Global Const $fv_productversion = "ProductVersion"
- Global Const $fv_privatebuild = "PrivateBuild"
- Global Const $fv_specialbuild = "SpecialBuild"
- Global Const $frta_nocount = 0
- Global Const $frta_count = 1
- Global Const $frta_intarrays = 2
- Global Const $frta_entiresplit = 4
- Global Const $flta_filesfolders = 0
- Global Const $flta_files = 1
- Global Const $flta_folders = 2
- Global Const $fltar_filesfolders = 0
- Global Const $fltar_files = 1
- Global Const $fltar_folders = 2
- Global Const $fltar_nohidden = 4
- Global Const $fltar_nosystem = 8
- Global Const $fltar_nolink = 16
- Global Const $fltar_norecur = 0
- Global Const $fltar_recur = 1
- Global Const $fltar_nosort = 0
- Global Const $fltar_sort = 1
- Global Const $fltar_fastsort = 2
- Global Const $fltar_nopath = 0
- Global Const $fltar_relpath = 1
- Global Const $fltar_fullpath = 2
- Global Const $path_original = 0
- Global Const $path_drive = 1
- Global Const $path_directory = 2
- Global Const $path_filename = 3
- Global Const $path_extension = 4
- Global Const $mb_ok = 0
- Global Const $mb_okcancel = 1
- Global Const $mb_abortretryignore = 2
- Global Const $mb_yesnocancel = 3
- Global Const $mb_yesno = 4
- Global Const $mb_retrycancel = 5
- Global Const $mb_canceltrycontinue = 6
- Global Const $mb_help = 16384
- Global Const $mb_iconstop = 16
- Global Const $mb_iconerror = 16
- Global Const $mb_iconhand = 16
- Global Const $mb_iconquestion = 32
- Global Const $mb_iconexclamation = 48
- Global Const $mb_iconwarning = 48
- Global Const $mb_iconinformation = 64
- Global Const $mb_iconasterisk = 64
- Global Const $mb_usericon = 128
- Global Const $mb_defbutton1 = 0
- Global Const $mb_defbutton2 = 256
- Global Const $mb_defbutton3 = 512
- Global Const $mb_defbutton4 = 768
- Global Const $mb_applmodal = 0
- Global Const $mb_systemmodal = 4096
- Global Const $mb_taskmodal = 8192
- Global Const $mb_default_desktop_only = 131072
- Global Const $mb_right = 524288
- Global Const $mb_rtlreading = 1048576
- Global Const $mb_setforeground = 65536
- Global Const $mb_topmost = 262144
- Global Const $mb_service_notification = 2097152
- Global Const $mb_rightjustified = $mb_right
- Global Const $idtimeout = -1
- Global Const $idok = 1
- Global Const $idcancel = 2
- Global Const $idabort = 3
- Global Const $idretry = 4
- Global Const $idignore = 5
- Global Const $idyes = 6
- Global Const $idno = 7
- Global Const $idclose = 8
- Global Const $idhelp = 9
- Global Const $idtryagain = 10
- Global Const $idcontinue = 11
- Global Const $str_nocasesense = 0
- Global Const $str_casesense = 1
- Global Const $str_nocasesensebasic = 2
- Global Const $str_stripleading = 1
- Global Const $str_striptrailing = 2
- Global Const $str_stripspaces = 4
- Global Const $str_stripall = 8
- Global Const $str_chrsplit = 0
- Global Const $str_entiresplit = 1
- Global Const $str_nocount = 2
- Global Const $str_regexpmatch = 0
- Global Const $str_regexparraymatch = 1
- Global Const $str_regexparrayfullmatch = 2
- Global Const $str_regexparrayglobalmatch = 3
- Global Const $str_regexparrayglobalfullmatch = 4
- Global Const $str_endisstart = 0
- Global Const $str_endnotstart = 1
- Global Const $sb_ansi = 1
- Global Const $sb_utf16le = 2
- Global Const $sb_utf16be = 3
- Global Const $sb_utf8 = 4
- Global Const $se_utf16 = 0
- Global Const $se_ansi = 1
- Global Const $se_utf8 = 2
- Global Const $str_utf16 = 0
- Global Const $str_ucs2 = 1
- #Region Global Variables and Constants
- Global Const $format_message_allocate_buffer = 256
- Global Const $format_message_ignore_inserts = 512
- Global Const $format_message_from_string = 1024
- Global Const $format_message_from_hmodule = 2048
- Global Const $format_message_from_system = 4096
- Global Const $format_message_argument_array = 8192
- #EndRegion Global Variables and Constants
- Func _winapi_beep($ifreq = 500, $iduration = 1000)
- Local $aresult = DllCall("kernel32.dll", "bool", "Beep", "dword", $ifreq, "dword", $iduration)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_formatmessage($iflags, $psource, $imessageid, $ilanguageid, ByRef $pbuffer, $isize, $varguments)
- Local $sbuffertype = "struct*"
- If IsString($pbuffer) Then $sbuffertype = "wstr"
- Local $aresult = DllCall("kernel32.dll", "dword", "FormatMessageW", "dword", $iflags, "struct*", $psource, "dword", $imessageid, "dword", $ilanguageid, $sbuffertype, $pbuffer, "dword", $isize, "ptr", $varguments)
- If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
- If $sbuffertype = "wstr" Then $pbuffer = $aresult[5]
- Return $aresult[0]
- EndFunc
- Func _winapi_geterrormessage($icode, $ilanguage = 0, Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
- Local $aret = DllCall("kernel32.dll", "dword", "FormatMessageW", "dword", 4096, "ptr", 0, "dword", $icode, "dword", $ilanguage, "wstr", "", "dword", 4096, "ptr", 0)
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
- Return SetError($_icurrenterror, $_icurrentextended, StringRegExpReplace($aret[5], "[" & @LF & "," & @CR & "]*\Z", ""))
- EndFunc
- Func _winapi_getlasterror(Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
- Local $aresult = DllCall("kernel32.dll", "dword", "GetLastError")
- Return SetError($_icurrenterror, $_icurrentextended, $aresult[0])
- EndFunc
- Func _winapi_getlasterrormessage(Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
- Local $ilasterror = _winapi_getlasterror()
- Local $tbufferptr = DllStructCreate("ptr")
- Local $ncount = _winapi_formatmessage(BitOR($format_message_allocate_buffer, $format_message_from_system), 0, $ilasterror, 0, $tbufferptr, 0, 0)
- If @error Then Return SetError(-@error, @extended, "")
- Local $stext = ""
- Local $pbuffer = DllStructGetData($tbufferptr, 1)
- If $pbuffer Then
- If $ncount > 0 Then
- Local $tbuffer = DllStructCreate("wchar[" & ($ncount + 1) & "]", $pbuffer)
- $stext = DllStructGetData($tbuffer, 1)
- If StringRight($stext, 2) = @CRLF Then $stext = StringTrimRight($stext, 2)
- EndIf
- DllCall("kernel32.dll", "handle", "LocalFree", "handle", $pbuffer)
- EndIf
- Return SetError($_icurrenterror, $_icurrentextended, $stext)
- EndFunc
- Func _winapi_messagebeep($itype = 1)
- Local $isound
- Switch $itype
- Case 1
- $isound = 0
- Case 2
- $isound = 16
- Case 3
- $isound = 32
- Case 4
- $isound = 48
- Case 5
- $isound = 64
- Case Else
- $isound = -1
- EndSwitch
- Local $aresult = DllCall("user32.dll", "bool", "MessageBeep", "uint", $isound)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_msgbox($iflags, $stitle, $stext)
- BlockInput(0)
- MsgBox($iflags, $stitle, $stext & " ")
- EndFunc
- Func _winapi_setlasterror($ierrorcode, Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
- DllCall("kernel32.dll", "none", "SetLastError", "dword", $ierrorcode)
- Return SetError($_icurrenterror, $_icurrentextended, NULL )
- EndFunc
- Func _winapi_showerror($stext, $bexit = True)
- BlockInput(0)
- MsgBox($mb_systemmodal, "Error", $stext & " ")
- If $bexit Then Exit
- EndFunc
- Func _winapi_showlasterror($stext = "", $babort = False, $ilanguage = 0, Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
- Local $serror
- Local $ilasterror = _winapi_getlasterror()
- While 1
- $serror = _winapi_geterrormessage($ilasterror, $ilanguage)
- If @error AND $ilanguage Then
- $ilanguage = 0
- Else
- ExitLoop
- EndIf
- WEnd
- If StringStripWS($stext, $str_stripleading + $str_striptrailing) Then
- $stext &= @CRLF & @CRLF
- Else
- $stext = ""
- EndIf
- _winapi_msgbox(BitOR(262144, BitShift(16, -2 * (NOT $ilasterror))), $ilasterror, $stext & $serror)
- If $ilasterror Then
- _winapi_setlasterror($ilasterror)
- If $babort Then
- Exit $ilasterror
- EndIf
- EndIf
- Return SetError($_icurrenterror, $_icurrentextended, 1)
- EndFunc
- Func _winapi_showmsg($stext)
- _winapi_msgbox($mb_systemmodal, "Information", $stext)
- EndFunc
- Func __comerrorformating(ByRef $ocomerror, $sprefix = @TAB)
- Local Const $str_striptrailing = 2
- Local $serror = "COM Error encountered in " & @ScriptName & " (" & $ocomerror.scriptline & ") :" & @CRLF & $sprefix & "Number " & @TAB & "= 0x" & Hex($ocomerror.number, 8) & " (" & $ocomerror.number & ")" & @CRLF & $sprefix & "WinDescription" & @TAB & "= " & StringStripWS($ocomerror.windescription, $str_striptrailing) & @CRLF & $sprefix & "Description " & @TAB & "= " & StringStripWS($ocomerror.description, $str_striptrailing) & @CRLF & $sprefix & "Source " & @TAB & "= " & $ocomerror.source & @CRLF & $sprefix & "HelpFile " & @TAB & "= " & $ocomerror.helpfile & @CRLF & $sprefix & "HelpContext " & @TAB & "= " & $ocomerror.helpcontext & @CRLF & $sprefix & "LastDllError " & @TAB & "= " & $ocomerror.lastdllerror & @CRLF & $sprefix & "Retcode " & @TAB & "= 0x" & Hex($ocomerror.retcode)
- Return $serror
- EndFunc
- #Region Header
- #EndRegion Header
- #Region Global Variables
- Global $__g_iieloadwaittimeout = 300000
- Global $__g_bieau3debug = False
- Global $__g_bieerrornotify = True
- Global $__g_oieerrorhandler, $__g_sieusererrorhandler
- #EndRegion Global Variables
- #Region Global Constants
- Global Const $__gaieau3versioninfo[6] = ["T", 3, 0, 2, "20140819", "T3.0-2"]
- Global Const $lsfw_lock = 1, $lsfw_unlock = 2
- Global Enum $_iestatus_success = 0, $_iestatus_generalerror, $_iestatus_comerror, $_iestatus_invaliddatatype, $_iestatus_invalidobjecttype, $_iestatus_invalidvalue, $_iestatus_loadwaittimeout, $_iestatus_nomatch, $_iestatus_accessisdenied, $_iestatus_clientdisconnected
- #EndRegion Global Constants
- #Region Core functions
- Func _iecreate($surl = "about:blank", $itryattach = 0, $ivisible = 1, $iwait = 1, $itakefocus = 1)
- If NOT $ivisible Then $itakefocus = 0
- If $itryattach Then
- Local $oresult = _ieattach($surl, "url")
- If IsObj($oresult) Then
- If $itakefocus Then WinActivate(HWnd($oresult.hwnd))
- Return SetError($_iestatus_success, 1, $oresult)
- EndIf
- EndIf
- Local $imustunlock = 0
- If NOT $ivisible AND __ielocksetforegroundwindow($lsfw_lock) Then $imustunlock = 1
- Local $oobject = ObjCreate("InternetExplorer.Application")
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IECreate", "", "Browser Object Creation Failed")
- If $imustunlock Then __ielocksetforegroundwindow($lsfw_unlock)
- Return SetError($_iestatus_generalerror, 0, 0)
- EndIf
- $oobject.visible = $ivisible
- If $imustunlock AND NOT __ielocksetforegroundwindow($lsfw_unlock) Then __ieconsolewriteerror("Warning", "_IECreate", "", "Foreground Window Unlock Failed!")
- _ienavigate($oobject, $surl, $iwait)
- Local $ierror = @error
- If NOT $ierror AND StringLeft($surl, 6) = "about:" Then
- Local $odocument = $oobject.document
- _ieaction($odocument, "focus")
- EndIf
- Return SetError($ierror, 0, $oobject)
- EndFunc
- Func _iecreateembedded()
- Local $oobject = ObjCreate("Shell.Explorer.2")
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IECreateEmbedded", "", "WebBrowser Object Creation Failed")
- Return SetError($_iestatus_generalerror, 0, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject)
- EndFunc
- Func _ienavigate(ByRef $oobject, $surl, $iwait = 1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IENavigate", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "documentContainer") Then
- __ieconsolewriteerror("Error", "_IENavigate", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.navigate($surl)
- If @error Then
- __ieconsolewriteerror("Error", "_IENavigate", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- If $iwait Then
- _ieloadwait($oobject)
- Return SetError(@error, 0, -1)
- EndIf
- Return SetError($_iestatus_success, 0, -1)
- EndFunc
- Func _ieattach($sstring, $smode = "title", $iinstance = 1)
- $smode = StringLower($smode)
- $iinstance = Int($iinstance)
- If $iinstance < 1 Then
- __ieconsolewriteerror("Error", "_IEAttach", "$_IESTATUS_InvalidValue", "$iInstance < 1")
- Return SetError($_iestatus_invalidvalue, 3, 0)
- EndIf
- If $smode = "embedded" OR $smode = "dialogbox" Then
- Local $iwintitlematchmode = Opt("WinTitleMatchMode", $opt_matchany)
- If $smode = "dialogbox" AND $iinstance > 1 Then
- If IsHWnd($sstring) Then
- $iinstance = 1
- __ieconsolewriteerror("Warning", "_IEAttach", "$_IESTATUS_GeneralError", "$iInstance > 1 invalid with HWnd and DialogBox. Setting to 1.")
- Else
- Local $awinlist = WinList($sstring, "")
- If $iinstance <= $awinlist[0][0] Then
- $sstring = $awinlist[$iinstance][1]
- $iinstance = 1
- Else
- __ieconsolewriteerror("Warning", "_IEAttach", "$_IESTATUS_NoMatch")
- Opt("WinTitleMatchMode", $iwintitlematchmode)
- Return SetError($_iestatus_nomatch, 1, 0)
- EndIf
- EndIf
- EndIf
- Local $hcontrol = ControlGetHandle($sstring, "", "[CLASS:Internet Explorer_Server; INSTANCE:" & $iinstance & "]")
- Local $oresult = __iecontrolgetobjfromhwnd($hcontrol)
- Opt("WinTitleMatchMode", $iwintitlematchmode)
- If IsObj($oresult) Then
- Return SetError($_iestatus_success, 0, $oresult)
- Else
- __ieconsolewriteerror("Warning", "_IEAttach", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 1, 0)
- EndIf
- EndIf
- Local $oshell = ObjCreate("Shell.Application")
- Local $oshellwindows = $oshell.windows()
- Local $itmp = 1
- Local $inotifystatus, $bisbrowser, $stmp
- Local $bstatus
- For $owindow In $oshellwindows
- $bisbrowser = True
- $bstatus = __ieinternalerrorhandlerregister()
- If NOT $bstatus Then __ieconsolewriteerror("Warning", "_IEAttach", "Cannot register internal error handler, cannot trap COM errors", "Use _IEErrorHandlerRegister() to register a user error handler")
- $inotifystatus = _ieerrornotify()
- _ieerrornotify(False)
- If $bisbrowser Then
- $stmp = $owindow.type
- If @error Then $bisbrowser = False
- EndIf
- If $bisbrowser Then
- $stmp = $owindow.document.title
- If @error Then $bisbrowser = False
- EndIf
- _ieerrornotify($inotifystatus)
- __ieinternalerrorhandlerderegister()
- If $bisbrowser Then
- Switch $smode
- Case "title"
- If StringInStr($owindow.document.title, $sstring) > 0 Then
- If $iinstance = $itmp Then
- Return SetError($_iestatus_success, 0, $owindow)
- Else
- $itmp += 1
- EndIf
- EndIf
- Case "instance"
- If $iinstance = $itmp Then
- Return SetError($_iestatus_success, 0, $owindow)
- Else
- $itmp += 1
- EndIf
- Case "windowtitle"
- Local $bfound = False
- $stmp = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\", "Window Title")
- If NOT @error Then
- If StringInStr($owindow.document.title & " - " & $stmp, $sstring) Then $bfound = True
- Else
- If StringInStr($owindow.document.title & " - Microsoft Internet Explorer", $sstring) Then $bfound = True
- If StringInStr($owindow.document.title & " - Windows Internet Explorer", $sstring) Then $bfound = True
- EndIf
- If $bfound Then
- If $iinstance = $itmp Then
- Return SetError($_iestatus_success, 0, $owindow)
- Else
- $itmp += 1
- EndIf
- EndIf
- Case "url"
- If StringInStr($owindow.locationurl, $sstring) > 0 Then
- If $iinstance = $itmp Then
- Return SetError($_iestatus_success, 0, $owindow)
- Else
- $itmp += 1
- EndIf
- EndIf
- Case "text"
- If StringInStr($owindow.document.body.innertext, $sstring) > 0 Then
- If $iinstance = $itmp Then
- Return SetError($_iestatus_success, 0, $owindow)
- Else
- $itmp += 1
- EndIf
- EndIf
- Case "html"
- If StringInStr($owindow.document.body.innerhtml, $sstring) > 0 Then
- If $iinstance = $itmp Then
- Return SetError($_iestatus_success, 0, $owindow)
- Else
- $itmp += 1
- EndIf
- EndIf
- Case "hwnd"
- If $iinstance > 1 Then
- $iinstance = 1
- __ieconsolewriteerror("Warning", "_IEAttach", "$_IESTATUS_GeneralError", "$iInstance > 1 invalid with HWnd. Setting to 1.")
- EndIf
- If _iepropertyget($owindow, "hwnd") = $sstring Then
- Return SetError($_iestatus_success, 0, $owindow)
- EndIf
- Case Else
- __ieconsolewriteerror("Error", "_IEAttach", "$_IESTATUS_InvalidValue", "Invalid Mode Specified")
- Return SetError($_iestatus_invalidvalue, 2, 0)
- EndSwitch
- EndIf
- Next
- __ieconsolewriteerror("Warning", "_IEAttach", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 1, 0)
- EndFunc
- Func _ieloadwait(ByRef $oobject, $idelay = 0, $itimeout = -1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IELoadWait", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "browserdom") Then
- __ieconsolewriteerror("Error", "_IELoadWait", "$_IESTATUS_InvalidObjectType", ObjName($oobject))
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Local $otemp, $babort = False, $ierrorstatuscode = $_iestatus_success
- Local $bstatus = __ieinternalerrorhandlerregister()
- If NOT $bstatus Then __ieconsolewriteerror("Warning", "_IELoadWait", "Cannot register internal error handler, cannot trap COM errors", "Use _IEErrorHandlerRegister() to register a user error handler")
- Local $inotifystatus = _ieerrornotify()
- _ieerrornotify(False)
- Sleep($idelay)
- Local $ierror
- Local $hieloadwaittimer = TimerInit()
- If $itimeout = -1 Then $itimeout = $__g_iieloadwaittimeout
- Select
- Case __ieisobjtype($oobject, "browser", False)
- While NOT (String($oobject.readystate) = "complete" OR $oobject.readystate = 4 OR $babort)
- If @error Then
- $ierror = @error
- If __iecomerrorunrecoverable($ierror) Then
- $ierrorstatuscode = __iecomerrorunrecoverable($ierror)
- $babort = True
- EndIf
- ElseIf (TimerDiff($hieloadwaittimer) > $itimeout) Then
- $ierrorstatuscode = $_iestatus_loadwaittimeout
- $babort = True
- EndIf
- Sleep(100)
- WEnd
- While NOT (String($oobject.document.readystate) = "complete" OR $oobject.document.readystate = 4 OR $babort)
- If @error Then
- $ierror = @error
- If __iecomerrorunrecoverable($ierror) Then
- $ierrorstatuscode = __iecomerrorunrecoverable($ierror)
- $babort = True
- EndIf
- ElseIf (TimerDiff($hieloadwaittimer) > $itimeout) Then
- $ierrorstatuscode = $_iestatus_loadwaittimeout
- $babort = True
- EndIf
- Sleep(100)
- WEnd
- Case __ieisobjtype($oobject, "window", False)
- While NOT (String($oobject.document.readystate) = "complete" OR $oobject.document.readystate = 4 OR $babort)
- If @error Then
- $ierror = @error
- If __iecomerrorunrecoverable($ierror) Then
- $ierrorstatuscode = __iecomerrorunrecoverable($ierror)
- $babort = True
- EndIf
- ElseIf (TimerDiff($hieloadwaittimer) > $itimeout) Then
- $ierrorstatuscode = $_iestatus_loadwaittimeout
- $babort = True
- EndIf
- Sleep(100)
- WEnd
- While NOT (String($oobject.top.document.readystate) = "complete" OR $oobject.top.document.readystate = 4 OR $babort)
- If @error Then
- $ierror = @error
- If __iecomerrorunrecoverable($ierror) Then
- $ierrorstatuscode = __iecomerrorunrecoverable($ierror)
- $babort = True
- EndIf
- ElseIf (TimerDiff($hieloadwaittimer) > $itimeout) Then
- $ierrorstatuscode = $_iestatus_loadwaittimeout
- $babort = True
- EndIf
- Sleep(100)
- WEnd
- Case __ieisobjtype($oobject, "document", False)
- $otemp = $oobject.parentwindow
- While NOT (String($otemp.document.readystate) = "complete" OR $otemp.document.readystate = 4 OR $babort)
- If @error Then
- $ierror = @error
- If __iecomerrorunrecoverable($ierror) Then
- $ierrorstatuscode = __iecomerrorunrecoverable($ierror)
- $babort = True
- EndIf
- ElseIf (TimerDiff($hieloadwaittimer) > $itimeout) Then
- $ierrorstatuscode = $_iestatus_loadwaittimeout
- $babort = True
- EndIf
- Sleep(100)
- WEnd
- While NOT (String($otemp.top.document.readystate) = "complete" OR $otemp.top.document.readystate = 4 OR $babort)
- If @error Then
- $ierror = @error
- If __iecomerrorunrecoverable($ierror) Then
- $ierrorstatuscode = __iecomerrorunrecoverable($ierror)
- $babort = True
- EndIf
- ElseIf (TimerDiff($hieloadwaittimer) > $itimeout) Then
- $ierrorstatuscode = $_iestatus_loadwaittimeout
- $babort = True
- EndIf
- Sleep(100)
- WEnd
- Case Else
- $otemp = $oobject.document.parentwindow
- While NOT (String($otemp.document.readystate) = "complete" OR $otemp.document.readystate = 4 OR $babort)
- If @error Then
- $ierror = @error
- If __iecomerrorunrecoverable($ierror) Then
- $ierrorstatuscode = __iecomerrorunrecoverable($ierror)
- $babort = True
- EndIf
- ElseIf (TimerDiff($hieloadwaittimer) > $itimeout) Then
- $ierrorstatuscode = $_iestatus_loadwaittimeout
- $babort = True
- EndIf
- Sleep(100)
- WEnd
- While NOT (String($otemp.top.document.readystate) = "complete" OR $oobject.top.document.readystate = 4 OR $babort)
- If @error Then
- $ierror = @error
- If __iecomerrorunrecoverable($ierror) Then
- $ierrorstatuscode = __iecomerrorunrecoverable($ierror)
- $babort = True
- EndIf
- ElseIf (TimerDiff($hieloadwaittimer) > $itimeout) Then
- $ierrorstatuscode = $_iestatus_loadwaittimeout
- $babort = True
- EndIf
- Sleep(100)
- WEnd
- EndSelect
- _ieerrornotify($inotifystatus)
- __ieinternalerrorhandlerderegister()
- Switch $ierrorstatuscode
- Case $_iestatus_success
- Return SetError($_iestatus_success, 0, 1)
- Case $_iestatus_loadwaittimeout
- __ieconsolewriteerror("Warning", "_IELoadWait", "$_IESTATUS_LoadWaitTimeout")
- Return SetError($_iestatus_loadwaittimeout, 3, 0)
- Case $_iestatus_accessisdenied
- __ieconsolewriteerror("Warning", "_IELoadWait", "$_IESTATUS_AccessIsDenied", "Cannot verify readyState. Likely casue: cross-domain scripting security restriction. (" & $ierror & ")")
- Return SetError($_iestatus_accessisdenied, 0, 0)
- Case $_iestatus_clientdisconnected
- __ieconsolewriteerror("Error", "_IELoadWait", "$_IESTATUS_ClientDisconnected", $ierror & ", Browser has been deleted prior to operation.")
- Return SetError($_iestatus_clientdisconnected, 0, 0)
- Case Else
- __ieconsolewriteerror("Error", "_IELoadWait", "$_IESTATUS_GeneralError", "Invalid Error Status - Notify IE.au3 developer")
- Return SetError($_iestatus_generalerror, 0, 0)
- EndSwitch
- EndFunc
- Func _ieloadwaittimeout($itimeout = -1)
- If $itimeout = -1 Then
- Return SetError($_iestatus_success, 0, $__g_iieloadwaittimeout)
- Else
- $__g_iieloadwaittimeout = $itimeout
- Return SetError($_iestatus_success, 0, 1)
- EndIf
- EndFunc
- #EndRegion Core functions
- #Region Frame Functions
- Func _ieisframeset(ByRef $oobject)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEIsFrameSet", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If String($oobject.document.body.tagname) = "frameset" Then
- Return SetError($_iestatus_success, 0, 1)
- Else
- If @error Then
- __ieconsolewriteerror("Error", "_IEIsFrameSet", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- Return SetError($_iestatus_success, 0, 0)
- EndIf
- EndFunc
- Func _ieframegetcollection(ByRef $oobject, $iindex = -1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFrameGetCollection", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- $iindex = Number($iindex)
- Select
- Case $iindex = -1
- Return SetError($_iestatus_success, $oobject.document.parentwindow.frames.length, $oobject.document.parentwindow.frames)
- Case $iindex > -1 AND $iindex < $oobject.document.parentwindow.frames.length
- Return SetError($_iestatus_success, $oobject.document.parentwindow.frames.length, $oobject.document.parentwindow.frames.item($iindex))
- Case $iindex < -1
- __ieconsolewriteerror("Error", "_IEFrameGetCollection", "$_IESTATUS_InvalidValue", "$iIndex < -1")
- Return SetError($_iestatus_invalidvalue, 2, 0)
- Case Else
- __ieconsolewriteerror("Warning", "_IEFrameGetCollection", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 2, 0)
- EndSelect
- EndFunc
- Func _ieframegetobjbyname(ByRef $oobject, $sname)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFrameGetObjByName", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- Local $otemp, $oframes
- If NOT __ieisobjtype($oobject, "browserdom") Then
- __ieconsolewriteerror("Error", "_IEFrameGetObjByName", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- If __ieisobjtype($oobject, "document") Then
- $otemp = $oobject.parentwindow
- Else
- $otemp = $oobject.document.parentwindow
- EndIf
- If _ieisframeset($otemp) Then
- $oframes = _ietagnamegetcollection($otemp, "frame")
- Else
- $oframes = _ietagnamegetcollection($otemp, "iframe")
- EndIf
- If $oframes.length Then
- For $oframe In $oframes
- If String($oframe.name) = $sname Then Return SetError($_iestatus_success, 0, $otemp.frames($sname))
- Next
- __ieconsolewriteerror("Warning", "_IEFrameGetObjByName", "$_IESTATUS_NoMatch", "No frames matching name")
- Return SetError($_iestatus_nomatch, 2, 0)
- Else
- __ieconsolewriteerror("Warning", "_IEFrameGetObjByName", "$_IESTATUS_NoMatch", "No Frames found")
- Return SetError($_iestatus_nomatch, 2, 0)
- EndIf
- EndFunc
- #EndRegion Frame Functions
- #Region Link functions
- Func _ielinkclickbytext(ByRef $oobject, $slinktext, $iindex = 0, $iwait = 1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IELinkClickByText", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- Local $ifound = 0, $smodelinktext, $olinks = $oobject.document.links
- $iindex = Number($iindex)
- For $olink In $olinks
- $smodelinktext = String($olink.outertext)
- If $smodelinktext = $slinktext Then
- If ($ifound = $iindex) Then
- $olink.click()
- If @error Then
- __ieconsolewriteerror("Error", "_IELinkClickByText", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- If $iwait Then
- _ieloadwait($oobject)
- Return SetError(@error, 0, -1)
- EndIf
- Return SetError($_iestatus_success, 0, -1)
- EndIf
- $ifound = $ifound + 1
- EndIf
- Next
- __ieconsolewriteerror("Warning", "_IELinkClickByText", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 0, 0)
- EndFunc
- Func _ielinkclickbyindex(ByRef $oobject, $iindex, $iwait = 1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IELinkClickByIndex", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- Local $olinks = $oobject.document.links, $olink
- $iindex = Number($iindex)
- If ($iindex >= 0) AND ($iindex <= $olinks.length - 1) Then
- $olink = $olinks($iindex)
- $olink.click()
- If @error Then
- __ieconsolewriteerror("Error", "_IELinkClickByIndex", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- If $iwait Then
- _ieloadwait($oobject)
- Return SetError(@error, 0, -1)
- EndIf
- Return SetError($_iestatus_success, 0, -1)
- Else
- __ieconsolewriteerror("Warning", "_IELinkClickByIndex", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 2, 0)
- EndIf
- EndFunc
- Func _ielinkgetcollection(ByRef $oobject, $iindex = -1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IELinkGetCollection", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- $iindex = Number($iindex)
- Select
- Case $iindex = -1
- Return SetError($_iestatus_success, $oobject.document.links.length, $oobject.document.links)
- Case $iindex > -1 AND $iindex < $oobject.document.links.length
- Return SetError($_iestatus_success, $oobject.document.links.length, $oobject.document.links.item($iindex))
- Case $iindex < -1
- __ieconsolewriteerror("Error", "_IELinkGetCollection", "$_IESTATUS_InvalidValue")
- Return SetError($_iestatus_invalidvalue, 2, 0)
- Case Else
- __ieconsolewriteerror("Warning", "_IELinkGetCollection", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 2, 0)
- EndSelect
- EndFunc
- #EndRegion Link functions
- #Region Image functions
- Func _ieimgclick(ByRef $oobject, $slinktext, $smode = "src", $iindex = 0, $iwait = 1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEImgClick", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- Local $smodelinktext, $ifound = 0, $oimgs = $oobject.document.images
- $smode = StringLower($smode)
- $iindex = Number($iindex)
- For $oimg In $oimgs
- Select
- Case $smode = "alt"
- $smodelinktext = $oimg.alt
- Case $smode = "name"
- $smodelinktext = $oimg.name
- If NOT IsString($smodelinktext) Then $smodelinktext = $oimg.id
- Case $smode = "id"
- $smodelinktext = $oimg.id
- Case $smode = "src"
- $smodelinktext = $oimg.src
- Case Else
- __ieconsolewriteerror("Error", "_IEImgClick", "$_IESTATUS_InvalidValue", "Invalid mode: " & $smode)
- Return SetError($_iestatus_invalidvalue, 3, 0)
- EndSelect
- If StringInStr($smodelinktext, $slinktext) Then
- If ($ifound = $iindex) Then
- $oimg.click()
- If @error Then
- __ieconsolewriteerror("Error", "_IEImgClick", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- If $iwait Then
- _ieloadwait($oobject)
- Return SetError(@error, 0, -1)
- EndIf
- Return SetError($_iestatus_success, 0, -1)
- EndIf
- $ifound = $ifound + 1
- EndIf
- Next
- __ieconsolewriteerror("Warning", "_IEImgClick", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 0, 0)
- EndFunc
- Func _ieimggetcollection(ByRef $oobject, $iindex = -1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEImgGetCollection", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- Local $otemp = _iedocgetobj($oobject)
- $iindex = Number($iindex)
- Select
- Case $iindex = -1
- Return SetError($_iestatus_success, $otemp.images.length, $otemp.images)
- Case $iindex > -1 AND $iindex < $otemp.images.length
- Return SetError($_iestatus_success, $otemp.images.length, $otemp.images.item($iindex))
- Case $iindex < -1
- __ieconsolewriteerror("Error", "_IEImgGetCollection", "$_IESTATUS_InvalidValue", "$iIndex < -1")
- Return SetError($_iestatus_invalidvalue, 2, 0)
- Case Else
- __ieconsolewriteerror("Warning", "_IEImgGetCollection", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 1, 0)
- EndSelect
- EndFunc
- #EndRegion Image functions
- #Region Form functions
- Func _ieformgetcollection(ByRef $oobject, $iindex = -1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFormGetCollection", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- Local $otemp = _iedocgetobj($oobject)
- $iindex = Number($iindex)
- Select
- Case $iindex = -1
- Return SetError($_iestatus_success, $otemp.forms.length, $otemp.forms)
- Case $iindex > -1 AND $iindex < $otemp.forms.length
- Return SetError($_iestatus_success, $otemp.forms.length, $otemp.forms.item($iindex))
- Case $iindex < -1
- __ieconsolewriteerror("Error", "_IEFormGetCollection", "$_IESTATUS_InvalidValue", "$iIndex < -1")
- Return SetError($_iestatus_invalidvalue, 2, 0)
- Case Else
- __ieconsolewriteerror("Warning", "_IEFormGetCollection", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 1, 0)
- EndSelect
- EndFunc
- Func _ieformgetobjbyname(ByRef $oobject, $sname, $iindex = 0)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFormGetObjByName", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- Local $ilength = 0
- Local $ocol = $oobject.document.forms.item($sname)
- If IsObj($ocol) Then
- If __ieisobjtype($ocol, "elementcollection") Then
- $ilength = $ocol.length
- Else
- $ilength = 1
- EndIf
- EndIf
- $iindex = Number($iindex)
- If $iindex = -1 Then
- Return SetError($_iestatus_success, $ilength, $oobject.document.forms.item($sname))
- Else
- If IsObj($oobject.document.forms.item($sname, $iindex)) Then
- Return SetError($_iestatus_success, $ilength, $oobject.document.forms.item($sname, $iindex))
- Else
- __ieconsolewriteerror("Warning", "_IEFormGetObjByName", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 0, 0)
- EndIf
- EndIf
- EndFunc
- Func _ieformelementgetcollection(ByRef $oobject, $iindex = -1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFormElementGetCollection", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "form") Then
- __ieconsolewriteerror("Error", "_IEFormElementGetCollection", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $iindex = Number($iindex)
- Select
- Case $iindex = -1
- Return SetError($_iestatus_success, $oobject.elements.length, $oobject.elements)
- Case $iindex > -1 AND $iindex < $oobject.elements.length
- Return SetError($_iestatus_success, $oobject.elements.length, $oobject.elements.item($iindex))
- Case $iindex < -1
- __ieconsolewriteerror("Error", "_IEFormElementGetCollection", "$_IESTATUS_InvalidValue", "$iIndex < -1")
- Return SetError($_iestatus_invalidvalue, 2, 0)
- Case Else
- Return SetError($_iestatus_nomatch, 1, 0)
- EndSelect
- EndFunc
- Func _ieformelementgetobjbyname(ByRef $oobject, $sname, $iindex = 0)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFormElementGetObjByName", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "form") Then
- __ieconsolewriteerror("Error", "_IEFormElementGetObjByName", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Local $ilength = 0
- Local $ocol = $oobject.elements.item($sname)
- If IsObj($ocol) Then
- If __ieisobjtype($ocol, "elementcollection") Then
- $ilength = $ocol.length
- Else
- $ilength = 1
- EndIf
- EndIf
- $iindex = Number($iindex)
- If $iindex = -1 Then
- Return SetError($_iestatus_success, $ilength, $oobject.elements.item($sname))
- Else
- If IsObj($oobject.elements.item($sname, $iindex)) Then
- Return SetError($_iestatus_success, $ilength, $oobject.elements.item($sname, $iindex))
- Else
- __ieconsolewriteerror("Warning", "_IEFormElementGetObjByName", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 0, 0)
- EndIf
- EndIf
- EndFunc
- Func _ieformelementgetvalue(ByRef $oobject)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFormElementGetValue", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "forminputelement") Then
- __ieconsolewriteerror("Error", "_IEFormElementGetValue", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Local $sreturn = String($oobject.value)
- If @error Then
- __ieconsolewriteerror("Error", "_IEFormElementGetValue", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- SetError($_iestatus_success)
- Return $sreturn
- EndFunc
- Func _ieformelementsetvalue(ByRef $oobject, $snewvalue, $ifireevent = 1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFormElementSetValue", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "forminputelement") Then
- __ieconsolewriteerror("Error", "_IEFormElementSetValue", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- If String($oobject.type) = "file" Then
- __ieconsolewriteerror("Error", "_IEFormElementSetValue", "$_IESTATUS_InvalidObjectType", "Browser security prevents SetValue of TYPE=FILE")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.value = $snewvalue
- If @error Then
- __ieconsolewriteerror("Error", "_IEFormElementSetValue", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- If $ifireevent Then
- $oobject.fireevent("OnChange")
- $oobject.fireevent("OnClick")
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- EndFunc
- Func _ieformelementoptionselect(ByRef $oobject, $sstring, $iselect = 1, $smode = "byValue", $ifireevent = 1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFormElementOptionSelect", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "formselectelement") Then
- __ieconsolewriteerror("Error", "_IEFormElementOptionSelect", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Local $oitem, $oitems = $oobject.options, $inumitems = $oobject.options.length, $bismultiple = $oobject.multiple
- Switch $smode
- Case "byValue"
- For $oitem In $oitems
- If $oitem.value = $sstring Then
- Switch $iselect
- Case -1
- Return SetError($_iestatus_success, 0, $oitem.selected)
- Case 0
- If NOT $bismultiple Then
- __ieconsolewriteerror("Error", "_IEFormElementOptionSelect", "$_IESTATUS_InvalidValue", "$iSelect=0 only valid for type=select multiple")
- Return SetError($_iestatus_invalidvalue, 3)
- EndIf
- If $oitem.selected Then
- $oitem.selected = False
- If $ifireevent Then
- $oobject.fireevent("onChange")
- $oobject.fireevent("OnClick")
- EndIf
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- Case 1
- If NOT $oitem.selected Then
- $oitem.selected = True
- If $ifireevent Then
- $oobject.fireevent("onChange")
- $oobject.fireevent("OnClick")
- EndIf
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- Case Else
- __ieconsolewriteerror("Error", "_IEFormElementOptionSelect", "$_IESTATUS_InvalidValue", "Invalid $iSelect value")
- Return SetError($_iestatus_invalidvalue, 3, 0)
- EndSwitch
- EndIf
- Next
- __ieconsolewriteerror("Warning", "_IEFormElementOptionSelect", "$_IESTATUS_NoMatch", "Value not matched")
- Return SetError($_iestatus_nomatch, 2, 0)
- Case "byText"
- For $oitem In $oitems
- If String($oitem.text) = $sstring Then
- Switch $iselect
- Case -1
- Return SetError($_iestatus_success, 0, $oitem.selected)
- Case 0
- If NOT $bismultiple Then
- __ieconsolewriteerror("Error", "_IEFormElementOptionSelect", "$_IESTATUS_InvalidValue", "$iSelect=0 only valid for type=select multiple")
- Return SetError($_iestatus_invalidvalue, 3)
- EndIf
- If $oitem.selected Then
- $oitem.selected = False
- If $ifireevent Then
- $oobject.fireevent("onChange")
- $oobject.fireevent("OnClick")
- EndIf
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- Case 1
- If NOT $oitem.selected Then
- $oitem.selected = True
- If $ifireevent Then
- $oobject.fireevent("onChange")
- $oobject.fireevent("OnClick")
- EndIf
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- Case Else
- __ieconsolewriteerror("Error", "_IEFormElementOptionSelect", "$_IESTATUS_InvalidValue", "Invalid $iSelect value")
- Return SetError($_iestatus_invalidvalue, 3, 0)
- EndSwitch
- EndIf
- Next
- __ieconsolewriteerror("Warning", "_IEFormElementOptionSelect", "$_IESTATUS_NoMatch", "Text not matched")
- Return SetError($_iestatus_nomatch, 2, 0)
- Case "byIndex"
- Local $iindex = Number($sstring)
- If $iindex < 0 OR $iindex >= $inumitems Then
- __ieconsolewriteerror("Error", "_IEFormElementOptionSelect", "$_IESTATUS_InvalidValue", "Invalid index value, " & $iindex)
- Return SetError($_iestatus_invalidvalue, 2, 0)
- EndIf
- $oitem = $oitems.item($iindex)
- Switch $iselect
- Case -1
- Return SetError($_iestatus_success, 0, $oitems.item($iindex).selected)
- Case 0
- If NOT $bismultiple Then
- __ieconsolewriteerror("Error", "_IEFormElementOptionSelect", "$_IESTATUS_InvalidValue", "$iSelect=0 only valid for type=select multiple")
- Return SetError($_iestatus_invalidvalue, 3)
- EndIf
- If $oitem.selected Then
- $oitems.item($iindex).selected = False
- If $ifireevent Then
- $oobject.fireevent("onChange")
- $oobject.fireevent("OnClick")
- EndIf
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- Case 1
- If NOT $oitem.selected Then
- $oitems.item($iindex).selected = True
- If $ifireevent Then
- $oobject.fireevent("onChange")
- $oobject.fireevent("OnClick")
- EndIf
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- Case Else
- __ieconsolewriteerror("Error", "_IEFormElementOptionSelect", "$_IESTATUS_InvalidValue", "Invalid $iSelect value")
- Return SetError($_iestatus_invalidvalue, 3, 0)
- EndSwitch
- Case Else
- __ieconsolewriteerror("Error", "_IEFormElementOptionSelect", "$_IESTATUS_InvalidValue", "Invalid Mode")
- Return SetError($_iestatus_invalidvalue, 4, 0)
- EndSwitch
- EndFunc
- Func _ieformelementcheckboxselect(ByRef $oobject, $sstring, $sname = "", $iselect = 1, $smode = "byValue", $ifireevent = 1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFormElementCheckBoxSelect", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "form") Then
- __ieconsolewriteerror("Error", "_IEFormElementCheckBoxSelect", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $sstring = String($sstring)
- $sname = String($sname)
- Local $oitems
- If $sname = "" Then
- $oitems = _ietagnamegetcollection($oobject, "input")
- Else
- $oitems = Execute("$oObject.elements('" & $sname & "')")
- EndIf
- If NOT IsObj($oitems) Then
- __ieconsolewriteerror("Warning", "_IEFormElementCheckBoxSelect", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 3, 0)
- EndIf
- Local $oitem, $bfound = False
- Switch $smode
- Case "byValue"
- If __ieisobjtype($oitems, "forminputelement") Then
- $oitem = $oitems
- If String($oitem.type) = "checkbox" AND String($oitem.value) = $sstring Then $bfound = True
- Else
- For $oitem In $oitems
- If String($oitem.type) = "checkbox" AND String($oitem.value) = $sstring Then
- $bfound = True
- ExitLoop
- EndIf
- Next
- EndIf
- Case "byIndex"
- If __ieisobjtype($oitems, "forminputelement") Then
- $oitem = $oitems
- If String($oitem.type) = "checkbox" AND Number($sstring) = 0 Then $bfound = True
- Else
- Local $icount = 0
- For $oitem In $oitems
- If String($oitem.type) = "checkbox" AND Number($sstring) = $icount Then
- $bfound = True
- ExitLoop
- Else
- If String($oitem.type) = "checkbox" Then $icount += 1
- EndIf
- Next
- EndIf
- Case Else
- __ieconsolewriteerror("Error", "_IEFormElementCheckBoxSelect", "$_IESTATUS_InvalidValue", "Invalid Mode")
- Return SetError($_iestatus_invalidvalue, 5, 0)
- EndSwitch
- If NOT $bfound Then
- __ieconsolewriteerror("Warning", "_IEFormElementCheckBoxSelect", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 2, 0)
- EndIf
- Switch $iselect
- Case -1
- Return SetError($_iestatus_success, 0, $oitem.checked)
- Case 0
- If $oitem.checked Then
- $oitem.checked = False
- If $ifireevent Then
- $oitem.fireevent("onChange")
- $oitem.fireevent("OnClick")
- EndIf
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- Case 1
- If NOT $oitem.checked Then
- $oitem.checked = True
- If $ifireevent Then
- $oitem.fireevent("onChange")
- $oitem.fireevent("OnClick")
- EndIf
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- Case Else
- __ieconsolewriteerror("Error", "_IEFormElementCheckBoxSelect", "$_IESTATUS_InvalidValue", "Invalid $iSelect value")
- Return SetError($_iestatus_invalidvalue, 3, 0)
- EndSwitch
- EndFunc
- Func _ieformelementradioselect(ByRef $oobject, $sstring, $sname, $iselect = 1, $smode = "byValue", $ifireevent = 1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFormElementRadioSelect", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "form") Then
- __ieconsolewriteerror("Error", "_IEFormElementRadioSelect", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $sstring = String($sstring)
- $sname = String($sname)
- Local $oitems = Execute("$oObject.elements('" & $sname & "')")
- If NOT IsObj($oitems) Then
- __ieconsolewriteerror("Warning", "_IEFormElementRadioSelect", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 3, 0)
- EndIf
- Local $oitem, $bfound = False
- Switch $smode
- Case "byValue"
- If __ieisobjtype($oitems, "forminputelement") Then
- $oitem = $oitems
- If String($oitem.type) = "radio" AND String($oitem.value) = $sstring Then $bfound = True
- Else
- For $oitem In $oitems
- If String($oitem.type) = "radio" AND String($oitem.value) = $sstring Then
- $bfound = True
- ExitLoop
- EndIf
- Next
- EndIf
- Case "byIndex"
- If __ieisobjtype($oitems, "forminputelement") Then
- $oitem = $oitems
- If String($oitem.type) = "radio" AND Number($sstring) = 0 Then $bfound = True
- Else
- Local $icount = 0
- For $oitem In $oitems
- If String($oitem.type) = "radio" AND Number($sstring) = $icount Then
- $bfound = True
- ExitLoop
- Else
- $icount += 1
- EndIf
- Next
- EndIf
- Case Else
- __ieconsolewriteerror("Error", "_IEFormElementRadioSelect", "$_IESTATUS_InvalidValue", "Invalid Mode")
- Return SetError($_iestatus_invalidvalue, 5, 0)
- EndSwitch
- If NOT $bfound Then
- __ieconsolewriteerror("Warning", "_IEFormElementRadioSelect", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 2, 0)
- EndIf
- Switch $iselect
- Case -1
- Return SetError($_iestatus_success, 0, $oitem.checked)
- Case 0
- If $oitem.checked Then
- $oitem.checked = False
- If $ifireevent Then
- $oitem.fireevent("onChange")
- $oitem.fireevent("OnClick")
- EndIf
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- Case 1
- If NOT $oitem.checked Then
- $oitem.checked = True
- If $ifireevent Then
- $oitem.fireevent("onChange")
- $oitem.fireevent("OnClick")
- EndIf
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- Case Else
- __ieconsolewriteerror("Error", "_IEFormElementRadioSelect", "$_IESTATUS_InvalidValue", "$iSelect value invalid")
- Return SetError($_iestatus_invalidvalue, 4, 0)
- EndSwitch
- EndFunc
- Func _ieformimageclick(ByRef $oobject, $slinktext, $smode = "src", $iindex = 0, $iwait = 1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFormImageClick", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- Local $smodelinktext, $ifound = 0
- Local $otemp = _iedocgetobj($oobject)
- Local $oimgs = _ietagnamegetcollection($otemp, "input")
- $smode = StringLower($smode)
- $iindex = Number($iindex)
- For $oimg In $oimgs
- If String($oimg.type) = "image" Then
- Select
- Case $smode = "alt"
- $smodelinktext = $oimg.alt
- Case $smode = "name"
- $smodelinktext = $oimg.name
- If NOT IsString($smodelinktext) Then $smodelinktext = $oimg.id
- Case $smode = "id"
- $smodelinktext = $oimg.id
- Case $smode = "src"
- $smodelinktext = $oimg.src
- Case Else
- __ieconsolewriteerror("Error", "_IEFormImageClick", "$_IESTATUS_InvalidValue", "Invalid mode: " & $smode)
- Return SetError($_iestatus_invalidvalue, 3, 0)
- EndSelect
- If StringInStr($smodelinktext, $slinktext) Then
- If ($ifound = $iindex) Then
- $oimg.click()
- If @error Then
- __ieconsolewriteerror("Error", "_IEFormImageClick", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- If $iwait Then
- _ieloadwait($oobject)
- Return SetError(@error, 0, -1)
- EndIf
- Return SetError($_iestatus_success, 0, -1)
- EndIf
- $ifound = $ifound + 1
- EndIf
- EndIf
- Next
- __ieconsolewriteerror("Warning", "_IEFormImageClick", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 2, 0)
- EndFunc
- Func _ieformsubmit(ByRef $oobject, $iwait = 1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFormSubmit", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "form") Then
- __ieconsolewriteerror("Error", "_IEFormSubmit", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Local $owindow = $oobject.document.parentwindow
- $oobject.submit()
- If @error Then
- __ieconsolewriteerror("Error", "_IEFormSubmit", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- If $iwait Then
- _ieloadwait($owindow)
- Return SetError(@error, 0, -1)
- EndIf
- Return SetError($_iestatus_success, 0, -1)
- EndFunc
- Func _ieformreset(ByRef $oobject)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEFormReset", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "form") Then
- __ieconsolewriteerror("Error", "_IEFormReset", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.reset()
- If @error Then
- __ieconsolewriteerror("Error", "_IEFormReset", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- EndFunc
- #EndRegion Form functions
- #Region Table functions
- Func _ietablegetcollection(ByRef $oobject, $iindex = -1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IETableGetCollection", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- $iindex = Number($iindex)
- Select
- Case $iindex = -1
- Return SetError($_iestatus_success, $oobject.document.getelementsbytagname("table").length, $oobject.document.getelementsbytagname("table"))
- Case $iindex > -1 AND $iindex < $oobject.document.getelementsbytagname("table").length
- Return SetError($_iestatus_success, $oobject.document.getelementsbytagname("table").length, $oobject.document.getelementsbytagname("table").item($iindex))
- Case $iindex < -1
- __ieconsolewriteerror("Error", "_IETableGetCollection", "$_IESTATUS_InvalidValue", "$iIndex < -1")
- Return SetError($_iestatus_invalidvalue, 2, 0)
- Case Else
- __ieconsolewriteerror("Warning", "_IETableGetCollection", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 1, 0)
- EndSelect
- EndFunc
- Func _ietablewritetoarray(ByRef $oobject, $btranspose = False)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IETableWriteToArray", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "table") Then
- __ieconsolewriteerror("Error", "_IETableWriteToArray", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Local $icols = 0, $otds, $icol
- Local $otrs = $oobject.rows
- For $otr In $otrs
- $otds = $otr.cells
- $icol = 0
- For $otd In $otds
- $icol = $icol + $otd.colspan
- Next
- If $icol > $icols Then $icols = $icol
- Next
- Local $irows = $otrs.length
- Local $atablecells[$icols][$irows]
- Local $irow = 0
- For $otr In $otrs
- $otds = $otr.cells
- $icol = 0
- For $otd In $otds
- $atablecells[$icol][$irow] = String($otd.innertext)
- If @error Then
- __ieconsolewriteerror("Error", "_IETableWriteToArray", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- $icol = $icol + $otd.colspan
- Next
- $irow = $irow + 1
- Next
- If $btranspose Then
- Local $id1 = UBound($atablecells, $ubound_rows), $id2 = UBound($atablecells, $ubound_columns), $atmp[$id2][$id1]
- For $i = 0 To $id2 - 1
- For $j = 0 To $id1 - 1
- $atmp[$i][$j] = $atablecells[$j][$i]
- Next
- Next
- $atablecells = $atmp
- EndIf
- Return SetError($_iestatus_success, 0, $atablecells)
- EndFunc
- #EndRegion Table functions
- #Region Read/Write functions
- Func _iebodyreadhtml(ByRef $oobject)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEBodyReadHTML", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.document.body.innerhtml)
- EndFunc
- Func _iebodyreadtext(ByRef $oobject)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEBodyReadText", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "browserdom") Then
- __ieconsolewriteerror("Error", "_IEBodyReadText", "$_IESTATUS_InvalidObjectType", "Expected document element")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.document.body.innertext)
- EndFunc
- Func _iebodywritehtml(ByRef $oobject, $shtml)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEBodyWriteHTML", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "browserdom") Then
- __ieconsolewriteerror("Error", "_IEBodyWriteHTML", "$_IESTATUS_InvalidObjectType", "Expected document element")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.document.body.innerhtml = $shtml
- If @error Then
- __ieconsolewriteerror("Error", "_IEBodyWriteHTML", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- Local $otemp = $oobject.document
- _ieloadwait($otemp)
- Return SetError(@error, 0, -1)
- EndFunc
- Func _iedocreadhtml(ByRef $oobject)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEDocReadHTML", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "browserdom") Then
- __ieconsolewriteerror("Error", "_IEDocReadHTML", "$_IESTATUS_InvalidObjectType", "Expected document element")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.document.documentelement.outerhtml)
- EndFunc
- Func _iedocwritehtml(ByRef $oobject, $shtml)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEDocWriteHTML", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "browserdom") Then
- __ieconsolewriteerror("Error", "_IEDocWriteHTML", "$_IESTATUS_InvalidObjectType", "Expected document element")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.document.write($shtml)
- $oobject.document.close()
- Local $otemp = $oobject.document
- If @error Then
- __ieconsolewriteerror("Error", "_IEDocWriteHTML", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- _ieloadwait($otemp)
- Return SetError(@error, 0, -1)
- EndFunc
- Func _iedocinserttext(ByRef $oobject, $sstring, $swhere = "beforeend")
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEDocInsertText", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "browserdom") OR __ieisobjtype($oobject, "documentcontainer") OR __ieisobjtype($oobject, "document") Then
- __ieconsolewriteerror("Error", "_IEDocInsertText", "$_IESTATUS_InvalidObjectType", "Expected document element")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $swhere = StringLower($swhere)
- Select
- Case $swhere = "beforebegin"
- $oobject.insertadjacenttext($swhere, $sstring)
- Case $swhere = "afterbegin"
- $oobject.insertadjacenttext($swhere, $sstring)
- Case $swhere = "beforeend"
- $oobject.insertadjacenttext($swhere, $sstring)
- Case $swhere = "afterend"
- $oobject.insertadjacenttext($swhere, $sstring)
- Case Else
- __ieconsolewriteerror("Error", "_IEDocInsertText", "$_IESTATUS_InvalidValue", "Invalid where value")
- Return SetError($_iestatus_invalidvalue, 3, 0)
- EndSelect
- If @error Then
- __ieconsolewriteerror("Error", "_IEDocInsertText", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- EndFunc
- Func _iedocinserthtml(ByRef $oobject, $sstring, $swhere = "beforeend")
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEDocInsertHTML", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "browserdom") OR __ieisobjtype($oobject, "documentcontainer") OR __ieisobjtype($oobject, "document") Then
- __ieconsolewriteerror("Error", "_IEDocInsertHTML", "$_IESTATUS_InvalidObjectType", "Expected document element")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $swhere = StringLower($swhere)
- Select
- Case $swhere = "beforebegin"
- $oobject.insertadjacenthtml($swhere, $sstring)
- Case $swhere = "afterbegin"
- $oobject.insertadjacenthtml($swhere, $sstring)
- Case $swhere = "beforeend"
- $oobject.insertadjacenthtml($swhere, $sstring)
- Case $swhere = "afterend"
- $oobject.insertadjacenthtml($swhere, $sstring)
- Case Else
- __ieconsolewriteerror("Error", "_IEDocInsertHTML", "$_IESTATUS_InvalidValue", "Invalid where value")
- Return SetError($_iestatus_invalidvalue, 3, 0)
- EndSelect
- If @error Then
- __ieconsolewriteerror("Error", "_IEDocInsertHTML", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- EndFunc
- Func _ieheadinserteventscript(ByRef $oobject, $shtmlfor, $sevent, $sscript)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEHeadInsertEventScript", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- Local $ohead = $oobject.document.all.tags("HEAD").item(0)
- Local $oscript = $oobject.document.createelement("script")
- If @error Then
- __ieconsolewriteerror("Error", "_IEHeadInsertEventScript(script)", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- With $oscript
- .defer = True
- .language = "jscript"
- .type = "text/javascript"
- .htmlfor = $shtmlfor
- .event = $sevent
- .text = $sscript
- EndWith
- $ohead.appendchild($oscript)
- If @error Then
- __ieconsolewriteerror("Error", "_IEHeadInsertEventScript", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- EndFunc
- #EndRegion Read/Write functions
- #Region Utility functions
- Func _iedocgetobj(ByRef $oobject)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEDocGetObj", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If __ieisobjtype($oobject, "document") Then
- Return SetError($_iestatus_success, 0, $oobject)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.document)
- EndFunc
- Func _ietagnamegetcollection(ByRef $oobject, $stagname, $iindex = -1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IETagNameGetCollection", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "browserdom") Then
- __ieconsolewriteerror("Error", "_IETagNameGetCollection", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Local $otemp
- If __ieisobjtype($oobject, "documentcontainer") Then
- $otemp = _iedocgetobj($oobject)
- Else
- $otemp = $oobject
- EndIf
- $iindex = Number($iindex)
- Select
- Case $iindex = -1
- Return SetError($_iestatus_success, $otemp.getelementsbytagname($stagname).length, $otemp.getelementsbytagname($stagname))
- Case $iindex > -1 AND $iindex < $otemp.getelementsbytagname($stagname).length
- Return SetError($_iestatus_success, $otemp.getelementsbytagname($stagname).length, $otemp.getelementsbytagname($stagname).item($iindex))
- Case $iindex < -1
- __ieconsolewriteerror("Error", "_IETagNameGetCollection", "$_IESTATUS_InvalidValue", "$iIndex < -1")
- Return SetError($_iestatus_invalidvalue, 3, 0)
- Case Else
- __ieconsolewriteerror("Error", "_IETagNameGetCollection", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 0, 0)
- EndSelect
- EndFunc
- Func _ietagnameallgetcollection(ByRef $oobject, $iindex = -1)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IETagNameAllGetCollection", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "browserdom") Then
- __ieconsolewriteerror("Error", "_IETagNameAllGetCollection", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Local $otemp
- If __ieisobjtype($oobject, "documentcontainer") Then
- $otemp = _iedocgetobj($oobject)
- Else
- $otemp = $oobject
- EndIf
- $iindex = Number($iindex)
- Select
- Case $iindex = -1
- Return SetError($_iestatus_success, $otemp.all.length, $otemp.all)
- Case $iindex > -1 AND $iindex < $otemp.all.length
- Return SetError($_iestatus_success, $otemp.all.length, $otemp.all.item($iindex))
- Case $iindex < -1
- __ieconsolewriteerror("Error", "_IETagNameAllGetCollection", "$_IESTATUS_InvalidValue", "$iIndex < -1")
- Return SetError($_iestatus_invalidvalue, 2, 0)
- Case Else
- __ieconsolewriteerror("Error", "_IETagNameAllGetCollection", "$_IESTATUS_NoMatch")
- Return SetError($_iestatus_nomatch, 1, 0)
- EndSelect
- EndFunc
- Func _iegetobjbyname(ByRef $oobject, $sname, $iindex = 0)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEGetObjByName", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- $iindex = Number($iindex)
- If $iindex = -1 Then
- Return SetError($_iestatus_success, $oobject.document.getelementsbyname($sname).length, $oobject.document.getelementsbyname($sname))
- Else
- If IsObj($oobject.document.getelementsbyname($sname).item($iindex)) Then
- Return SetError($_iestatus_success, $oobject.document.getelementsbyname($sname).length, $oobject.document.getelementsbyname($sname).item($iindex))
- Else
- __ieconsolewriteerror("Warning", "_IEGetObjByName", "$_IESTATUS_NoMatch", "Name: " & $sname & ", Index: " & $iindex)
- Return SetError($_iestatus_nomatch, 0, 0)
- EndIf
- EndIf
- EndFunc
- Func _iegetobjbyid(ByRef $oobject, $sid)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEGetObjById", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "browserdom") Then
- __ieconsolewriteerror("Error", "_IEGetObById", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- If IsObj($oobject.document.getelementbyid($sid)) Then
- Return SetError($_iestatus_success, 0, $oobject.document.getelementbyid($sid))
- Else
- __ieconsolewriteerror("Warning", "_IEGetObjById", "$_IESTATUS_NoMatch", $sid)
- Return SetError($_iestatus_nomatch, 2, 0)
- EndIf
- EndFunc
- Func _ieaction(ByRef $oobject, $saction)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEAction(" & $saction & ")", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- $saction = StringLower($saction)
- Select
- Case $saction = "click"
- If __ieisobjtype($oobject, "documentContainer") Then
- __ieconsolewriteerror("Error", "_IEAction(click)", " $_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.click()
- Case $saction = "disable"
- If __ieisobjtype($oobject, "documentContainer") Then
- __ieconsolewriteerror("Error", "_IEAction(disable)", " $_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.disabled = True
- Case $saction = "enable"
- If __ieisobjtype($oobject, "documentContainer") Then
- __ieconsolewriteerror("Error", "_IEAction(enable)", " $_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.disabled = False
- Case $saction = "focus"
- If __ieisobjtype($oobject, "documentContainer") Then
- __ieconsolewriteerror("Error", "_IEAction(focus)", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.focus()
- Case $saction = "scrollintoview"
- If __ieisobjtype($oobject, "documentContainer") Then
- __ieconsolewriteerror("Error", "_IEAction(scrollintoview)", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.scrollintoview()
- Case $saction = "copy"
- $oobject.document.execcommand("Copy")
- Case $saction = "cut"
- $oobject.document.execcommand("Cut")
- Case $saction = "paste"
- $oobject.document.execcommand("Paste")
- Case $saction = "delete"
- $oobject.document.execcommand("Delete")
- Case $saction = "saveas"
- $oobject.document.execcommand("SaveAs")
- Case $saction = "refresh"
- $oobject.document.execcommand("Refresh")
- If @error Then
- __ieconsolewriteerror("Error", "_IEAction(refresh)", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- _ieloadwait($oobject)
- Case $saction = "selectall"
- $oobject.document.execcommand("SelectAll")
- Case $saction = "unselect"
- $oobject.document.execcommand("Unselect")
- Case $saction = "print"
- $oobject.document.parentwindow.print()
- Case $saction = "printdefault"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEAction(printdefault)", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.execwb(6, 2)
- Case $saction = "back"
- If NOT __ieisobjtype($oobject, "documentContainer") Then
- __ieconsolewriteerror("Error", "_IEAction(back)", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.goback()
- Case $saction = "blur"
- $oobject.blur()
- Case $saction = "forward"
- If NOT __ieisobjtype($oobject, "documentContainer") Then
- __ieconsolewriteerror("Error", "_IEAction(forward)", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.goforward()
- Case $saction = "home"
- If NOT __ieisobjtype($oobject, "documentContainer") Then
- __ieconsolewriteerror("Error", "_IEAction(home)", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.gohome()
- Case $saction = "invisible"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEAction(invisible)", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.visible = 0
- Case $saction = "visible"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEAction(visible)", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.visible = 1
- Case $saction = "search"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEAction(search)", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.gosearch()
- Case $saction = "stop"
- If NOT __ieisobjtype($oobject, "documentContainer") Then
- __ieconsolewriteerror("Error", "_IEAction(stop)", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.stop()
- Case $saction = "quit"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEAction(quit)", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.quit()
- If @error Then
- __ieconsolewriteerror("Error", "_IEAction(" & $saction & ")", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- $oobject = 0
- Return SetError($_iestatus_success, 0, 1)
- Case Else
- __ieconsolewriteerror("Error", "_IEAction(" & $saction & ")", "$_IESTATUS_InvalidValue", "Invalid Action")
- Return SetError($_iestatus_invalidvalue, 2, 0)
- EndSelect
- If @error Then
- __ieconsolewriteerror("Error", "_IEAction(" & $saction & ")", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- EndFunc
- Func _iepropertyget(ByRef $oobject, $sproperty)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "browserdom") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Local $otemp, $itemp
- $sproperty = StringLower($sproperty)
- Select
- Case $sproperty = "browserx"
- If __ieisobjtype($oobject, "browsercontainer") OR __ieisobjtype($oobject, "document") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $otemp = $oobject
- $itemp = 0
- While IsObj($otemp)
- $itemp += $otemp.offsetleft
- $otemp = $otemp.offsetparent
- WEnd
- Return SetError($_iestatus_success, 0, $itemp)
- Case $sproperty = "browsery"
- If __ieisobjtype($oobject, "browsercontainer") OR __ieisobjtype($oobject, "document") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $otemp = $oobject
- $itemp = 0
- While IsObj($otemp)
- $itemp += $otemp.offsettop
- $otemp = $otemp.offsetparent
- WEnd
- Return SetError($_iestatus_success, 0, $itemp)
- Case $sproperty = "screenx"
- If __ieisobjtype($oobject, "window") OR __ieisobjtype($oobject, "document") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- If __ieisobjtype($oobject, "browser") Then
- Return SetError($_iestatus_success, 0, $oobject.left())
- Else
- $otemp = $oobject
- $itemp = 0
- While IsObj($otemp)
- $itemp += $otemp.offsetleft
- $otemp = $otemp.offsetparent
- WEnd
- EndIf
- Return SetError($_iestatus_success, 0, $itemp + $oobject.document.parentwindow.screenleft)
- Case $sproperty = "screeny"
- If __ieisobjtype($oobject, "window") OR __ieisobjtype($oobject, "document") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- If __ieisobjtype($oobject, "browser") Then
- Return SetError($_iestatus_success, 0, $oobject.top())
- Else
- $otemp = $oobject
- $itemp = 0
- While IsObj($otemp)
- $itemp += $otemp.offsettop
- $otemp = $otemp.offsetparent
- WEnd
- EndIf
- Return SetError($_iestatus_success, 0, $itemp + $oobject.document.parentwindow.screentop)
- Case $sproperty = "height"
- If __ieisobjtype($oobject, "window") OR __ieisobjtype($oobject, "document") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- If __ieisobjtype($oobject, "browser") Then
- Return SetError($_iestatus_success, 0, $oobject.height())
- Else
- Return SetError($_iestatus_success, 0, $oobject.offsetheight)
- EndIf
- Case $sproperty = "width"
- If __ieisobjtype($oobject, "window") OR __ieisobjtype($oobject, "document") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- If __ieisobjtype($oobject, "browser") Then
- Return SetError($_iestatus_success, 0, $oobject.width())
- Else
- Return SetError($_iestatus_success, 0, $oobject.offsetwidth)
- EndIf
- Case $sproperty = "isdisabled"
- Return SetError($_iestatus_success, 0, $oobject.isdisabled())
- Case $sproperty = "addressbar"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.addressbar())
- Case $sproperty = "busy"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.busy())
- Case $sproperty = "fullscreen"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.fullscreen())
- Case $sproperty = "hwnd"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, HWnd($oobject.hwnd()))
- Case $sproperty = "left"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.left())
- Case $sproperty = "locationname"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.locationname())
- Case $sproperty = "locationurl"
- If __ieisobjtype($oobject, "browser") Then
- Return SetError($_iestatus_success, 0, $oobject.locationurl())
- EndIf
- If __ieisobjtype($oobject, "window") Then
- Return SetError($_iestatus_success, 0, $oobject.location.href())
- EndIf
- If __ieisobjtype($oobject, "document") Then
- Return SetError($_iestatus_success, 0, $oobject.parentwindow.location.href())
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.location.href())
- Case $sproperty = "menubar"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.menubar())
- Case $sproperty = "offline"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.offline())
- Case $sproperty = "readystate"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.readystate())
- Case $sproperty = "resizable"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.resizable())
- Case $sproperty = "silent"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.silent())
- Case $sproperty = "statusbar"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.statusbar())
- Case $sproperty = "statustext"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.statustext())
- Case $sproperty = "top"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.top())
- Case $sproperty = "visible"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.visible())
- Case $sproperty = "appcodename"
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.top.navigator.appcodename())
- Case $sproperty = "appminorversion"
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.top.navigator.appminorversion())
- Case $sproperty = "appname"
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.top.navigator.appname())
- Case $sproperty = "appversion"
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.top.navigator.appversion())
- Case $sproperty = "browserlanguage"
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.top.navigator.browserlanguage())
- Case $sproperty = "cookieenabled"
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.top.navigator.cookieenabled())
- Case $sproperty = "cpuclass"
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.top.navigator.cpuclass())
- Case $sproperty = "javaenabled"
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.top.navigator.javaenabled())
- Case $sproperty = "online"
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.top.navigator.online())
- Case $sproperty = "platform"
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.top.navigator.platform())
- Case $sproperty = "systemlanguage"
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.top.navigator.systemlanguage())
- Case $sproperty = "useragent"
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.top.navigator.useragent())
- Case $sproperty = "userlanguage"
- Return SetError($_iestatus_success, 0, $oobject.document.parentwindow.top.navigator.userlanguage())
- Case $sproperty = "referrer"
- Return SetError($_iestatus_success, 0, $oobject.document.referrer)
- Case $sproperty = "theatermode"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.theatermode)
- Case $sproperty = "toolbar"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject.toolbar)
- Case $sproperty = "contenteditable"
- If __ieisobjtype($oobject, "browser") OR __ieisobjtype($oobject, "document") Then
- $otemp = $oobject.document.body
- Else
- $otemp = $oobject
- EndIf
- Return SetError($_iestatus_success, 0, $otemp.iscontenteditable)
- Case $sproperty = "innertext"
- If __ieisobjtype($oobject, "documentcontainer") OR __ieisobjtype($oobject, "document") Then
- $otemp = $oobject.document.body
- Else
- $otemp = $oobject
- EndIf
- Return SetError($_iestatus_success, 0, $otemp.innertext)
- Case $sproperty = "outertext"
- If __ieisobjtype($oobject, "documentcontainer") OR __ieisobjtype($oobject, "document") Then
- $otemp = $oobject.document.body
- Else
- $otemp = $oobject
- EndIf
- Return SetError($_iestatus_success, 0, $otemp.outertext)
- Case $sproperty = "innerhtml"
- If __ieisobjtype($oobject, "documentcontainer") OR __ieisobjtype($oobject, "document") Then
- $otemp = $oobject.document.body
- Else
- $otemp = $oobject
- EndIf
- Return SetError($_iestatus_success, 0, $otemp.innerhtml)
- Case $sproperty = "outerhtml"
- If __ieisobjtype($oobject, "documentcontainer") OR __ieisobjtype($oobject, "document") Then
- $otemp = $oobject.document.body
- Else
- $otemp = $oobject
- EndIf
- Return SetError($_iestatus_success, 0, $otemp.outerhtml)
- Case $sproperty = "title"
- Return SetError($_iestatus_success, 0, $oobject.document.title)
- Case $sproperty = "uniqueid"
- If __ieisobjtype($oobject, "window") Then
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- Else
- Return SetError($_iestatus_success, 0, $oobject.uniqueid)
- EndIf
- Case Else
- __ieconsolewriteerror("Error", "_IEPropertyGet", "$_IESTATUS_InvalidValue", "Invalid Property")
- Return SetError($_iestatus_invalidvalue, 2, 0)
- EndSelect
- EndFunc
- Func _iepropertyset(ByRef $oobject, $sproperty, $vvalue)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- Local $otemp
- #forceref $oTemp
- $sproperty = StringLower($sproperty)
- Select
- Case $sproperty = "addressbar"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.addressbar = $vvalue
- Case $sproperty = "height"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.height = $vvalue
- Case $sproperty = "left"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.left = $vvalue
- Case $sproperty = "menubar"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.menubar = $vvalue
- Case $sproperty = "offline"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.offline = $vvalue
- Case $sproperty = "resizable"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.resizable = $vvalue
- Case $sproperty = "statusbar"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.statusbar = $vvalue
- Case $sproperty = "statustext"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.statustext = $vvalue
- Case $sproperty = "top"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.top = $vvalue
- Case $sproperty = "width"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.width = $vvalue
- Case $sproperty = "theatermode"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- If $vvalue Then
- $oobject.theatermode = True
- Else
- $oobject.theatermode = False
- EndIf
- Case $sproperty = "toolbar"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- If $vvalue Then
- $oobject.toolbar = True
- Else
- $oobject.toolbar = False
- EndIf
- Case $sproperty = "contenteditable"
- If __ieisobjtype($oobject, "browser") OR __ieisobjtype($oobject, "document") Then
- $otemp = $oobject.document.body
- Else
- $otemp = $oobject
- EndIf
- If $vvalue Then
- $otemp.contenteditable = "true"
- Else
- $otemp.contenteditable = "false"
- EndIf
- Case $sproperty = "innertext"
- If __ieisobjtype($oobject, "documentcontainer") OR __ieisobjtype($oobject, "document") Then
- $otemp = $oobject.document.body
- Else
- $otemp = $oobject
- EndIf
- $otemp.innertext = $vvalue
- Case $sproperty = "outertext"
- If __ieisobjtype($oobject, "documentcontainer") OR __ieisobjtype($oobject, "document") Then
- $otemp = $oobject.document.body
- Else
- $otemp = $oobject
- EndIf
- $otemp.outertext = $vvalue
- Case $sproperty = "innerhtml"
- If __ieisobjtype($oobject, "documentcontainer") OR __ieisobjtype($oobject, "document") Then
- $otemp = $oobject.document.body
- Else
- $otemp = $oobject
- EndIf
- $otemp.innerhtml = $vvalue
- Case $sproperty = "outerhtml"
- If __ieisobjtype($oobject, "documentcontainer") OR __ieisobjtype($oobject, "document") Then
- $otemp = $oobject.document.body
- Else
- $otemp = $oobject
- EndIf
- $otemp.outerhtml = $vvalue
- Case $sproperty = "title"
- $oobject.document.title = $vvalue
- Case $sproperty = "silent"
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- If $vvalue Then
- $oobject.silent = True
- Else
- $oobject.silent = False
- EndIf
- Case Else
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_InvalidValue", "Invalid Property")
- Return SetError($_iestatus_invalidvalue, 2, 0)
- EndSelect
- If @error Then
- __ieconsolewriteerror("Error", "_IEPropertySet", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- EndFunc
- Func _ieerrornotify($vnotify = Default)
- If $vnotify = Default Then Return $__g_bieerrornotify
- If $vnotify Then
- $__g_bieerrornotify = True
- Else
- $__g_bieerrornotify = False
- EndIf
- Return 1
- EndFunc
- Func _ieerrorhandlerregister($sfunctionname = "__IEInternalErrorHandler")
- $__g_oieerrorhandler = ObjEvent("AutoIt.Error", $sfunctionname)
- If IsObj($__g_oieerrorhandler) Then
- $__g_sieusererrorhandler = $sfunctionname
- Return SetError($_iestatus_success, 0, 1)
- Else
- $__g_oieerrorhandler = ""
- __ieconsolewriteerror("Error", "_IEErrorHandlerRegister", "$_IEStatus_GeneralError", "Error Handler Not Registered - Check existance of error function")
- Return SetError($_iestatus_generalerror, 1, 0)
- EndIf
- EndFunc
- Func _ieerrorhandlerderegister()
- $__g_sieusererrorhandler = ""
- $__g_oieerrorhandler = ""
- Return SetError($_iestatus_success, 0, 1)
- EndFunc
- Func __ieinternalerrorhandlerregister()
- Local $scurrenterrorhandler = ObjEvent("AutoIt.Error")
- If $scurrenterrorhandler <> "" AND NOT IsObj($__g_oieerrorhandler) Then
- Return SetError($_iestatus_generalerror, 0, False)
- EndIf
- $__g_oieerrorhandler = ObjEvent("AutoIt.Error", "__IEInternalErrorHandler")
- If IsObj($__g_oieerrorhandler) Then
- Return SetError($_iestatus_success, 0, True)
- Else
- $__g_oieerrorhandler = ""
- Return SetError($_iestatus_generalerror, 0, False)
- EndIf
- EndFunc
- Func __ieinternalerrorhandlerderegister()
- $__g_oieerrorhandler = ""
- If $__g_sieusererrorhandler <> "" Then
- $__g_oieerrorhandler = ObjEvent("AutoIt.Error", $__g_sieusererrorhandler)
- EndIf
- Return SetError($_iestatus_success, 0, 1)
- EndFunc
- Func __ieinternalerrorhandler($ocomerror)
- If $__g_bieerrornotify OR $__g_bieau3debug Then ConsoleWrite("--> " & __comerrorformating($ocomerror, "----> $IEComError") & @CRLF)
- SetError($_iestatus_comerror)
- Return
- EndFunc
- Func _iequit(ByRef $oobject)
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "_IEQuit", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "browser") Then
- __ieconsolewriteerror("Error", "_IEQuit", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.quit()
- If @error Then
- __ieconsolewriteerror("Error", "_IEQuit", "$_IESTATUS_COMError", @error)
- Return SetError($_iestatus_comerror, @error, 0)
- EndIf
- $oobject = 0
- Return SetError($_iestatus_success, 0, 1)
- EndFunc
- #EndRegion Utility functions
- #Region General
- Func _ie_introduction($smodule = "basic")
- Local $shtml = ""
- Switch $smodule
- Case "basic"
- $shtml &= "<!DOCTYPE html>" & @CR
- $shtml &= "<html>" & @CR
- $shtml &= "<head>" & @CR
- $shtml &= '<meta content="text/html; charset=UTF-8" http-equiv="content-type">' & @CR
- $shtml &= '<title>_IE_Introduction ("basic")</title>' & @CR
- $shtml &= "<style>body {font-family: Arial}" & @CR
- $shtml &= "td {padding:6px}</style>" & @CR
- $shtml &= "</head>" & @CR
- $shtml &= "<body>" & @CR
- $shtml &= '<table border=1 id="table1" style="width:600px;border-spacing:6px;">' & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= "<td>" & @CR
- $shtml &= "<h1>Welcome to IE.au3</h1>" & @CR
- $shtml &= "IE.au3 is a UDF (User Defined Function) library for the " & @CR
- $shtml &= '<a href="http://www.autoitscript.com">AutoIt</a> scripting language.' & @CR
- $shtml &= "<br> " & @CR
- $shtml &= "IE.au3 allows you to either create or attach to an Internet Explorer browser and do " & @CR
- $shtml &= "just about anything you could do with it interactively with the mouse and " & @CR
- $shtml &= "keyboard, but do it through script." & @CR
- $shtml &= "<br>" & @CR
- $shtml &= "You can navigate to pages, click links, fill and submit forms etc. You can " & @CR
- $shtml &= "also do things you cannot do interactively like change or rewrite page " & @CR
- $shtml &= "content and JavaScripts, read, parse and save page content and monitor and act " & @CR
- $shtml &= 'upon browser "events".<br>' & @CR
- $shtml &= "IE.au3 uses the COM interface in AutoIt to interact with the Internet Explorer " & @CR
- $shtml &= "object model and the DOM (Document Object Model) supported by the browser." & @CR
- $shtml &= "<br>" & @CR
- $shtml &= "Here are some links for more information and helpful tools:<br>" & @CR
- $shtml &= "Reference Material: " & @CR
- $shtml &= "<ul>" & @CR
- $shtml &= '<li><a href="http://msdn1.microsoft.com/">MSDN (Microsoft Developer Network)</a></li>' & @CR
- $shtml &= '<li><a href="http://msdn2.microsoft.com/en-us/library/aa752084.aspx" target="_blank">InternetExplorer Object</a></li>' & @CR
- $shtml &= '<li><a href="http://msdn2.microsoft.com/en-us/library/ms531073.aspx" target="_blank">Document Object</a></li>' & @CR
- $shtml &= '<li><a href="http://msdn2.microsoft.com/en-us/ie/aa740473.aspx" target="_blank">Overviews and Tutorials</a></li>' & @CR
- $shtml &= '<li><a href="http://msdn2.microsoft.com/en-us/library/ms533029.aspx" target="_blank">DHTML Objects</a></li>' & @CR
- $shtml &= '<li><a href="http://msdn2.microsoft.com/en-us/library/ms533051.aspx" target="_blank">DHTML Events</a></li>' & @CR
- $shtml &= "</ul><br>" & @CR
- $shtml &= "Helpful Tools: " & @CR
- $shtml &= "<ul>" & @CR
- $shtml &= '<li><a href="http://www.autoitscript.com/forum/index.php?showtopic=19368" target="_blank">AutoIt IE Builder</a> (build IE scripts interactively)</li>' & @CR
- $shtml &= '<li><a href="http://www.debugbar.com/" target="_blank">DebugBar</a> (DOM inspector, HTTP inspector, HTML validator and more - free for personal use) Recommended</li>' & @CR
- $shtml &= '<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en" target="_blank">IE Developer Toolbar</a> (comprehensive DOM analysis tool)</li>' & @CR
- $shtml &= '<li><a href="http://slayeroffice.com/tools/modi/v2.0/modi_help.html" target="_blank">MODIV2</a> (view the DOM of a web page by mousing around)</li>' & @CR
- $shtml &= '<li><a href="http://validator.w3.org/" target="_blank">HTML Validator</a> (verify HTML follows format rules)</li>' & @CR
- $shtml &= '<li><a href="http://www.fiddlertool.com/fiddler/" target="_blank">Fiddler</a> (examine HTTP traffic)</li>' & @CR
- $shtml &= "</ul>" & @CR
- $shtml &= "</td>" & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "</table>" & @CR
- $shtml &= "</body>" & @CR
- $shtml &= "</html>"
- Case Else
- __ieconsolewriteerror("Error", "_IE_Introduction", "$_IESTATUS_InvalidValue")
- Return SetError($_iestatus_invalidvalue, 1, 0)
- EndSwitch
- Local $oobject = _iecreate()
- _iedocwritehtml($oobject, $shtml)
- Return SetError($_iestatus_success, 0, $oobject)
- EndFunc
- Func _ie_example($smodule = "basic")
- Local $shtml = "", $oobject
- Switch $smodule
- Case "basic"
- $shtml &= "<!DOCTYPE html>" & @CR
- $shtml &= "<html>" & @CR
- $shtml &= "<head>" & @CR
- $shtml &= '<meta content="text/html; charset=UTF-8" http-equiv="content-type">' & @CR
- $shtml &= '<title>_IE_Example("basic")</title>' & @CR
- $shtml &= "<style>body {font-family: Arial}</style>" & @CR
- $shtml &= "</head>" & @CR
- $shtml &= "<body>" & @CR
- $shtml &= '<a href="http://www.autoitscript.com"><img src="http://www.autoitscript.com/images/logo_autoit_210x72.png" id="AutoItImage" alt="AutoIt Homepage Image" style="background: #204080;"></a>' & @CR
- $shtml &= "<p></p>" & @CR
- $shtml &= '<div id="line1">This is a simple HTML page with text, links and images.</div>' & @CR
- $shtml &= "<br>" & @CR
- $shtml &= '<div id="line2"><a href="http://www.autoitscript.com">AutoIt</a> is a wonderful automation scripting language.</div>' & @CR
- $shtml &= "<br>" & @CR
- $shtml &= '<div id="line3">It is supported by a very active and supporting <a href="http://www.autoitscript.com/forum/">user forum</a>.</div>' & @CR
- $shtml &= "<br>" & @CR
- $shtml &= '<div id="IEAu3Data"></div>' & @CR
- $shtml &= "</body>" & @CR
- $shtml &= "</html>"
- $oobject = _iecreate()
- _iedocwritehtml($oobject, $shtml)
- Case "table"
- $shtml &= "<!DOCTYPE html>" & @CR
- $shtml &= "<html>" & @CR
- $shtml &= "<head>" & @CR
- $shtml &= '<meta content="text/html; charset=utf-8" http-equiv="content-type">' & @CR
- $shtml &= '<title>_IE_Example("table")</title>' & @CR
- $shtml &= "<style>body {font-family: Arial}</style>" & @CR
- $shtml &= "</head>" & @CR
- $shtml &= "<body>" & @CR
- $shtml &= '$oTableOne = _IETableGetObjByName($oIE, "tableOne")<br>' & @CR
- $shtml &= '<table border=1 id="tableOne"><br>' & @CR
- $shtml &= '<table border=1 id="tableOne">' & @CR
- $shtml &= " <tr>" & @CR
- $shtml &= " <td>AutoIt</td>" & @CR
- $shtml &= " <td>is</td>" & @CR
- $shtml &= " <td>really</td>" & @CR
- $shtml &= " <td>great</td>" & @CR
- $shtml &= " <td>with</td>" & @CR
- $shtml &= " <td>IE.au3</td>" & @CR
- $shtml &= " </tr>" & @CR
- $shtml &= " <tr>" & @CR
- $shtml &= " <td>1</td>" & @CR
- $shtml &= " <td>2</td>" & @CR
- $shtml &= " <td>3</td>" & @CR
- $shtml &= " <td>4</td>" & @CR
- $shtml &= " <td>5</td>" & @CR
- $shtml &= " <td>6</td>" & @CR
- $shtml &= " </tr>" & @CR
- $shtml &= " <tr>" & @CR
- $shtml &= " <td>the</td>" & @CR
- $shtml &= " <td>quick</td>" & @CR
- $shtml &= " <td>red</td>" & @CR
- $shtml &= " <td>fox</td>" & @CR
- $shtml &= " <td>jumped</td>" & @CR
- $shtml &= " <td>over</td>" & @CR
- $shtml &= " </tr>" & @CR
- $shtml &= " <tr>" & @CR
- $shtml &= " <td>the</td>" & @CR
- $shtml &= " <td>lazy</td>" & @CR
- $shtml &= " <td>brown</td>" & @CR
- $shtml &= " <td>dog</td>" & @CR
- $shtml &= " <td>the</td>" & @CR
- $shtml &= " <td>time</td>" & @CR
- $shtml &= " </tr>" & @CR
- $shtml &= " <tr>" & @CR
- $shtml &= " <td>has</td>" & @CR
- $shtml &= " <td>come</td>" & @CR
- $shtml &= " <td>for</td>" & @CR
- $shtml &= " <td>all</td>" & @CR
- $shtml &= " <td>good</td>" & @CR
- $shtml &= " <td>men</td>" & @CR
- $shtml &= " </tr>" & @CR
- $shtml &= " <tr>" & @CR
- $shtml &= " <td>to</td>" & @CR
- $shtml &= " <td>come</td>" & @CR
- $shtml &= " <td>to</td>" & @CR
- $shtml &= " <td>the</td>" & @CR
- $shtml &= " <td>aid</td>" & @CR
- $shtml &= " <td>of</td>" & @CR
- $shtml &= " </tr>" & @CR
- $shtml &= "</table>" & @CR
- $shtml &= "<br>" & @CR
- $shtml &= '$oTableTwo = _IETableGetObjByName($oIE, "tableTwo")<br>' & @CR
- $shtml &= '<table border="1" id="tableTwo"><br>' & @CR
- $shtml &= '<table border=1 id="tableTwo">' & @CR
- $shtml &= " <tr>" & @CR
- $shtml &= ' <td colspan="4">Table Top</td>' & @CR
- $shtml &= " </tr>" & @CR
- $shtml &= " <tr>" & @CR
- $shtml &= " <td>One</td>" & @CR
- $shtml &= ' <td colspan="3">Two</td>' & @CR
- $shtml &= " </tr>" & @CR
- $shtml &= " <tr>" & @CR
- $shtml &= " <td>Three</td>" & @CR
- $shtml &= " <td>Four</td>" & @CR
- $shtml &= ' <td colspan="2">Five</td>' & @CR
- $shtml &= " </tr>" & @CR
- $shtml &= " <tr>" & @CR
- $shtml &= " <td>Six</td>" & @CR
- $shtml &= ' <td colspan="3">Seven</td>' & @CR
- $shtml &= " </tr>" & @CR
- $shtml &= " <tr>" & @CR
- $shtml &= " <td>Eight</td>" & @CR
- $shtml &= " <td>Nine</td>" & @CR
- $shtml &= " <td>Ten</td>" & @CR
- $shtml &= " <td>Eleven</td>" & @CR
- $shtml &= " </tr>" & @CR
- $shtml &= "</table>" & @CR
- $shtml &= "</body>" & @CR
- $shtml &= "</html>"
- $oobject = _iecreate()
- _iedocwritehtml($oobject, $shtml)
- Case "form"
- $shtml &= "<!DOCTYPE html>" & @CR
- $shtml &= "<html>" & @CR
- $shtml &= "<head>" & @CR
- $shtml &= '<meta content="text/html; charset=UTF-8" http-equiv="content-type">' & @CR
- $shtml &= '<title>_IE_Example("form")</title>' & @CR
- $shtml &= "<style>body {font-family: Arial}" & @CR
- $shtml &= "td {padding:6px}</style>" & @CR
- $shtml &= "</head>" & @CR
- $shtml &= "<body>" & @CR
- $shtml &= "<form name=""ExampleForm"" onSubmit=""javascript:alert('ExampleFormSubmitted');"" method=""post"">" & @CR
- $shtml &= '<table style="border-spacing:6px 6px;" border=1>' & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= "<td>ExampleForm</td>" & @CR
- $shtml &= "<td><form name=""ExampleForm"" onSubmit=""javascript:alert('ExampleFormSubmitted');"" method=""post""></td>" & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= '<td>Hidden Input Element<input type="hidden" name="hiddenExample" value="secret value"></td>' & @CR
- $shtml &= '<td><input type="hidden" name="hiddenExample" value="secret value"></td>' & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= "<td>" & @CR
- $shtml &= '<input type="text" name="textExample" value="http://" size="20" maxlength="30">' & @CR
- $shtml &= "</td>" & @CR
- $shtml &= '<td><input type="text" name="textExample" value="http://" size="20" maxlength="30"></td>' & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= "<td>" & @CR
- $shtml &= '<input type="password" name="passwordExample" size="10">' & @CR
- $shtml &= "</td>" & @CR
- $shtml &= '<td><input type="password" name="passwordExample" size="10"></td>' & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= "<td>" & @CR
- $shtml &= '<input type="file" name="fileExample">' & @CR
- $shtml &= "</td>" & @CR
- $shtml &= '<td><input type="file" name="fileExample"></td>' & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= "<td>" & @CR
- $shtml &= '<input type="image" name="imageExample" alt="AutoIt Homepage" src="http://www.autoitscript.com/images/logo_autoit_210x72.png" style="background: #204080;>' & @CR
- $shtml &= "</td>" & @CR
- $shtml &= '<td><input type="image" name="imageExample" alt="AutoIt Homepage" src="http://www.autoitscript.com/images/logo_autoit_210x72.png"></td>' & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= "<td>" & @CR
- $shtml &= '<textarea name="textareaExample" rows="5" cols="15">Hello!</textarea>' & @CR
- $shtml &= "</td>" & @CR
- $shtml &= '<td><textarea name="textareaExample" rows="5" cols="15">Hello!</textarea></td>' & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= "<td>" & @CR
- $shtml &= '<input type="checkbox" name="checkboxG1Example" value="gameBasketball">Basketball<br>' & @CR
- $shtml &= '<input type="checkbox" name="checkboxG1Example" value="gameFootball">Football<br>' & @CR
- $shtml &= '<input type="checkbox" name="checkboxG2Example" value="gameTennis" checked>Tennis<br>' & @CR
- $shtml &= '<input type="checkbox" name="checkboxG2Example" value="gameBaseball">Baseball' & @CR
- $shtml &= "</td>" & @CR
- $shtml &= '<td><input type="checkbox" name="checkboxG1Example" value="gameBasketball">Basketball<br><br>' & @CR
- $shtml &= '<input type="checkbox" name="checkboxG1Example" value="gameFootball">Football<br><br>' & @CR
- $shtml &= '<input type="checkbox" name="checkboxG2Example" value="gameTennis" checked>Tennis<br><br>' & @CR
- $shtml &= '<input type="checkbox" name="checkboxG2Example" value="gameBaseball">Baseball</td>' & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= "<td>" & @CR
- $shtml &= '<input type="radio" name="radioExample" value="vehicleAirplane">Airplane<br>' & @CR
- $shtml &= '<input type="radio" name="radioExample" value="vehicleTrain" checked>Train<br>' & @CR
- $shtml &= '<input type="radio" name="radioExample" value="vehicleBoat">Boat<br>' & @CR
- $shtml &= '<input type="radio" name="radioExample" value="vehicleCar">Car</td>' & @CR
- $shtml &= '<td><input type="radio" name="radioExample" value="vehicleAirplane">Airplane<br><br>' & @CR
- $shtml &= '<input type="radio" name="radioExample" value="vehicleTrain" checked>Train<br><br>' & @CR
- $shtml &= '<input type="radio" name="radioExample" value="vehicleBoat">Boat<br><br>' & @CR
- $shtml &= '<input type="radio" name="radioExample" value="vehicleCar">Car<br></td>' & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= "<td>" & @CR
- $shtml &= '<select name="selectExample">' & @CR
- $shtml &= '<option value="homepage.html">Homepage' & @CR
- $shtml &= '<option value="midipage.html">Midipage' & @CR
- $shtml &= '<option value="freepage.html">Freepage' & @CR
- $shtml &= "</select>" & @CR
- $shtml &= "</td>" & @CR
- $shtml &= '<td><select name="selectExample"><br>' & @CR
- $shtml &= '<option value="homepage.html">Homepage<br>' & @CR
- $shtml &= '<option value="midipage.html">Midipage<br>' & @CR
- $shtml &= '<option value="freepage.html">Freepage<br>' & @CR
- $shtml &= "</select></td>" & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= "<td>" & @CR
- $shtml &= '<select name="multipleSelectExample" size="6" multiple>' & @CR
- $shtml &= '<option value="Name1">Aaron' & @CR
- $shtml &= '<option value="Name2">Bruce' & @CR
- $shtml &= '<option value="Name3">Carlos' & @CR
- $shtml &= '<option value="Name4">Denis' & @CR
- $shtml &= '<option value="Name5">Ed' & @CR
- $shtml &= '<option value="Name6">Freddy' & @CR
- $shtml &= "</select>" & @CR
- $shtml &= "</td>" & @CR
- $shtml &= '<td><select name="multipleSelectExample" size="6" multiple><br>' & @CR
- $shtml &= '<option value="Name1">Aaron<br>' & @CR
- $shtml &= '<option value="Name2">Bruce<br>' & @CR
- $shtml &= '<option value="Name3">Carlos<br>' & @CR
- $shtml &= '<option value="Name4">Denis<br>' & @CR
- $shtml &= '<option value="Name5">Ed<br>' & @CR
- $shtml &= '<option value="Name6">Freddy<br>' & @CR
- $shtml &= "</select></td>" & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= "<td>" & @CR
- $shtml &= '<input name="submitExample" type="submit" value="Submit">' & @CR
- $shtml &= '<input name="resetExample" type="reset" value="Reset">' & @CR
- $shtml &= "</td>" & @CR
- $shtml &= '<td><input name="submitExample" type="submit" value="Submit"><br>' & @CR
- $shtml &= '<input name="resetExample" type="reset" value="Reset"></td>' & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "</table>" & @CR
- $shtml &= '<input type="hidden" name="hiddenExample" value="secret value">' & @CR
- $shtml &= "</form>" & @CR
- $shtml &= "</body>" & @CR
- $shtml &= "</html>"
- $oobject = _iecreate()
- _iedocwritehtml($oobject, $shtml)
- Case "frameset"
- $shtml &= "<!DOCTYPE html>" & @CR
- $shtml &= "<html>" & @CR
- $shtml &= "<head>" & @CR
- $shtml &= '<meta content="text/html; charset=UTF-8" http-equiv="content-type">' & @CR
- $shtml &= '<title>_IE_Example("frameset")</title>' & @CR
- $shtml &= "</head>" & @CR
- $shtml &= '<frameset rows="25,200">' & @CR
- $shtml &= " <frame name=Top SRC=about:blank>" & @CR
- $shtml &= ' <frameset cols="100,500">' & @CR
- $shtml &= " <frame name=Menu SRC=about:blank>" & @CR
- $shtml &= " <frame name=Main SRC=about:blank>" & @CR
- $shtml &= " </frameset>" & @CR
- $shtml &= "</frameset>" & @CR
- $shtml &= "</html>"
- $oobject = _iecreate()
- _iedocwritehtml($oobject, $shtml)
- _ieaction($oobject, "refresh")
- Local $oframetop = _ieframegetobjbyname($oobject, "Top")
- Local $oframemenu = _ieframegetobjbyname($oobject, "Menu")
- Local $oframemain = _ieframegetobjbyname($oobject, "Main")
- _iebodywritehtml($oframetop, '$oFrameTop = _IEFrameGetObjByName($oIE, "Top")')
- _iebodywritehtml($oframemenu, '$oFrameMenu = _IEFrameGetObjByName($oIE, "Menu")')
- _iebodywritehtml($oframemain, '$oFrameMain = _IEFrameGetObjByName($oIE, "Main")')
- Case "iframe"
- $shtml &= "<!DOCTYPE html>" & @CR
- $shtml &= "<html>" & @CR
- $shtml &= "<head>" & @CR
- $shtml &= '<meta content="text/html; charset=UTF-8" http-equiv="content-type">' & @CR
- $shtml &= '<title>_IE_Example("iframe")</title>' & @CR
- $shtml &= "<style>td {padding:6px}</style>" & @CR
- $shtml &= "</head>" & @CR
- $shtml &= "<body>" & @CR
- $shtml &= '<table style="border-spacing:6px" border=1>' & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= '<td><iframe name="iFrameOne" src="about:blank" title="iFrameOne"></iframe></td>' & @CR
- $shtml &= '<td><iframe name="iFrameOne" src="about:blank" title="iFrameOne"></td>' & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "<tr>" & @CR
- $shtml &= '<td><iframe name="iFrameTwo" src="about:blank" title="iFrameTwo"></iframe></td>' & @CR
- $shtml &= '<td><iframe name="iFrameTwo" src="about:blank" title="iFrameTwo"></td>' & @CR
- $shtml &= "</tr>" & @CR
- $shtml &= "</table>" & @CR
- $shtml &= "</body>" & @CR
- $shtml &= "</html>"
- $oobject = _iecreate()
- _iedocwritehtml($oobject, $shtml)
- _ieaction($oobject, "refresh")
- Local $oiframeone = _ieframegetobjbyname($oobject, "iFrameOne")
- Local $oiframetwo = _ieframegetobjbyname($oobject, "iFrameTwo")
- _iebodywritehtml($oiframeone, '$oIFrameOne = _IEFrameGetObjByName($oIE, "iFrameOne")')
- _iebodywritehtml($oiframetwo, '$oIFrameTwo = _IEFrameGetObjByName($oIE, "iFrameTwo")')
- Case Else
- __ieconsolewriteerror("Error", "_IE_Example", "$_IESTATUS_InvalidValue")
- Return SetError($_iestatus_invalidvalue, 1, 0)
- EndSwitch
- Sleep(500)
- Return SetError($_iestatus_success, 0, $oobject)
- EndFunc
- Func _ie_versioninfo()
- __ieconsolewriteerror("Information", "_IE_VersionInfo", "version " & $__gaieau3versioninfo[0] & $__gaieau3versioninfo[1] & "." & $__gaieau3versioninfo[2] & "-" & $__gaieau3versioninfo[3], "Release date: " & $__gaieau3versioninfo[4])
- Return SetError($_iestatus_success, 0, $__gaieau3versioninfo)
- EndFunc
- #EndRegion General
- #Region Internal functions
- Func __ielocksetforegroundwindow($ilockcode)
- Local $aret = DllCall("user32.dll", "bool", "LockSetForegroundWindow", "uint", $ilockcode)
- If @error OR NOT $aret[0] Then Return SetError(1, _winapi_getlasterror(), 0)
- Return $aret[0]
- EndFunc
- Func __iecontrolgetobjfromhwnd(ByRef $hwin)
- DllCall("ole32.dll", "long", "CoInitialize", "ptr", 0)
- If @error Then Return SetError(2, @error, 0)
- Local Const $wm_html_getobject = __ieregisterwindowmessage("WM_HTML_GETOBJECT")
- Local Const $smto_abortifhung = 2
- Local $iresult
- __iesendmessagetimeout($hwin, $wm_html_getobject, 0, 0, $smto_abortifhung, 1000, $iresult)
- Local $tuuid = DllStructCreate("int;short;short;byte[8]")
- DllStructSetData($tuuid, 1, 1651492128)
- DllStructSetData($tuuid, 2, 42014)
- DllStructSetData($tuuid, 3, 4559)
- DllStructSetData($tuuid, 4, 167, 1)
- DllStructSetData($tuuid, 4, 49, 2)
- DllStructSetData($tuuid, 4, 0, 3)
- DllStructSetData($tuuid, 4, 160, 4)
- DllStructSetData($tuuid, 4, 201, 5)
- DllStructSetData($tuuid, 4, 8, 6)
- DllStructSetData($tuuid, 4, 38, 7)
- DllStructSetData($tuuid, 4, 55, 8)
- Local $aret = DllCall("oleacc.dll", "long", "ObjectFromLresult", "lresult", $iresult, "struct*", $tuuid, "wparam", 0, "idispatch*", 0)
- If @error Then Return SetError(3, @error, 0)
- If IsObj($aret[4]) Then
- Local $oie = $aret[4].script()
- Return $oie.document.parentwindow
- Else
- Return SetError(1, $aret[0], 0)
- EndIf
- EndFunc
- Func __ieregisterwindowmessage($smsg)
- Local $aret = DllCall("user32.dll", "uint", "RegisterWindowMessageW", "wstr", $smsg)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] = 0 Then Return SetError(10, _winapi_getlasterror(), 0)
- Return $aret[0]
- EndFunc
- Func __iesendmessagetimeout($hwnd, $imsg, $wparam, $lparam, $iflags, $itimeout, ByRef $vout, $r = 0, $st1 = "int", $st2 = "int")
- Local $aret = DllCall("user32.dll", "lresult", "SendMessageTimeout", "hwnd", $hwnd, "uint", $imsg, $st1, $wparam, $st2, $lparam, "uint", $iflags, "uint", $itimeout, "dword_ptr*", "")
- If @error OR $aret[0] = 0 Then
- $vout = 0
- Return SetError(1, _winapi_getlasterror(), 0)
- EndIf
- $vout = $aret[7]
- If $r >= 0 AND $r <= 4 Then Return $aret[$r]
- Return $aret
- EndFunc
- Func __ieisobjtype(ByRef $oobject, $stype, $bregister = True)
- If NOT IsObj($oobject) Then
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- Local $bstatus = $bregister
- If $bregister Then
- $bstatus = __ieinternalerrorhandlerregister()
- If NOT $bstatus Then __ieconsolewriteerror("Warning", "internal function __IEIsObjType", "Cannot register internal error handler, cannot trap COM errors", "Use _IEErrorHandlerRegister() to register a user error handler")
- EndIf
- Local $inotifystatus = _ieerrornotify()
- _ieerrornotify(False)
- Local $sname = String(ObjName($oobject)), $ierrorstatus = $_iestatus_invalidobjecttype
- Switch $stype
- Case "browserdom"
- If __ieisobjtype($oobject, "documentcontainer", False) Then
- $ierrorstatus = $_iestatus_success
- ElseIf __ieisobjtype($oobject, "document", False) Then
- $ierrorstatus = $_iestatus_success
- Else
- Local $otemp = $oobject.document
- If __ieisobjtype($otemp, "document", False) Then
- $ierrorstatus = $_iestatus_success
- EndIf
- EndIf
- Case "browser"
- If ($sname = "IWebBrowser2") OR ($sname = "IWebBrowser") OR ($sname = "WebBrowser") Then $ierrorstatus = $_iestatus_success
- Case "window"
- If $sname = "HTMLWindow2" Then $ierrorstatus = $_iestatus_success
- Case "documentContainer"
- If __ieisobjtype($oobject, "window", False) OR __ieisobjtype($oobject, "browser", False) Then $ierrorstatus = $_iestatus_success
- Case "document"
- If $sname = "HTMLDocument" Then $ierrorstatus = $_iestatus_success
- Case "table"
- If $sname = "HTMLTable" Then $ierrorstatus = $_iestatus_success
- Case "form"
- If $sname = "HTMLFormElement" Then $ierrorstatus = $_iestatus_success
- Case "forminputelement"
- If ($sname = "HTMLInputElement") OR ($sname = "HTMLSelectElement") OR ($sname = "HTMLTextAreaElement") Then $ierrorstatus = $_iestatus_success
- Case "elementcollection"
- If ($sname = "HTMLElementCollection") Then $ierrorstatus = $_iestatus_success
- Case "formselectelement"
- If $sname = "HTMLSelectElement" Then $ierrorstatus = $_iestatus_success
- Case Else
- $ierrorstatus = $_iestatus_invalidvalue
- EndSwitch
- _ieerrornotify($inotifystatus)
- If $bregister Then
- __ieinternalerrorhandlerderegister()
- EndIf
- If $ierrorstatus = $_iestatus_success Then
- Return SetError($_iestatus_success, 0, 1)
- Else
- Return SetError($ierrorstatus, 1, 0)
- EndIf
- EndFunc
- Func __ieconsolewriteerror($sseverity, $sfunc, $smessage = Default, $sstatus = Default)
- If $__g_bieerrornotify OR $__g_bieau3debug Then
- Local $sstr = "--> IE.au3 " & $__gaieau3versioninfo[5] & " " & $sseverity & " from function " & $sfunc
- If NOT ($smessage = Default) Then $sstr &= ", " & $smessage
- If NOT ($sstatus = Default) Then $sstr &= " (" & $sstatus & ")"
- ConsoleWrite($sstr & @CRLF)
- EndIf
- Return SetError($sstatus, 0, 1)
- EndFunc
- Func __iecomerrorunrecoverable($ierror)
- Switch $ierror
- Case -2147352567
- Return $_iestatus_accessisdenied
- Case -2147024891
- Return $_iestatus_accessisdenied
- Case -2147417848
- Return $_iestatus_clientdisconnected
- Case -2147023174
- Return $_iestatus_clientdisconnected
- Case -2147023179
- Return $_iestatus_clientdisconnected
- Case Else
- Return $_iestatus_success
- EndSwitch
- EndFunc
- #EndRegion Internal functions
- #Region ProtoType Functions
- Func __ienavigate(ByRef $oobject, $surl, $iwait = 1, $ifags = 0, $starget = "", $spostdata = "", $sheaders = "")
- __ieconsolewriteerror("Warning", "__IENavigate", "Unsupported function called. Not fully tested.")
- If NOT IsObj($oobject) Then
- __ieconsolewriteerror("Error", "__IENavigate", "$_IESTATUS_InvalidDataType")
- Return SetError($_iestatus_invaliddatatype, 1, 0)
- EndIf
- If NOT __ieisobjtype($oobject, "documentContainer") Then
- __ieconsolewriteerror("Error", "__IENavigate", "$_IESTATUS_InvalidObjectType")
- Return SetError($_iestatus_invalidobjecttype, 1, 0)
- EndIf
- $oobject.navigate($surl, $ifags, $starget, $spostdata, $sheaders)
- If $iwait Then
- _ieloadwait($oobject)
- Return SetError(@error, 0, $oobject)
- EndIf
- Return SetError($_iestatus_success, 0, $oobject)
- EndFunc
- Func __iestringtobstr($sstring, $scharset = "us-ascii")
- Local Const $itypebinary = 1, $itypetext = 2
- Local $ostream = ObjCreate("ADODB.Stream")
- $ostream.type = $itypetext
- $ostream.charset = $scharset
- $ostream.open
- $ostream.writetext($sstring)
- $ostream.position = 0
- $ostream.type = $itypebinary
- $ostream.position = 0
- Return $ostream.read()
- EndFunc
- Func __iebstrtostring($obstr, $scharset = "us-ascii")
- Local Const $itypebinary = 1, $itypetext = 2
- Local $ostream = ObjCreate("ADODB.Stream")
- $ostream.type = $itypebinary
- $ostream.open
- $ostream.write($obstr)
- $ostream.position = 0
- $ostream.type = $itypetext
- $ostream.charset = $scharset
- $ostream.position = 0
- Return $ostream.readtext()
- EndFunc
- Func __iecreatenewie($stitle, $shead = "", $sbody = "")
- Local $stemp = __ietempfile("", "~IE~", ".htm")
- If @error Then
- __ieconsolewriteerror("Error", "_IECreateHTA", "", "Error creating temporary file in @TempDir or @ScriptDir")
- Return SetError($_iestatus_generalerror, 1, 0)
- EndIf
- Local $shtml = ""
- $shtml &= "<!DOCTYPE html>" & @CR
- $shtml &= "<html>" & @CR
- $shtml &= "<head>" & @CR
- $shtml &= '<meta content="text/html; charset=UTF-8" http-equiv="content-type">' & @CR
- $shtml &= "<title>" & $stemp & "</title>" & @CR & $shead & @CR
- $shtml &= "</head>" & @CR
- $shtml &= "<body>" & @CR & $sbody & @CR
- $shtml &= "</body>" & @CR
- $shtml &= "</html>"
- Local $hfile = FileOpen($stemp, $fo_overwrite)
- FileWrite($hfile, $shtml)
- FileClose($hfile)
- If @error Then
- __ieconsolewriteerror("Error", "_IECreateNewIE", "", "Error creating temporary file in @TempDir or @ScriptDir")
- Return SetError($_iestatus_generalerror, 2, 0)
- EndIf
- Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe " & $stemp)
- Local $ipid
- If WinWait($stemp, "", 60) Then
- $ipid = WinGetProcess($stemp)
- Else
- __ieconsolewriteerror("Error", "_IECreateNewIE", "", "Timeout waiting for new IE window creation")
- Return SetError($_iestatus_generalerror, 3, 0)
- EndIf
- If NOT FileDelete($stemp) Then
- __ieconsolewriteerror("Warning", "_IECreateNewIE", "", "Could not delete temporary file " & FileGetLongName($stemp))
- EndIf
- Local $oobject = _ieattach($stemp)
- _ieloadwait($oobject)
- _iepropertyset($oobject, "title", $stitle)
- Return SetError($_iestatus_success, $ipid, $oobject)
- EndFunc
- Func __ietempfile($sdirectoryname = @TempDir, $sfileprefix = "~", $sfileextension = ".tmp", $irandomlength = 7)
- Local $stempname, $itmp = 0
- If NOT FileExists($sdirectoryname) Then $sdirectoryname = @TempDir
- If NOT FileExists($sdirectoryname) Then $sdirectoryname = @ScriptDir
- If StringRight($sdirectoryname, 1) <> "\" Then $sdirectoryname = $sdirectoryname & "\"
- Do
- $stempname = ""
- While StringLen($stempname) < $irandomlength
- $stempname = $stempname & Chr(Random(97, 122, 1))
- WEnd
- $stempname = $sdirectoryname & $sfileprefix & $stempname & $sfileextension
- $itmp += 1
- If $itmp > 200 Then
- Return SetError($_iestatus_generalerror, 1, 0)
- EndIf
- Until NOT FileExists($stempname)
- Return $stempname
- EndFunc
- #EndRegion ProtoType Functions
- $url = "http://gamerguy.x10host.com/upper.php?account=" & $account & "&password=" & $password & "&realm=" & $realm
- $oie = _iecreate($url, 0, 0)
- $oquery = _iegetobjbyname($oie, "submit")
- MsgBox(64, "Configuration Error", "Please make sure the configuration is filled out entirely and try again.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement