cocobelgica / autohotkey-util Goto Github PK
View Code? Open in Web Editor NEWUtility functions for AutoHotkey. Works on both AHK v1.1 and v2.0-a builds.
Utility functions for AutoHotkey. Works on both AHK v1.1 and v2.0-a builds.
Hey @cocobelgica
Got this from the old thread.
The 6432Node bit doesn't apply- see this and the following answer- + cannot jump out of finally block any more.
Here's a modded version of it that addresses just those (sorry- fixated on FixIE as everyone else seemed to be):
Edit: also modded the "version := Round..." line where, previously, existing reg entries greater than 1000 would be multiplied by 1000 again.
``
``FixIE(version:="*") ;// FEATURE_BROWSER_EMULATION -> http://goo.gl/V01Frx
{
static key := "HKCU\Software\"
. "Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION\"
. ( A_IsCompiled ? A_ScriptName : StrGet(DllCall("Shlwapi\PathFindFileName", "Str", A_AhkPath)) )
static WshShell := ComObjCreate("WScript.Shell")
static prev := "*"
if (prev == "*") ;// init
try prev := WshShell.RegRead(key)
catch ;// value does not exist
prev := ""
;// __Get()
if (version == "*")
{
try val := WshShell.RegRead(key)
catch ;// value does not exist
{
val := "" ;// throw Exception()??
}
return val
}
;// __Set()
ie_version := Round(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Internet Explorer\svcVersion"))
if (ie_version < 8) ;// unsure of this but I read it somewhere...
throw Exception("FEATURE_BROWSER_EMULATION is only available for IE8 and later.")
if version
{
if !(version ~= "i)^7|-?(8|9|1[01])|edge$")
throw Exception(Format("Invalid argument: '{1}'", version))
if (version = "edge")
version := ie_version
version := Round(version * (version>0 ? ((version>=1000)? 1 : 1000) : -(version>=-9 ? 1111 : 1000.1)))
}
try version? WshShell.RegWrite(key, version, "REG_DWORD")
: (prev != "" ? WshShell.RegWrite(key, prev, "REG_DWORD") : WshShell.RegDelete(key))
catch error
{
throw error
}
return FixIE() ;// OR return the value itself
}
Thanks.
In WScript.Shell.Exec, some streams need some time to finish reading, so we poll AtEndOfStream and collate the ReadAll
In Subprocess.ahk's case it's the opposite. Doing a drop in replacement results in a script polling this nonexistent property (which returns a falsy value) and so it is stuck in a polling loop thinking EOF is far far away.
And yeah, I can write my code around it but it'd be a nice thing to have to facilitate a drop-in replacement.
edit: scratch that, this is an important property that should be exposed on the same level as the Read method.
I have no idea what this regex does here:
https://github.com/cocobelgica/AutoHotkey-Util/blob/master/EnumIncludes.ahk#L65
IsContSection := line ~= "i)^\((?:\s*(?(?<=\s)(?!;)|(?<=\())(\bJoin\S*|[^\s)]+))*(?<!:)(?:\s+;.*)?$"
But it fails anytime there are spaces preceding the opening (
.
Changing the start from ^\(
to ^\s*\(
works.
Can you explain what that regex does to me?
This is an awesome collection - any chance you name them?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.