Administrators Jon Posted August 27, 2007 Administrators Share Posted August 27, 2007 We are struggling to come up with a "fix" to the advanced window descriptions (in particular with RegExps) that we can all agree on. Ideas so far are: - Extra quoting characters - Having it so that TITLE or REGEXPTITLE must go last and then assume it can be read without regard to special chars - Having PROPERTY: and PROPERTY= mean different things Suggestions on the best way to fix this would be appreciated. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
SlimShady Posted August 28, 2007 Share Posted August 28, 2007 If the problem is with RegExp, you could add a specific format for that.An expression between slashes like Javascript has: /[Aa]uto[ii]t3/And using it in for instance WinExists: If WinExists(/[Aa]uto[ii]t3/) Then WinFlash("[LAST]") Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 28, 2007 Author Administrators Share Posted August 28, 2007 If the problem is with RegExp, you could add a specific format for that. An expression between slashes like Javascript has: /[Aa]uto[ii]t3/ And using it in for instance WinExists: If WinExists(/[Aa]uto[ii]t3/) Then WinFlash("[LAST]")We still need to support all the class and instance stuff at the same time though. Eg. the 3rd instance of a particular regexp. I wonder if I can do away with the doubling of chars by just scanning the line more carefully. Instead of looking for a ; to end the current property I could look for ; followed by whitespace followed by another valid property. That way the only title that I wouldn't be able to use would be something like"[TITLE:SomeTitle; INSTANCE:2]". Hmm. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 28, 2007 Author Administrators Share Posted August 28, 2007 A hypothetical title of [TITLE:title; INSTANCE:1] would give trouble At the moment we have to double up the special chars: "[TITLE:[[TITLE::title;; INSTANCE::1]]; INSTANCE:1]" JP had a suggestion of having to use quotes: "[TITLE:'[TITLE:title; INSTANCE:1]'; INSTANCE:1]" or '[TITLE:"[TITLE:title; INSTANCE:1]"; INSTANCE:1]' But then you still have the nightmare of having to escape or double ' or " Maybe a perl/java type use of / (are these used often in Regexp?) "[TITLE:/[TITLE:title; INSTANCE:1]/; INSTANCE:1]" I guess if literal / is required it needs to be doubled. Nightmare. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
evilertoaster Posted August 29, 2007 Share Posted August 29, 2007 I don't know how flexable you want to be with your redesign, but maybe reworking the way advance modes in general... Somthing like- Remove mode 4. Make autoit macros for LAST and ACTIVE or use "" and/or -1. Some way to allow StringRegExp() directly into Win() functions (or maybe a specialized version of RegExp designed only for use in Win functions) I just dont see an easy way to implament all the functionality there now AND RegExp but still use the same way of setting the mode. (at least short of putting in special work arounds like are proposed now) nightmare agreed... Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 30, 2007 Author Administrators Share Posted August 30, 2007 I did remove mode 4... Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
SlimShady Posted August 31, 2007 Share Posted August 31, 2007 (edited) The instance seems less important. We can put that one last, behind the other properties. What I was thinking; Don't put too many characters in the properties. Like the colon, semi-colon and the mandatory last bracket inline. Suggestions: - An array to have the options (eg. instance, future options?) seperate from the CLASS/TITLE/REGEXP Which also gives you the ability to store, reuse the array and update the option/instance. - Property name at the beginning eg. [CLASS] ARandomClassname Examples: ['[TITLE] Thunderbird', 3] ['[CLASS] MozillaUIWindowClass', 1] ['[REGEXP] [Tt]hunder[Bb]ird', 2] ;// OR [/[Tt]hunder[Bb]ird/, 2] ;// Combination ['[TITLE] Thunderbird', '[CLASS] MozillaUIWindowClass', 1] If WinExists(['[TITLE] Thunderbird']) Then WinActivate('[LAST]') And for compatibility allow string input. It's faster too. Edited August 31, 2007 by SlimShady Link to comment Share on other sites More sharing options...
jpm Posted September 6, 2007 Share Posted September 6, 2007 In fact Jon didn't mention another thing to avoid string protection inside string protection I suggest also to us = instead of : for the last property hopping we don't need to have 2 properties with []:; inside. so the "Advanced Window descriptions" can be: [property1:value1; property2:value2; ... ; lastproperty=anystring] valuei is anything between the : and ; including blank but no ; nor ]. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 6, 2007 Moderators Share Posted September 6, 2007 $sString = "[:property1::value1:;:property2::value2:;:lastproperty::anyvalue:]" $aProps = StringRegExp($sString, "(?m:\[:|;:)(.*?):", 3) $aVals = StringRegExp($sString, "::(.*?):", 3)I would think the above to solve most of the issues I see ya'll discussing here, as well as try to avoid some of the more common patterns as slimshady was pointing out with his example. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
evilertoaster Posted September 6, 2007 Share Posted September 6, 2007 I did remove mode 4...hum, I was looking at the documentation for 3.2.6 and it still has modes -1 to -4 and 1 to 4 as options. Maybe i'm confused? Link to comment Share on other sites More sharing options...
Administrators Jon Posted September 7, 2007 Author Administrators Share Posted September 7, 2007 Oh, I took them out of the docs, JP must have put them back in The code was still there for backwards compat. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now