corz.org uses cookies to remember that you've seen this notice explaining that corz.org uses cookies, okay!
global $ce_debug = 0
corz essential functions v0.6.4b
(c) corz.org 2006->
function list..
[see the functions themselves for more detailed usage instructions]
BubbleSort( array )
InsertionSort( array )
ShellSort( array )
MaxMax(int/float{num1), int/float{num2} [, int/float{num2})]
MinMin(int/float{num1), int/float{num2} [, int/float{num2})]
BaseName ( string {file/folder path} )
GetExtension( string {file path} )
RemoveExtension( string {file path} )
CleanName( string {file path} )
GetParent( string {file/folder path} )
FolderIsEmpty( string {directory path} )
IsDir( string {directory path} )
ReadDir ( string {folder path}, string {extensions to return {wildcards allowed}})
NOTE: This now returns an "AutoIt array"
RecurseDir(string {folder path}, string {file masks[, bool {$dont_recurse=false}[, string {path to dump file}[, bool {$return_dirs=false}]]])
GrabCommentsFromIniSection( string{path to ini file}, string{ini section}[, bool{make array}[, string{ignore lines containing this}]])
WriteCommentsToIniSection( string{path to ini file}, string{ini section}, string{comments to write})
IniReadCheckBoxValue( string {ini file path}, string {"section"}, string {"key"}, string {"default value"} )
IniWriteCheckBoxValue( string {ini file path}, string {"section"}, string {"key"}, string {"value"} )
IniKeyExists( array (probably output from IniReadSeaction), string {key to search for})
InArray ( array{to search}, string{to find} )
MakeDummyArray ( string )
TwoD2OneDArray(array {Two-Dimensional array})
SaveSizePos(window handle, string{ini path}, string {ini section}[, int{min width}[, int{min height}
[,string{x name in ini}[, string{y name in ini}[, string{width name in ini}[, string{height name in ini}]]]]]])
RememberComboSelection( array{this combo box's special selection array}, string{value to store})
GetLastComboSelection( array{this combo box's special selection array}, array{list of current valid names in this combo})
VisitURL( string {valid URI} )
UrlToText( string{Valid URI or html file path)[, bool{local file = false} [, string{begin output from this string}]])
ReplaceHTMLEntities( string{text to translate entities in; &
OrdAbbAppend( int/string {number to append an ordinal abbreviation to (20 becomes "20th")})
LogError( string )
Deprecated (best to be app-specific) DoLog( string {log file full path}, string {a value to write*} [, string final output}])
PrintArray ( array [, string {title}, bool {true if 2D array}] )
Print2DArray(array {array to print} [, string {(name in console}[, int {line number}]])
DumpArray ( array )
debug( string )
ExitReport ( string )
--
From UDF's..
ArrayBox(ByRef $Array, $ArrayBase = 1, $sTitle = 'Array Box', $Width = 350, $Height = 350, $Left = -1, $Top = -1)
ce_Singleton($occurenceName, $flag = 0)
ce_IsPressed($Key)
QuitBox()
func BubbleSort(ByRef $bs_array)
for $i = uBound($bs_array)-1 to 1 step -1
for $j = 2 to $i
if $bs_array[$j-1] > $bs_array[$j] then
$temp = $bs_array[$j-1]
$bs_array[$j-1] = $bs_array[$j]
$bs_array[$j] = $temp
endif
next
next
return $bs_array
endfunc
func InsertionSort(ByRef $is_array)
for $i = 1 to uBound($is_array)-1
$index = $is_array[$i]
$j = $i
while $j > 1 and $is_array[$j-1] > $index
$is_array[$j] = $is_array[$j-1]
$j -= 1
wend
$is_array[$j] = $index
next
return $is_array
endfunc
func ShellSort(ByRef $some_array)
$increment = 1
while $increment > 0
for $i = 2 to uBound($some_array)-1
$j = $i
$temp = $some_array[$i]
while $j >= $increment and $some_array[$j-$increment] > $temp
$some_array[$j] = $some_array[$j-$increment]
$j = $j - $increment
wend
$some_array[$j] = $temp
next
if $increment/2 <> 0 then
$increment = int($increment/2)
elseif $increment = 1 then
$increment = 0
else
$increment = 1
endif
wend
return $some_array
endfunc
func MaxMax($num1, $num2, $num3=1.7E-308)
if not IsNumber($num1) or not IsNumber($num2) or not IsNumber($num3) then return
if $num1 > $num2 then
if $num3 > $num1 then return $num3
return $num1
else
if $num3 > $num2 then return $num3
return $num2
endif
endfunc
func MinMin($num1, $num2, $num3=1.7E+308)
if not IsNumber($num1) or not IsNumber($num2) or not IsNumber($num3) then return
if $num1 > $num2 then
if $num3 < $num2 then return $num3
return $num2
else
if $num3 < $num1 then return $num3
return $num1
endif
endfunc
func printf($format, $var1, $var2=-1, $var3=-1)
if $var2=-1 then
return StringFormat($format, $var1)
else
return StringFormat($format, $var1, $var2, $var3)
endif
endfunc
func BaseName($bn_path)
if StringRight($bn_path, 1) = "\" then $bn_path = StringTrimRight($bn_path, 1)
local $parts = StringSplit($bn_path, "\")
local $bn_tmp = $parts[$parts[0]]
if StringRight($bn_tmp, 1) = ":" then $bn_tmp = StringTrimRight($bn_tmp, 1)
return $bn_tmp
endfunc
func GetExtension($some_name)
$parts = StringSplit($some_name, ".")
local $e = $parts[$parts[0]]
if $e <> $some_name and not StringInStr($e, "\") then
return $e
else
return ""
endif
endfunc
func RemoveExtension($some_name)
local $add = 0
if StringInStr(BaseName($some_name), ".") then $add = 1
return StringTrimRight($some_name, StringLen(GetExtension($some_name)) + $add)
endfunc
func CleanName($some_name)
return RemoveExtension(BaseName($some_name))
endfunc
func CleanPath($string)
$string = StringReplace($string, "|", "~")
$string = StringReplace($string, '"', "'")
$string = StringReplace($string, ":", "~")
$string = StringReplace($string, "*", "~")
$string = StringReplace($string, "/", "~")
$string = StringReplace($string, "\", "~")
$string = StringReplace($string, ">", "~")
$string = StringReplace($string, "<", "~")
$string = StringReplace($string, "?", "~@")
return $string
endfunc
func GetParent($gp_dir)
if StringRight($gp_dir, 1) = "\" then $gp_dir = StringTrimRight($gp_dir, 1)
local $gp_full_path = StringSplit($gp_dir, "\")
return StringTrimRight($gp_dir, StringLen($gp_full_path[$gp_full_path[0]]) + 1) \"
endfunc
I:\temp\test\musk.mp3" >> returns: I
func GetWinDrive($gd_path)
select
case StringMid($gd_path, 2, 1) == ":"
return StringLeft($gd_path, 1)
case else
return false
endselect
endfunc
func LnkToReal($file)
if GetExtension($file) = "lnk" then
local $lnk_arr = FileGetShortcut($file)
if IsArray($lnk_arr) and FileExists($lnk_arr[0]) then return $lnk_arr[0]
else
return $file
endif
return false
endfunc
func FolderIsEmpty($fie_folder)
local $fie_search_files = FileFindFirstFile($fie_folder & "\*.*")
if $fie_search_files = -1 then
if @error = 1 then
FileClose($fie_search_files)
return 1
else
return 2
endif
endif
FileClose($fie_search_files)
return 0
endfunc
func IsDir($some_path)
return StringInStr(FileGetAttrib($some_path), "D")
endfunc
func ReadDir($folder, $extension)
local $files[1]
local $new_array[2]
search handle" of all the *.$extension files in the folder
$search_files = FileFindFirstFile($folder & "\*." & $extension)
if $search_files = -1 then
FileClose($search_files)
$search_files = FileFindFirstFile($folder & "\*." & $extension)
endif
$i = 1
do
$tmp = FileFindNextFile($search_files)
$files[$i-1] = $tmp
$i += 1
redim $files[$i]
until @error
FileClose($search_files)
$i = 2
for $this_file in $files
if StringInStr($this_file, $extension, 2) then
redim $new_array[$i]
$new_array[0] = $i-1
$new_array[$i-1] = $this_file
$i = $i + 1
endif
next
$files = 0
" then return 0
return $new_array
endfunc
AutoIt Array").
C:\Program Files", "*.reg,*.ini,*.cfg")
$dont_recurse" tells RecurseDir() to only return
dump file" to dump (log) the paths of all matched files; for debugging only,
$return_dirs" which
&=" operator. Those wee differences mount up.
global $quit = false
func RecurseDir($dir, $mask, $dont_recurse=false, $dump="", $return_dirs=false, $mx=1000000, $dirs_match_mask=false)
.\" & @ScriptName & " (" & @ScriptLineNumber & ") : ==> " & "dir: " & $dir & @LF)
.\" & @ScriptName & " (" & @ScriptLineNumber & ") : ==> " & "mask: " & $mask & @LF)
.\" & @ScriptName & " (" & @ScriptLineNumber & ") : ==> " & "dont_recurse: " & $dont_recurse & @LF)
.\" & @ScriptName & " (" & @ScriptLineNumber & ") : ==> " & "dump: " & $dump & @LF)
.\" & @ScriptName & " (" & @ScriptLineNumber & ") : ==> " & "return_dirs: " & $return_dirs & @LF)
.\" & @ScriptName & " (" & @ScriptLineNumber & ") : ==> " & "mx: " & $mx & @LF)
.\" & @ScriptName & " (" & @ScriptLineNumber & ") : ==> " & "dirs_match_mask: " & $dirs_match_mask & @LF)
local $n_dirnames[$mx]
local $n_dircount = 0
local $n_file
local $n_search
local $n_tfile
local $file_array
local $filenames
local $matching_dirs
local $filecount
local $dircount = 1
\" on the end of the given directory, remove that..
if StringRight($dir, 1) = "\" then $dir = StringTrimRight($dir, 1)
$n_dirnames[$dircount] = $dir
if not FileExists($dir) then return 0
while $dircount > $n_dircount
if $quit = 1 then return
$n_dircount += 1
$n_search = FileFindFirstFile($n_dirnames[$n_dircount] & "\*.*")
while 1
$n_file = FileFindNextFile($n_search)
if @error then exitloop
if $n_file = "." or $n_file = ".." then continueloop
$n_tfile = $n_dirnames[$n_dircount] & "\" & $n_file
if StringInStr(FileGetAttrib($n_tfile ), "D") and not $dont_recurse then
$dircount += 1
$n_dirnames[$dircount] = $n_tfile
endif
wend
FileClose($n_search)
if StringInStr($mask, ",", 2) then
$mask_array = StringSplit($mask, ",")
else
local $mask_array[2] = [1, $mask]
endif
for $mask_c = 1 to $mask_array[0]
$n_search = FileFindFirstFile($n_dirnames[$n_dircount] & "\" & $mask_array[$mask_c] )
if $n_search = -1 then continueloop
while 1
$n_file = FileFindNextFile($n_search)
if @error then
FileClose($n_search)
exitloop
endif
if $n_file = "." or $n_file = ".." then continueloop
$n_tfile = $n_dirnames[$n_dircount] & "\" & $n_file
if not StringInStr(FileGetAttrib( $n_tfile ), "D") then
$filecount += 1
$filenames &= $n_tfile & @LF
else
$matching_dirs &= $n_tfile & "|"
endif
wend
FileClose($n_search)
next
FileClose($n_search)
wend
if $return_dirs then
$tmp_str = ""
$i = 1
if $dirs_match_mask then
$matching_dirs = StringTrimRight($matching_dirs, 1)
$n_dirnames = StringSplit($matching_dirs, "|")
return $n_dirnames
else
while $n_dirnames[$i] <> ""
$tmp_str &= $n_dirnames[$i] & "|"
$i += 1
wend
$tmp_str = StringTrimRight($tmp_str, 1)
$n_dirnames = StringSplit($tmp_str, "|")
return $n_dirnames
endif
endif
$filenames = StringTrimRight($filenames, 1)
if $filenames = "" then return 0
$file_array = StringSplit($filenames, @LF)
if $dump then
$dump_file = FileOpen($dump, 2)
FileWrite($dump_file, $filenames)
FileClose($dump_file)
endif
return($file_array)
endfunc
test.ini", "foo")
foo", in the file; "test.ini"
\r\n"; Windows line-break) between each line, but none before or after..
;" will be
; returned beginning with a hash "(*&^(*&%*&^$&^£$^$%*&^%(*&%(")
$whole_file = FileOpen($ini_file, 0)
$file_lines = StringSplit(StringStripCR(FileRead($whole_file, FileGetSize($ini_file))), @LF)
FileClose($whole_file)
$comment_string = ""
$found_my_section = false
for $a = 1 to $file_lines[0]
$file_lines[$a] = StringStripWS($file_lines[$a], 3)
if $found_my_section and StringLeft($file_lines[$a], 1) = "[" then exitloop
if $file_lines[$a] = "[" & $ini_section & "]" then $found_my_section = true
if $found_my_section then
if StringLeft($file_lines[$a], 1) = ";", "\" & Basename($ini_file) & ".bax.ini", 1)
IniWrite($ini_file, $ini_section, "wctis_foo", "bar")
$whole_file = FileRead($ini_file)
$whole_file = StringReplace($whole_file, "[" & $ini_section & "]", "[" & $ini_section & "]" & @CRLF & $comment_string)
$tmp_file = FileOpen($ini_file, 2)
FileWrite($tmp_file, $whole_file)
FileClose($tmp_file)
if FileGetSize($ini_file) < FileGetSize(@TempDir & "\" & Basename($ini_file) & ".bax.ini") then
FileDelete($ini_file)
FileCopy(@TempDir & "\" & Basename($ini_file) & ".bax.ini", $ini_file)
return 0
endif
IniDelete($ini_file, $ini_section, "wctis_foo")
return 1
endfunc
transforms" an AutoIt or human unchecked value (4 or 0, respectively),
big_switch", $GUI_UNCHECKED)
4" is not a logical value, and most humans would expect
human" equivalents. Other "human" values are
func IniReadCheckBoxValue($rcbv_inifile, $rcbv_section, $rcbv_key, $rcbv_default)
$ircbv_val = IniRead($rcbv_inifile, $rcbv_section, $rcbv_key, $rcbv_default)
switch $ircbv_val
case $GUI_UNCHECKED
return $GUI_UNCHECKED
case "false", "off", "no", "not", "nope", "nay", "nay!", "nah", "nah!", "no way!", "no sir!", "negative", "neg", "no!"
return $GUI_UNCHECKED
case "true", "on", "yes", "yes!", "yay", "yay!", "yup", "hell yes!", "indeed", "yes sir!", "yessir!", "affirmative", "cool"
return $GUI_CHECKED
case "0"
return $GUI_UNCHECKED
case $GUI_CHECKED
return $GUI_CHECKED
case else -" (I sometimes employ, to enable user to disable something) let it pass..
return $ircbv_val
endswitch
endfunc
no", "off", or whatever, by passing the optional 5th/6th
func IniWriteCheckBoxValue($wcbv_inifile, $wcbv_section, $wcbv_key, $wcbv_val, $tru_val="true",$fal_val="false")
if $wcbv_val = $GUI_CHECKED then $wcbv_val = $tru_val
if $wcbv_val = $GUI_UNCHECKED then $wcbv_val = $fal_val
IniWrite($wcbv_inifile, $wcbv_section, $wcbv_key, $wcbv_val)
endfunc
func IniKeyExists(ByRef $search_array, $search_string)
if not IsArray($search_array) then
return false
endif
for $i = 1 to $search_array[0][0]
if $search_string = $search_array[$i][0] then
return $search_array[$i][1]
endif
next
return false
endfunc
func InArray(ByRef $ia_array, $ia_string)
if not IsArray($ia_array) then return SetError(1, 0, false)
$ia_limit = UBound($ia_array) - 1
for $i = 1 to $ia_limit 1"
if $ia_string = $ia_array[$i] then return $i
next
return false
endfunc
func InArrayValue(ByRef $ia_array, $ia_string)
if not IsArray($ia_array) then return SetError(1, -8, false)
$ia_limit = UBound($ia_array) - 1
for $i = 1 to $ia_limit
if StringInStr($ia_array[$i], $ia_string) then return $i
next
return false
endfunc
column marker" is simply a delimiter within the value which
path/name.ext") inside a
path/name.ext*179*20080621114934".
func InArrayColumn(ByRef $ia_array, $ia_string, $col=1, $marker="*")
if not IsArray($ia_array) then return SetError(1, -8, false)
$ia_limit = UBound($ia_array) - 1
for $i = 1 to $ia_limit
$columns = StringSplit($ia_array[$i], $marker)
if $columns[$col] == $ia_string then return $i
next
return false
endfunc
AutoIt array" with a single data element, that is, two elements; $dummy_array[1]
func MakeDummyArray($regular_string)
local $dummy_array[2] = [1, $regular_string]
return $dummy_array
endfunc
func TwoD2OneDArray(ByRef $Array2D)
if not IsArray($Array2D) then return false
local $array[$Array2D[0][0]+1]
$array[0] = $Array2D[0][0]
for $i = 1 to $Array2D[0][0]
$array[$i] = $Array2D[$i][1]
next
return $array
endfunc
SaveSizePos()
save a window's size and position preferences..
[mainly for windows that can be re-sized, but fine for fixed-size windows, too]
note: at the time of writing, this needs debugging.
SaveSizePos Parameters..
window handle = Control ID of the gui you want to save prefs for
string {ini path} = Full path to ini file to save settings to.
string {ini section} = Name of [section] to use in the specified ini file.
int {min width} [optional] = Minimum width gui is allowed to shrink to, defaults to 100.
int {min height} [optional] = Minimum height gui is allowed to shrink to, defaults to 50.
string {x name in ini} [optional] = The name of the "x" key inside the ini, defaults to "x".
string {y name in ini} [optional] = The name of the "y" key inside the ini, defaults to "y".
string {width name in ini} [optional] = The name of the "width" key inside the ini, defaults to "width".
string {height name in ini} [optional] = The name of the "height" key inside the ini, defaults to "height".
If don't want to write a value, set its name parameter to "-".
If you need to set any of the later optional paramters, but not earlier ones,
set the earlier parameters to an empty string "" to get their default values.
Simple usage..
SaveSizePos($my_gui, "my.ini", "prefs")
SaveSizePos($my_gui, "my.ini", "prefs", 380, 156)
Saving prefs for a second gui within the app..
SaveSizePos($my_other_gui, "my.ini", "prefs", 100, 20, "tool_x", "tool_y", "tool_width", "tool_height")
Save only width and height (but not x and y), and set minimum limits for those, too..
SaveSizePos($some_gui, "my.ini", "main prefs", 380, 80, "-", "-")
And so on.
func SaveSizePos($ssp_gui, $ssp_path, $ssp_section, $min_width="", $min_height="", $ssp_x="", $ssp_y="", $ssp_w="", $ssp_h="")
$wsize_array = WinGetPos($ssp_gui)
if not IsArray($wsize_array) then return
$x = $wsize_array[0]
$y = $wsize_array[1]
$width = $wsize_array[2]
$height = $wsize_array[3]
if not $ssp_x then $ssp_x = "x"
if not $ssp_y then $ssp_y = "y"
if not $ssp_w then $ssp_w = "width"
if not $ssp_h then $ssp_h = "height"
if $x < 0 then $x = 0
if $y > @DesktopWidth - $width then $y = @DesktopWidth - $width
if $ssp_x <> "-" then IniWrite($ssp_path, $ssp_section, $ssp_x, $x)
if $ssp_y <> "-" then IniWrite($ssp_path, $ssp_section, $ssp_y, $y)
$width = $wsize_array[2]
$height = $wsize_array[3]
if $min_width = "" then $min_width = 100
if $min_height = "" then $min_height = 50
if $width < $min_width then $width = $min_width
if $height < $min_height then $height = $min_height
$size_array = WinGetClientSize($ssp_gui)
if IsArray($size_array) then
if $ssp_w <> "-" then IniWrite($ssp_path, $ssp_section, $ssp_w, $size_array[0])
if $ssp_h <> "-" then IniWrite($ssp_path, $ssp_section, $ssp_h, $size_array[1])
endif
endfunc
previous" entry on
AutoIt" array for the values,
$previous_selection" will now contain the string, which you can
func RememberComboSelection(ByRef $combo_array, $value)
for $i = 1 to $combo_array[0]
if $combo_array[$i] = "" then
if $combo_array[$i-1] <> $value then
$combo_array[$i] = $value
endif
exitloop
endif
next
endfunc
func GetLastComboSelection(ByRef $combo_array, ByRef $names_list)
$new_val = ""
$i = $combo_array[0]
while $i > 0
if $combo_array[$i] <> "" then
if not InArray($names_list, $combo_array[$i]) then
$combo_array[$i] = ""
$i -= 1
continueloop
endif
$new_val = $combo_array[$i]
$combo_array[$i] = ""
exitloop
endif
$i -= 1
wend
last" value.
if $new_val = "" then $new_val = $names_list[$names_list[0]]
return $new_val
endfunc
history".
default browser" to our URL..
func VisitURL($vu_url="http:HKEY_CLASSES_ROOT\HTTP\shell\open\command", "")
$vu_browser_str = StringReplace($vu_browser_str, '"%1"', $vu_url)
run($vu_browser_str, "", @SW_SHOW)
if @error == 1 then
ShellExecute($vu_url)
return 0
else
return 1
endif
endfunc
RunErrorsFatal", 0)
RunErrorsFatal", 1) - sheer madness! [now deprecated -ed]
." dots are also added to break up big sections.
; $myText = UrlToText('http:
; $myText = UrlToText('http:
func UrlToText($url)
local $start = ""
local $end = ""
local $handle = ""
if StringInStr($url, "*", 0, -1) then
$url_parts = StringSplit($url, "*")
$url = $url_parts[1]
if uBound($url_parts) > 2 then $start = $url_parts[2]
if uBound($url_parts) > 3 then $end = $url_parts[3]
endif
if StringLeft($url, 4) = "http" then
InetGet($url, @tempdir & "\UrlToText.tmp", 1)
$handle = FileOpen(@tempdir & "\UrlToText.tmp", 0)
else
$handle = FileOpen($url, 0)
endif
$web_text = FileRead($handle)
$web_text = StringRegExpReplace($web_text, '</(div|p|tr|table)>', '. ')
$web_text = StringRegExpReplace($web_text, '\s', ' ')
$web_text = StringRegExpReplace($web_text, '<(?i)head(.*?)</(?i)head>', '')
$web_text = StringRegExpReplace($web_text, '<(?i)script(.*?)</(?i)script>', '')
$web_text = StringRegExpReplace($web_text, '<(?i)style(.*?)</(?i)style>', '')
$web_text = StringRegExpReplace($web_text, '</?[^>]*?>', '')
$web_text = ReplaceHTMLEntities($web_text)
if $start then
$web_text = StringTrimLeft($web_text, StringInStr($web_text, $start)-1)
endif
$strlen = StringLen($web_text)
$end_pos = StringInStr($web_text, $end)
if $end_pos = 0 then $end_pos = $strlen
if $end then
$web_text = StringTrimRight($web_text, $strlen-$end_pos+1)
endif
FileClose($handle)
FileDelete(@tempdir & "\UrlToText.tmp")
return StringStripWS($web_text, 4)
endfunc
func ReplaceHTMLEntities($text)
for $i = 32 to 255
$text = StringReplace($text, String('&
next
$text = StringReplace($text, "ÁáÂâ´ÆæÀà&alefsym&Alpha&alpha&&and&angÅå&asympÃãÄä&bdquo&Beta&beta¦&bull&capÇ縢&Chi&chi&circ&clubs&cong©&crarr&cup¤&dagger&Dagger&darr&dArr°&Delta&delta&diams÷ÉéÊêÈè&empty&emsp&ensp&Epsilon&epsilon&equiv&Eta&etaÐðËë&euro&exist&fnof&forall½¼¾&frasl&Gamma&gamma&ge>&harr&hArr&hearts&hellipÍíÎî¡Ìì&image&infin&int&Iota&iota¿&isinÏï&Kappa&kappa&Lambda&lambda&lang«&larr&lArr&lceil&ldquo&le&lfloor&lowast&loz&lrm&lsaquo&lsquo<¯&mdashµ·&minus&Mu&mu&nabla &ndash&ne&ni¬¬in&nsubÑñ&Nu&nuÓóÔô&OElig&oeligÒò&oline&Omega&omega&Omicron&omicron&oplus&orªºØøÕõ&otimesÖö¶&part&permil&perp&Phi&phi&Pi&pi&piv±£&prime&Prime&prod&prop&Psi&psi"
$text = StringReplace($text, "&radic, "√")
$text = StringReplace($text, "&rang, "〉")
$text = StringReplace($text, "», "»")
$text = StringReplace($text, "&rarr, "→")
$text = StringReplace($text, "&rArr, "⇒")
$text = StringReplace($text, "&rceil, "⌉")
$text = StringReplace($text, "&rdquo, "”")
$text = StringReplace($text, "&real, "ℜ")
$text = StringReplace($text, "®, "®")
$text = StringReplace($text, "&rfloor, "⌋")
$text = StringReplace($text, "&Rho, "Ρ")
$text = StringReplace($text, "&rho, "ρ")
$text = StringReplace($text, "&rlm, "")
$text = StringReplace($text, "&rsaquo, "›")
$text = StringReplace($text, "&rsquo, "’")
$text = StringReplace($text, "&sbquo, "‚")
$text = StringReplace($text, "&Scaron, "Š")
$text = StringReplace($text, "&scaron, "š")
$text = StringReplace($text, "&sdot, "⋅")
$text = StringReplace($text, "§, "§")
$text = StringReplace($text, "­, "")
$text = StringReplace($text, "&Sigma, "Σ")
$text = StringReplace($text, "&sigma, "σ")
$text = StringReplace($text, "&sigmaf, "ς")
$text = StringReplace($text, "&sim, "∼")
$text = StringReplace($text, "&spades, "♠")
$text = StringReplace($text, "&sub, "⊂")
$text = StringReplace($text, "&sube, "⊆")
$text = StringReplace($text, "&sum, "∑")
$text = StringReplace($text, "¹, "¹")
$text = StringReplace($text, "², "²")
$text = StringReplace($text, "³, "³")
$text = StringReplace($text, "&sup, "⊃")
$text = StringReplace($text, "&supe, "⊇")
$text = StringReplace($text, "ß, "ß")
$text = StringReplace($text, "&Tau, "Τ")
$text = StringReplace($text, "&tau, "τ")
$text = StringReplace($text, "&there4, "∴")
$text = StringReplace($text, "&Theta, "Θ")
$text = StringReplace($text, "&theta, "θ")
$text = StringReplace($text, "&thetasym, "ϑ")
$text = StringReplace($text, "&thinsp, " ")
$text = StringReplace($text, "Þ, "Þ")
$text = StringReplace($text, "þ, "þ")
$text = StringReplace($text, "&tilde, "˜")
$text = StringReplace($text, "×, "×")
$text = StringReplace($text, "&trade, "™")
$text = StringReplace($text, "Ú, "Ú")
$text = StringReplace($text, "ú, "ú")
$text = StringReplace($text, "&uarr, "↑")
$text = StringReplace($text, "&uArr, "⇑")
$text = StringReplace($text, "Û, "Û")
$text = StringReplace($text, "û, "û")
$text = StringReplace($text, "Ù, "Ù")
$text = StringReplace($text, "ù, "ù")
$text = StringReplace($text, "¨, "¨")
$text = StringReplace($text, "&upsih, "ϒ")
$text = StringReplace($text, "&Upsilon, "Υ")
$text = StringReplace($text, "&upsilon, "υ")
$text = StringReplace($text, "Ü, "Ü")
$text = StringReplace($text, "ü, "ü")
$text = StringReplace($text, "&weierp, "℘")
$text = StringReplace($text, "&Xi, "Ξ")
$text = StringReplace($text, "&xi, "ξ")
$text = StringReplace($text, "Ý, "Ý")
$text = StringReplace($text, "ý, "ý")
$text = StringReplace($text, "¥, "¥")
$text = StringReplace($text, "ÿ, "ÿ")
$text = StringReplace($text, "&Yuml, "Ÿ")
$text = StringReplace($text, "&Zeta, "Ζ")
$text = StringReplace($text, "&zeta, "ζ")
$text = StringReplace($text, "&zwj, "")
$text = StringReplace($text, "&zwnj, "")
return $text
endfunc
func EnCodeURL($text)
$text = StringReplace($text, " ", "%20")
$text = StringReplace($text, "!", "%21")
$text = StringReplace($text, '"', "%22")
$text = StringReplace($text, "$", "%24")
$text = StringReplace($text, "%", "%25")
$text = StringReplace($text, "&", "%26")
$text = StringReplace($text, "'", "%27")
$text = StringReplace($text, "(", "%28")
$text = StringReplace($text, ")", "%29")
$text = StringReplace($text, "*", "%2A")
$text = StringReplace($text, "+", "%2B")
$text = StringReplace($text, ",", "%2C")
$text = StringReplace($text, "-", "%2D")
$text = StringReplace($text, ".", "%2E")
$text = StringReplace($text, "/", "%2F")
$text = StringReplace($text, "0", "%30")
$text = StringReplace($text, "1", "%31")
$text = StringReplace($text, "2", "%32")
$text = StringReplace($text, "3", "%33")
$text = StringReplace($text, "4", "%34")
$text = StringReplace($text, "5", "%35")
$text = StringReplace($text, "6", "%36")
$text = StringReplace($text, "7", "%37")
$text = StringReplace($text, "8", "%38")
$text = StringReplace($text, "9", "%39")
$text = StringReplace($text, ":", "%3A")
$text = StringReplace($text, "<", "%3C")
$text = StringReplace($text, "=", "%3D")
$text = StringReplace($text, ">", "%3E")
$text = StringReplace($text, "?", "%3F")
$text = StringReplace($text, "@", "%40")
$text = StringReplace($text, "A", "%41")
$text = StringReplace($text, "B", "%42")
$text = StringReplace($text, "C", "%43")
$text = StringReplace($text, "D", "%44")
$text = StringReplace($text, "E", "%45")
$text = StringReplace($text, "F", "%46")
$text = StringReplace($text, "G", "%47")
$text = StringReplace($text, "H", "%48")
$text = StringReplace($text, "I", "%49")
$text = StringReplace($text, "J", "%4A")
$text = StringReplace($text, "K", "%4B")
$text = StringReplace($text, "L", "%4C")
$text = StringReplace($text, "M", "%4D")
$text = StringReplace($text, "N", "%4E")
$text = StringReplace($text, "O", "%4F")
$text = StringReplace($text, "P", "%50")
$text = StringReplace($text, "Q", "%51")
$text = StringReplace($text, "R", "%52")
$text = StringReplace($text, "S", "%53")
$text = StringReplace($text, "T", "%54")
$text = StringReplace($text, "U", "%55")
$text = StringReplace($text, "V", "%56")
$text = StringReplace($text, "W", "%57")
$text = StringReplace($text, "X", "%58")
$text = StringReplace($text, "Y", "%59")
$text = StringReplace($text, "Z", "%5A")
$text = StringReplace($text, "[", "%5B")
$text = StringReplace($text, "\", "%5C")
$text = StringReplace($text, "]", "%5D")
$text = StringReplace($text, "^", "%5E")
$text = StringReplace($text, "_", "%5F")
$text = StringReplace($text, "`", "%60")
$text = StringReplace($text, "a", "%61")
$text = StringReplace($text, "b", "%62")
$text = StringReplace($text, "c", "%63")
$text = StringReplace($text, "d", "%64")
$text = StringReplace($text, "e", "%65")
$text = StringReplace($text, "f", "%66")
$text = StringReplace($text, "g", "%67")
$text = StringReplace($text, "h", "%68")
$text = StringReplace($text, "i", "%69")
$text = StringReplace($text, "j", "%6A")
$text = StringReplace($text, "k", "%6B")
$text = StringReplace($text, "l", "%6C")
$text = StringReplace($text, "m", "%6D")
$text = StringReplace($text, "n", "%6E")
$text = StringReplace($text, "o", "%6F")
$text = StringReplace($text, "p", "%70")
$text = StringReplace($text, "q", "%71")
$text = StringReplace($text, "r", "%72")
$text = StringReplace($text, "s", "%73")
$text = StringReplace($text, "t", "%74")
$text = StringReplace($text, "u", "%75")
$text = StringReplace($text, "v", "%76")
$text = StringReplace($text, "w", "%77")
$text = StringReplace($text, "x", "%78")
$text = StringReplace($text, "y", "%79")
$text = StringReplace($text, "z", "%7A")
$text = StringReplace($text, "{", "%7B")
$text = StringReplace($text, "|", "%7C")
$text = StringReplace($text, "}", "%7D")
$text = StringReplace($text, "~", "%7E")
$text = StringReplace($text, " ", "%7F")
$text = StringReplace($text, "€", "%80")
$text = StringReplace($text, " ", "%81")
$text = StringReplace($text, "‚", "%82")
$text = StringReplace($text, "ƒ", "%83")
$text = StringReplace($text, "„", "%84")
$text = StringReplace($text, "…", "%85")
$text = StringReplace($text, "†", "%86")
$text = StringReplace($text, "‡", "%87")
$text = StringReplace($text, "ˆ", "%88")
$text = StringReplace($text, "‰", "%89")
$text = StringReplace($text, "Š", "%8A")
$text = StringReplace($text, "‹", "%8B")
$text = StringReplace($text, "Œ", "%8C")
$text = StringReplace($text, " ", "%8D")
$text = StringReplace($text, "Ž", "%8E")
$text = StringReplace($text, " ", "%8F")
$text = StringReplace($text, " ", "%90")
$text = StringReplace($text, "‘", "%91")
$text = StringReplace($text, "’", "%92")
$text = StringReplace($text, "“", "%93")
$text = StringReplace($text, "”", "%94")
$text = StringReplace($text, "•", "%95")
$text = StringReplace($text, "–", "%96")
$text = StringReplace($text, "—", "%97")
$text = StringReplace($text, "˜", "%98")
$text = StringReplace($text, "™", "%99")
$text = StringReplace($text, "š", "%9A")
$text = StringReplace($text, "›", "%9B")
$text = StringReplace($text, "œ", "%9C")
$text = StringReplace($text, " ", "%9D")
$text = StringReplace($text, "ž", "%9E")
$text = StringReplace($text, "Ÿ", "%9F")
$text = StringReplace($text, " ", "%A0")
$text = StringReplace($text, "¡", "%A1")
$text = StringReplace($text, "¢", "%A2")
$text = StringReplace($text, "£", "%A3")
$text = StringReplace($text, " ", "%A4")
$text = StringReplace($text, "¥", "%A5")
$text = StringReplace($text, "|", "%A6")
$text = StringReplace($text, "§", "%A7")
$text = StringReplace($text, "¨", "%A8")
$text = StringReplace($text, "©", "%A9")
$text = StringReplace($text, "ª", "%AA")
$text = StringReplace($text, "«", "%AB")
$text = StringReplace($text, "¬", "%AC")
$text = StringReplace($text, "¯", "%AD")
$text = StringReplace($text, "®", "%AE")
$text = StringReplace($text, "¯", "%AF")
$text = StringReplace($text, "°", "%B0")
$text = StringReplace($text, "±", "%B1")
$text = StringReplace($text, "²", "%B2")
$text = StringReplace($text, "³", "%B3")
$text = StringReplace($text, "´", "%B4")
$text = StringReplace($text, "µ", "%B5")
$text = StringReplace($text, "¶", "%B6")
$text = StringReplace($text, "·", "%B7")
$text = StringReplace($text, "¸", "%B8")
$text = StringReplace($text, "¹", "%B9")
$text = StringReplace($text, "º", "%BA")
$text = StringReplace($text, "»", "%BB")
$text = StringReplace($text, "¼", "%BC")
$text = StringReplace($text, "½", "%BD")
$text = StringReplace($text, "¾", "%BE")
$text = StringReplace($text, "¿", "%BF")
$text = StringReplace($text, "À", "%C0")
$text = StringReplace($text, "Á", "%C1")
$text = StringReplace($text, "Â", "%C2")
$text = StringReplace($text, "Ã", "%C3")
$text = StringReplace($text, "Ä", "%C4")
$text = StringReplace($text, "Å", "%C5")
$text = StringReplace($text, "Æ", "%C6")
$text = StringReplace($text, "Ç", "%C7")
$text = StringReplace($text, "È", "%C8")
$text = StringReplace($text, "É", "%C9")
$text = StringReplace($text, "Ê", "%CA")
$text = StringReplace($text, "Ë", "%CB")
$text = StringReplace($text, "Ì", "%CC")
$text = StringReplace($text, "Í", "%CD")
$text = StringReplace($text, "Î", "%CE")
$text = StringReplace($text, "Ï", "%CF")
$text = StringReplace($text, "Ð", "%D0")
$text = StringReplace($text, "Ñ", "%D1")
$text = StringReplace($text, "Ò", "%D2")
$text = StringReplace($text, "Ó", "%D3")
$text = StringReplace($text, "Ô", "%D4")
$text = StringReplace($text, "Õ", "%D5")
$text = StringReplace($text, "Ö", "%D6")
$text = StringReplace($text, " ", "%D7")
$text = StringReplace($text, "Ø", "%D8")
$text = StringReplace($text, "Ù", "%D9")
$text = StringReplace($text, "Ú", "%DA")
$text = StringReplace($text, "Û", "%DB")
$text = StringReplace($text, "Ü", "%DC")
$text = StringReplace($text, "Ý", "%DD")
$text = StringReplace($text, "Þ", "%DE")
$text = StringReplace($text, "ß", "%DF")
$text = StringReplace($text, "à", "%E0")
$text = StringReplace($text, "á", "%E1")
$text = StringReplace($text, "â", "%E2")
$text = StringReplace($text, "ã", "%E3")
$text = StringReplace($text, "ä", "%E4")
$text = StringReplace($text, "å", "%E5")
$text = StringReplace($text, "æ", "%E6")
$text = StringReplace($text, "ç", "%E7")
$text = StringReplace($text, "è", "%E8")
$text = StringReplace($text, "é", "%E9")
$text = StringReplace($text, "ê", "%EA")
$text = StringReplace($text, "ë", "%EB")
$text = StringReplace($text, "ì", "%EC")
$text = StringReplace($text, "í", "%ED")
$text = StringReplace($text, "î", "%EE")
$text = StringReplace($text, "ï", "%EF")
$text = StringReplace($text, "ð", "%F0")
$text = StringReplace($text, "ñ", "%F1")
$text = StringReplace($text, "ò", "%F2")
$text = StringReplace($text, "ó", "%F3")
$text = StringReplace($text, "ô", "%F4")
$text = StringReplace($text, "õ", "%F5")
$text = StringReplace($text, "ö", "%F6")
$text = StringReplace($text, "÷", "%F7")
$text = StringReplace($text, "ø", "%F8")
$text = StringReplace($text, "ù", "%F9")
$text = StringReplace($text, "ú", "%FA")
$text = StringReplace($text, "û", "%FB")
$text = StringReplace($text, "ü", "%FC")
$text = StringReplace($text, "ý", "%FD")
$text = StringReplace($text, "þ", "%FE")
$text = StringReplace($text, "ÿ", "%FF")
return $text
endfunc
func DeCodeURL($text)
$text = StringReplace($text, "%20", " ")
$text = StringReplace($text, "%21", "!")
$text = StringReplace($text, "%22", '"')
$text = StringReplace($text, "%23", ")
$text = StringReplace($text, "%24", "$")
$text = StringReplace($text, "%25", "%")
$text = StringReplace($text, "%26", "&")
$text = StringReplace($text, "%27", "'")
$text = StringReplace($text, "%28", "(")
$text = StringReplace($text, "%29", ")")
$text = StringReplace($text, "%2A", "*")
$text = StringReplace($text, "%2B", "+")
$text = StringReplace($text, "%2C", ",")
$text = StringReplace($text, "%2D", "-")
$text = StringReplace($text, "%2E", ".")
$text = StringReplace($text, "%2F", "/")
$text = StringReplace($text, "%30", "0")
$text = StringReplace($text, "%31", "1")
$text = StringReplace($text, "%32", "2")
$text = StringReplace($text, "%33", "3")
$text = StringReplace($text, "%34", "4")
$text = StringReplace($text, "%35", "5")
$text = StringReplace($text, "%36", "6")
$text = StringReplace($text, "%37", "7")
$text = StringReplace($text, "%38", "8")
$text = StringReplace($text, "%39", "9")
$text = StringReplace($text, "%3A", ":")
$text = StringReplace($text, "%3B", ")
$text = StringReplace($text, "%3C", "<")
$text = StringReplace($text, "%3D", "=")
$text = StringReplace($text, "%3E", ">")
$text = StringReplace($text, "%3F", "?")
$text = StringReplace($text, "%40", "@")
$text = StringReplace($text, "%41", "A")
$text = StringReplace($text, "%42", "B")
$text = StringReplace($text, "%43", "C")
$text = StringReplace($text, "%44", "D")
$text = StringReplace($text, "%45", "E")
$text = StringReplace($text, "%46", "F")
$text = StringReplace($text, "%47", "G")
$text = StringReplace($text, "%48", "H")
$text = StringReplace($text, "%49", "I")
$text = StringReplace($text, "%4A", "J")
$text = StringReplace($text, "%4B", "K")
$text = StringReplace($text, "%4C", "L")
$text = StringReplace($text, "%4D", "M")
$text = StringReplace($text, "%4E", "N")
$text = StringReplace($text, "%4F", "O")
$text = StringReplace($text, "%50", "P")
$text = StringReplace($text, "%51", "Q")
$text = StringReplace($text, "%52", "R")
$text = StringReplace($text, "%53", "S")
$text = StringReplace($text, "%54", "T")
$text = StringReplace($text, "%55", "U")
$text = StringReplace($text, "%56", "V")
$text = StringReplace($text, "%57", "W")
$text = StringReplace($text, "%58", "X")
$text = StringReplace($text, "%59", "Y")
$text = StringReplace($text, "%5A", "Z")
$text = StringReplace($text, "%5B", "[")
$text = StringReplace($text, "%5C", "\")
$text = StringReplace($text, "%5D", "]")
$text = StringReplace($text, "%5E", "^")
$text = StringReplace($text, "%5F", "_")
$text = StringReplace($text, "%60", "`")
$text = StringReplace($text, "%61", "a")
$text = StringReplace($text, "%62", "b")
$text = StringReplace($text, "%63", "c")
$text = StringReplace($text, "%64", "d")
$text = StringReplace($text, "%65", "e")
$text = StringReplace($text, "%66", "f")
$text = StringReplace($text, "%67", "g")
$text = StringReplace($text, "%68", "h")
$text = StringReplace($text, "%69", "i")
$text = StringReplace($text, "%6A", "j")
$text = StringReplace($text, "%6B", "k")
$text = StringReplace($text, "%6C", "l")
$text = StringReplace($text, "%6D", "m")
$text = StringReplace($text, "%6E", "n")
$text = StringReplace($text, "%6F", "o")
$text = StringReplace($text, "%70", "p")
$text = StringReplace($text, "%71", "q")
$text = StringReplace($text, "%72", "r")
$text = StringReplace($text, "%73", "s")
$text = StringReplace($text, "%74", "t")
$text = StringReplace($text, "%75", "u")
$text = StringReplace($text, "%76", "v")
$text = StringReplace($text, "%77", "w")
$text = StringReplace($text, "%78", "x")
$text = StringReplace($text, "%79", "y")
$text = StringReplace($text, "%7A", "z")
$text = StringReplace($text, "%7B", "{")
$text = StringReplace($text, "%7C", "|")
$text = StringReplace($text, "%7D", "}")
$text = StringReplace($text, "%7E", "~")
$text = StringReplace($text, "%7F", " ")
$text = StringReplace($text, "%80", "€")
$text = StringReplace($text, "%81", " ")
$text = StringReplace($text, "%82", "‚")
$text = StringReplace($text, "%83", "ƒ")
$text = StringReplace($text, "%84", "„")
$text = StringReplace($text, "%85", "…")
$text = StringReplace($text, "%86", "†")
$text = StringReplace($text, "%87", "‡")
$text = StringReplace($text, "%88", "ˆ")
$text = StringReplace($text, "%89", "‰")
$text = StringReplace($text, "%8A", "Š")
$text = StringReplace($text, "%8B", "‹")
$text = StringReplace($text, "%8C", "Œ")
$text = StringReplace($text, "%8D", " ")
$text = StringReplace($text, "%8E", "Ž")
$text = StringReplace($text, "%8F", " ")
$text = StringReplace($text, "%90", " ")
$text = StringReplace($text, "%91", "‘")
$text = StringReplace($text, "%92", "’")
$text = StringReplace($text, "%93", "“")
$text = StringReplace($text, "%94", "”")
$text = StringReplace($text, "%95", "•")
$text = StringReplace($text, "%96", "–")
$text = StringReplace($text, "%97", "—")
$text = StringReplace($text, "%98", "˜")
$text = StringReplace($text, "%99", "™")
$text = StringReplace($text, "%9A", "š")
$text = StringReplace($text, "%9B", "›")
$text = StringReplace($text, "%9C", "œ")
$text = StringReplace($text, "%9D", " ")
$text = StringReplace($text, "%9E", "ž")
$text = StringReplace($text, "%9F", "Ÿ")
$text = StringReplace($text, "%A0", " ")
$text = StringReplace($text, "%A1", "¡")
$text = StringReplace($text, "%A2", "¢")
$text = StringReplace($text, "%A3", "£")
$text = StringReplace($text, "%A4", " ")
$text = StringReplace($text, "%A5", "¥")
$text = StringReplace($text, "%A6", "|")
$text = StringReplace($text, "%A7", "§")
$text = StringReplace($text, "%A8", "¨")
$text = StringReplace($text, "%A9", "©")
$text = StringReplace($text, "%AA", "ª")
$text = StringReplace($text, "%AB", "«")
$text = StringReplace($text, "%AC", "¬")
$text = StringReplace($text, "%AD", "¯")
$text = StringReplace($text, "%AE", "®")
$text = StringReplace($text, "%AF", "¯")
$text = StringReplace($text, "%B0", "°")
$text = StringReplace($text, "%B1", "±")
$text = StringReplace($text, "%B2", "²")
$text = StringReplace($text, "%B3", "³")
$text = StringReplace($text, "%B4", "´")
$text = StringReplace($text, "%B5", "µ")
$text = StringReplace($text, "%B6", "¶")
$text = StringReplace($text, "%B7", "·")
$text = StringReplace($text, "%B8", "¸")
$text = StringReplace($text, "%B9", "¹")
$text = StringReplace($text, "%BA", "º")
$text = StringReplace($text, "%BB", "»")
$text = StringReplace($text, "%BC", "¼")
$text = StringReplace($text, "%BD", "½")
$text = StringReplace($text, "%BE", "¾")
$text = StringReplace($text, "%BF", "¿")
$text = StringReplace($text, "%C0", "À")
$text = StringReplace($text, "%C1", "Á")
$text = StringReplace($text, "%C2", "Â")
$text = StringReplace($text, "%C3", "Ã")
$text = StringReplace($text, "%C4", "Ä")
$text = StringReplace($text, "%C5", "Å")
$text = StringReplace($text, "%C6", "Æ")
$text = StringReplace($text, "%C7", "Ç")
$text = StringReplace($text, "%C8", "È")
$text = StringReplace($text, "%C9", "É")
$text = StringReplace($text, "%CA", "Ê")
$text = StringReplace($text, "%CB", "Ë")
$text = StringReplace($text, "%CC", "Ì")
$text = StringReplace($text, "%CD", "Í")
$text = StringReplace($text, "%CE", "Î")
$text = StringReplace($text, "%CF", "Ï")
$text = StringReplace($text, "%D0", "Ð")
$text = StringReplace($text, "%D1", "Ñ")
$text = StringReplace($text, "%D2", "Ò")
$text = StringReplace($text, "%D3", "Ó")
$text = StringReplace($text, "%D4", "Ô")
$text = StringReplace($text, "%D5", "Õ")
$text = StringReplace($text, "%D6", "Ö")
$text = StringReplace($text, "%D7", " ")
$text = StringReplace($text, "%D8", "Ø")
$text = StringReplace($text, "%D9", "Ù")
$text = StringReplace($text, "%DA", "Ú")
$text = StringReplace($text, "%DB", "Û")
$text = StringReplace($text, "%DC", "Ü")
$text = StringReplace($text, "%DD", "Ý")
$text = StringReplace($text, "%DE", "Þ")
$text = StringReplace($text, "%DF", "ß")
$text = StringReplace($text, "%E0", "à")
$text = StringReplace($text, "%E1", "á")
$text = StringReplace($text, "%E2", "â")
$text = StringReplace($text, "%E3", "ã")
$text = StringReplace($text, "%E4", "ä")
$text = StringReplace($text, "%E5", "å")
$text = StringReplace($text, "%E6", "æ")
$text = StringReplace($text, "%E7", "ç")
$text = StringReplace($text, "%E8", "è")
$text = StringReplace($text, "%E9", "é")
$text = StringReplace($text, "%EA", "ê")
$text = StringReplace($text, "%EB", "ë")
$text = StringReplace($text, "%EC", "ì")
$text = StringReplace($text, "%ED", "í")
$text = StringReplace($text, "%EE", "î")
$text = StringReplace($text, "%EF", "ï")
$text = StringReplace($text, "%F0", "ð")
$text = StringReplace($text, "%F1", "ñ")
$text = StringReplace($text, "%F2", "ò")
$text = StringReplace($text, "%F3", "ó")
$text = StringReplace($text, "%F4", "ô")
$text = StringReplace($text, "%F5", "õ")
$text = StringReplace($text, "%F6", "ö")
$text = StringReplace($text, "%F7", "÷")
$text = StringReplace($text, "%F8", "ø")
$text = StringReplace($text, "%F9", "ù")
$text = StringReplace($text, "%FA", "ú")
$text = StringReplace($text, "%FB", "û")
$text = StringReplace($text, "%FC", "ü")
$text = StringReplace($text, "%FD", "ý")
$text = StringReplace($text, "%FE", "þ")
$text = StringReplace($text, "%FF", "ÿ")
return $text
endfunc
func OrdAbbAppend($d_str)
if $d_str < 1 then
SetError(1)
return ""
endif
local $appends[10]
$appends[0] = "th"
$appends[1] = "st"
$appends[2] = "nd"
$appends[3] = "rd"
$appends[4] = "th"
$appends[5] = "th"
$appends[6] = "th"
$appends[7] = "th"
$appends[8] = "th"
$appends[9] = "th"
if StringMid($d_str, StringLen($d_str)-1, 1) == 1 then
$appends[1] = "th"
$appends[2] = "th"
$appends[3] = "th"
endif
return $d_str & $appends[StringRight($d_str, 1)]
endfunc
func LogError($error_string)
FileWriteLine(@ScriptDir & "\error.log", "")
FileWriteLine(@ScriptDir & "\error.log", _
"--------------------------------------------------------------------------------")
FileWriteLine(@ScriptDir & "\error.log", @Year & "/" & @Mon & "/" & @MDay _
& " " & @Hour & ":" & @Min & ":" & @Sec )
FileWriteLine(@ScriptDir & "\error.log", "")
FileWriteLine(@ScriptDir & "\error.log", "command-line: " & $CmdLineRaw)
FileWriteLine(@ScriptDir & "\error.log", "")
FileWriteLine(@ScriptDir & "\error.log", $error_string)
endfunc
func PrintArray(ByRef $array, $tring="array", $limit=0, $ln="")
if @compiled then return
$pre = ""
if $ln <> "" then $pre = ".\" & @ScriptName & " (" & $ln & ") : ==> "
if not IsArray($array) then
ConsoleWrite($pre & $tring & ": NOT an array!" & @LF)
ConsoleWrite($pre & "it's a string: " & "->" & $array & "<-" & @LF & @LF)
return 0
endif
local $pa_string = ""
local $count = 0
for $element in $array
$pa_string &= '[' & $count & '] : ' & $element & @LF
$count += 1
if $count = $limit then exitloop
next
SplashOff()
ProgressOff()
ConsoleWrite($pre & $tring & ": " & @LF & $pa_string & @LF)
endfunc
func Print2DArray(ByRef $array, $tring="array", $limit=0, $ln="")
if @compiled then return
$pre = ""
if $ln <> "" then $pre = ".\" & @ScriptName & " (" & $ln & ") : ==> "
if not IsArray($array) then
ConsoleWrite($pre & $tring & ": NOT an array!" & @LF)
ConsoleWrite($pre & "it's a string: " & "->" & $array & "<-" & @LF & @LF)
return 0
endif
$limit += 1
local $pa_string = ""
for $i = 0 to $array[0][0]
$pa_string &= '[' & $i & '] [0] = ' & $array[$i][0] & ' [1] = ' & $array[$i][1] & @LF
next
SplashOff()
ProgressOff()
ConsoleWrite($pre & $tring & ": " & @LF & $pa_string & @LF & @LF)
endfunc
func DumpArray(ByRef $array, $dump_file="dump", $new=false)
if @compiled then return
if $new then FileOpen($dump_file, 2)
if not IsArray($array) then return 0
local $da_string = ""
local $count = 0
for $element in $array
$da_string &= '[' & $count & '] : ' & $element & @CRLF
$count += 1
next
FileWrite($dump_file, $da_string)
endfunc
func dump($d_string, $ln=false, $dump_file="dump")
if @compiled and ($ce_debug = 0 or $ce_debug = $GUI_UNCHECKED) then return 0
if $d_string = "new" then
FileOpen($dump_file, 10)
return 1
endif
$pre = ""
if $ln then $pre = ".\" & @ScriptName & " (" & $ln & ") : ==> "
FileWrite($dump_file, $pre & $d_string & @CRLF)
endfunc
func debug($d_string, $ln=false)
if ($ce_debug <> 0 and $ce_debug <> $GUI_UNCHECKED) then
return dump($d_string, "compiled", "debug")
else
if @compiled then return 0
endif
$pre = ""
if $ln then $pre = ".\" & @ScriptName & " (" & $ln & ") : ==> "
ConsoleWrite($pre & $d_string & @LF)
endfunc
func ExitReport($er_string, $code="")
MsgBox(262160, "Error " & $code, $er_string, 60)
exit $code
endfunc
Func ArrayBox(ByRef $Array, $ArrayBase=1, $sTitle='Array Box', $Width=500, $Height=300, $Left=-1, $Top=100)
if @compiled then return
local $i, $j, $ArrayDimensions = UBound($Array, 0)
local $hndForm_Main, $hndListView_Display
If $ArrayDimensions = 0 Then
SetError(1)
Return -1
EndIf
If $ArrayBase <> 0 Then $ArrayBase = 1
If $ArrayBase Then
Select
Case $ArrayDimensions = 1
$ArrayMax = $Array[0]
Case $ArrayDimensions = 2
$ArrayMax = $Array[0][0]
EndSelect
Else
$ArrayMax = UBound($Array, 1) - 1
EndIf
If $Width < 200 Then $Width = 200
If $Height < 100 Then $Height = 100
$last_event_mode = AutoItSetOption("GUIOnEventMode", 1)
$hndForm_Main = GUICreate($sTitle, $Width, $Height, $Left, $Top, BitOR(0x80000000, 0x00C00000, 0x00040000))
GUISetOnEvent(-3, "QuitBox" , $hndForm_Main)
If $ArrayDimensions = 1 Then
$sTemp = 'Index|Value'
ElseIf $ArrayDimensions = 2 Then
$sTemp = 'Index'
For $i = 0 To UBound($Array, 2) - 1
$sTemp = $sTemp & '|' & $i
Next
EndIf
$hndListView_Display = GUICtrlCreateListView($sTemp, 0, 0, $Width, $Height-32, BitOR(0x0008, 0x0004))
GUICtrlSetResizing($hndListView_Display, BitOR(0x0002, 0x0020, 0x0004, 0x0040))
$hndButton_Close = GUICtrlCreateButton('&Close',$Width-83,$Height-30,80,24)
GUICtrlSetOnEvent(-1, "QuitBox")
GUICtrlSetResizing(-1, BitOR(0x0004, 0x0040, 0x0300))
GUICtrlSetState($hndButton_Close, 512)
GUISetState (@SW_SHOW, $hndForm_Main)
Select
Case $ArrayDimensions = 1
For $i = $ArrayBase To $ArrayMax
GUICtrlCreateListViewItem($i & '|' & $Array[$i], $hndListView_Display)
Next
Case $ArrayDimensions = 2
For $i = $ArrayBase To $ArrayMax
$sTemp=$Array[$i][0]
for $j = 1 To UBound($Array, 2) - 1
$sTemp = $sTemp & '|' & $Array[$i][$j]
Next
GUICtrlCreateListViewItem('[' & $i & ']|' & $sTemp, $hndListView_Display)
Next
Case Else
EndSelect
global $QuitBox = 0
do
Sleep(100)
until $QuitBox = 1
AutoItSetOption("GUIOnEventMode", $last_event_mode)
GUIDelete($hndForm_Main)
Return 0
EndFunc
Func ce_Singleton($occurenceName, $flag = 0)
Local $ERROR_ALREADY_EXISTS = 183
$occurenceName = StringReplace($occurenceName, "\", "")
Local $handle = DllCall("kernel32.dll", "int", "CreateMutex", "int", 0, "long", 1, "str", $occurenceName)
Local $lastError = DllCall("kernel32.dll", "int", "GetLastError")
If $lastError[0] = $ERROR_ALREADY_EXISTS Then
If $flag = 0 Then
Exit -1
Else
SetError($lastError[0])
Return 0
EndIf
EndIf
Return $handle[0]
EndFunc
func ce_IsPressed($Key)
local $kp = DllCall('user32.dll', "int", "GetAsyncKeyState", "int", '0x' & $Key)
if not @error and BitAND($kp[0], 0x8000) = 0x8000 then return 1
return 0
endfunc
func QuitBox()
$QuitBox = 1
endfunc
itstory..
0.6.4
* Fixed "bug" in recursedir where search handles could be left unclosed
0.6.3
+ Added LnkToReal() which convert a shortcut to its real target path
+ Added CleanPath() which makes any old string safe for use as a file name
0.6.2 [current beta release]
+ Added OrdAbbAppend(), which appends the ordinal abbreviation to a number,
in other words, converts 20 into "20th".
* Fixed potential issue in GetParent() when sending a directory with a
slash at the end.
+ debug() can now switch to dump() output automatically once compiled, you
simply set $ce_debug to true in your script somewhere, perhaps a user-
preference could enable this, for example..
$ce_debug = IniReadCheckBoxValue($ini_path, $my_name, "debug", 0)
Remember to send "new" to start a new debug file.
0.6.1
~ IniReadCheckBoxValue() no longer considers an empty string "" in the ini
to be false. It is now simply passed as blank.
~ InArray() now returns the index of the match, as opposed to simply true.
This will still (render) a true result in future conditional statements,
but has the added advantage of enabling you to get directly to the
result with no further testing.
+ Added InArrayValue() which is like InArray(), expect rather than an exact
match, it will return non-false for any partial matching string within a
value. Returns the index (int) containing the first partial match.
0.6
+ Added TwoD2OneDArray and Print2DArray() functions
~ IniWriteCheckBoxValue() now writes "true" and "false" be default.
~ switched (soon to be deprecated) "dim" commands for "local", etc.
0.5.8
~ VisitURL() will now simply grab the URL using IE, if the default
browser entry in the registry is broken (this can happen, apparently)
Rememebr to use AutoItSetOption("RunErrorsFatal", 0) so the Run
command doesn't halt your program.
0.5.7
* Fixed a bug in InArray() which could potentially return numeric index
entries as positive results, i.e. "0"
..
0.5.2
* fixed a bug in GetParent where for a path like..
I:\work\dev\all files\test\a
It would remove the "\a", as expected, but removed it from
"dev\all files", making "devll files", unexpected!
Now we simply trim off "so-many" characters from the right. the
"so-many" being the length of the final part of the path.
* BaseName() will now trim any traling slashes you might have left at the
end of the folder path, before working on the string.