Hi,
i am no programmer but i tried to decode an url that is in clipboard, but i get this error:
---------------------------
Lua Script Error!
---------------------------
[string "ActionScript"]:28: attempt to call global 'decodeURI' (a nil value)
---------------------------
OK
---------------------------
the code i tried looks like this:
str = acGetClipboardText()
acDelay(100)
decodeURI(str)
acDelay(100)
acSetClipboardText(str)
i also tried to replace decodeURI with other codes i found with internet search.
the error does not appear, but the url is not decoded.
str = acGetClipboardText()
acDelay(100)
local decodeURI
do
local char, gsub, tonumber = string.char, string.gsub, tonumber
local function _(hex) return char(tonumber(hex, 16)) end
function decodeURI(s)
s = gsub(s, '%%(%x%x)', _)
return s
end
end
print(decodeURI(str))
acDelay(100)
acSetClipboardText(str)
or
str = acGetClipboardText()
acDelay(100)
local hex={}
for i=0,255 do
hex[string.format("%0x",i)]=string.char(i)
hex[string.format("%0X",i)]=string.char(i)
end
local function decodeURI(s)
return (s:gsub('%%(%x%x)',hex))
end
print(decodeURI(str))
acDelay(100)
acSetClipboardText(str)
any solutions for my problem?