Leaderboard
Popular Content
Showing content with the highest reputation on 02/04/2015 in all areas
-
Your welcome bone09/santiago ... so confused right now. @wes* "(.{10})(.)(..)(.+$)", "$1/$3") " All items in parenthesis are because we want to capture them, to later include or exclude. (.{10}) = grab the first 10 characters of the string (.) = grab the next character (it's a space, I could have done s or h or others, but a dot is grab whatever is there) (..) = grab the next two characters, I could have done .{2} but .. is less work (.+$) = grab the rest of the characters until the end of the string with a greedy "+" quantifier "$1" = include the first captured group (.{10}) in my return string "/" = add a forward slash after my first capture group "$3" = include the 3rd capture group (..) in my return string We exclude $2 (.) and $4 (.+$) because they are not what we want included in our string2 points
-
Because if @Hour = 00 then your @hour now = -1, and if the hour is 00 and -1, you also need to -1 MDay, and if MDay is 01 you need to -1 Month and if Month is 01 you need to minus year... fun huh? @weszzer #Include <Date.au3> ;~ 2015/02/04 15:38:43. ;~ How to format this to 2015/02/04/15 Global $gsDayAdd = _DateAdd("h", -1, _NowCalc()) ; minus one day Global $gsFormat = StringRegExpReplace($gsDayAdd, "(.{10})(.)(..)(.+$)", "$1/$3") ConsoleWrite($gsFormat & @CRLF)2 points
-
ImageSearch Usage Explanation
HansHenrik reacted to Centrally for a topic
After having lot of issues myself with getting ImageSearch to work I decided to make topic with explanation how to proper use this script. Here is link of original topic at this topic: Credits to kangkeng for creating such useful piece of code. What is ImageSearch? It's script that find part of screen which you before defined with given image. When should I use ImageSearch? You should use it whenever it's not possible or unlikely that pixelsearch will give what you need. So how can I use ImageSearch and enjoy it's awesome benefits? First of all to avoid mostly caused problems I recompiled DLLs for both architectures which you can download at end of this post. When you pick your package you should place both ImageSearch.au3 and ImageSearch.dll inside script folder. Usage Example: First of all take picture of what you want to search for (print screen + paint + corp + save as bmp). Place that picture in script directory (I named my picture checkImage (checkImage.bmp is full name with extension). You must include ImageSearch.au3 in your script. ImageSearch.au3 consist of 2 Functions you can use: _ImageSearch and _ImageSearchArea Note: Use _ImageSearch to search the entire desktop, _ImageSearchArea to specify a desktop region to search Values to put in for _ImageSearch function (entire screen search) ($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance, $HBMP=0) Values to put in for _ImageSearchArea function (you declare part of screen to be searched) ($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance,$HBMP=0) Description of parameters from ImageSearch.au3 itself: ; Description: Find the position of an image on the desktop ; Syntax: _ImageSearchArea, _ImageSearch ; Parameter(s): ; $findImage - the image to locate on the desktop ; $tolerance - 0 for no tolerance (0-255). Needed when colors of ; image differ from desktop. e.g GIF ; $resultPosition - Set where the returned x,y location of the image is. ; 1 for centre of image, 0 for top left of image ; $x $y - Return the x and y location of the image ; ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 Example of my script using _ImageSearch ( entire screen search) #include <ImageSearch.au3> HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('checkImage.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc while 1 sleep(200) WEnd Example of my script using _ImageSearchArea #include <ImageSearch.au3> HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() local $search = _ImageSearchArea('check5.bmp', 1, 800, 40, 900, 80, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc while 1 sleep(200) WEnd I would like to apologize if by writing this I offended any of member that thinks this script is too simple to even have it explained, it's just as me being new to autoIt it took me so much time getting around errors and making this script to work. Thanks for reading, if you bump on any problems using it post it here, I will try to help you fixing it and update topic for further reference. Download links: 32bit: ImageSearch 32bit.rar 64bit: ImageSearch 64 bit.rar1 point -
SCCM UDF
argumentum reacted to JLogan3o13 for a topic
I am finally back at a customer location where I could work with Microsoft System Center Configuration Manager, and wanted to update the script from >this thread. This time around, rather than a full GUI it is simply a UDF, allowing the user to employ the functions however they would like. This has been tested on 2012 and 2012 R2; unfortunately I no longer have any customers with access to 2007. Currently there are 11 public functions; will continue to update and provide examples as I get a chance. There is also an _SCCM_Constants.au3 that needs to be copied to the Includes directory. Updated 10/14/2014: Added _SCCM_DeletePC function and example Updated 04/12/2015: Added _SCCM_RefreshCollection function and example _SCCM.au3 _SCCM_Constants.au3 Examples:1 point -
A regex way : ; $string = ",,,,asdf,as32,,,3k2,as12," ; $delimeter = "," $string = "||||asdf|as32|||3k2|as12|" $delimeter = "|" $string2 = StringRegExpReplace($string, "(\Q" & $delimeter & "\E)(?=(?1)|$)","") ConsoleWrite($string2 & @CRLF)1 point
-
#RequireAdmin + Various User based Macro's
javiwhite reacted to JLogan3o13 for a topic
Many have gone the two-script route. You can also look at HKLMSOFTWAREMicrosoftWIndowsNTCurrentVersionWinLogonDefaultUserName to get the last logged in user.1 point -
Get control ID(or name) from Save Dialogue Adress
Piccolo1986 reacted to wisem2540 for a topic
I would try to grab the control ID of the filename box near the bottom. Use the title of the box, along with that ID to send the full path to it. That should work1 point -
A little simpler StringRegExpReplace($gsDayAdd, "(\S+)\h*(\d\d).*", "$1/$2") Anyway regex is not necessary in this case1 point
-
? #Include <Date.au3> Global $gsDayAdd = _DateAdd("h", -1, _NowCalc()) ; minus one day $s = StringSplit($gsDayAdd, " ") $d = $s[1] & "/" & StringLeft($s[2], 2) ConsoleWrite($d)1 point
-
Bump! Just a reminder in case someone arrives late to the party. There are just over 9 days left to go (see 1st post for details). Stardom awaits.1 point
-
I'm sorry, I don't see the relevance to your statement/reply. Edit: This would speed up your script exponentially. #include <File.au3> $path = @ScriptDir & '\xmlfo.xml' $OXML = FileOpen($path, 256) $XML = FileRead($OXML) FileClose($OXML) $term = 'post' $nofr = 1 Local $aArray = StringRegExp($XML, '(?s)<entry[^>]*>.*?</entry>', 3) If Not @error Then For $i = 0 To UBound($aArray) - 1 ;get data start ;ConsoleWrite ( $aArray[0] &' '&$i& @CRLF) $date = StringRegExp($aArray[$i], '(?i)<published>(.*?)</published>', 3) If @error Then $date = StringRegExp("date err", "(.{33,}?(?:\s)|.+)", 3) ElseIf Not @error Then ;ConsoleWrite($date[0] & ' ' & $i & @CRLF) EndIf $kind = StringRegExp($aArray[$i], '(?i)<category>(.*?)</category>', 3) If @error Then $kind = StringRegExp("kind err", "(.{33,}?(?:\s)|.+)", 3) ;ConsoleWrite ( $kind[0] &' '&$i& @CRLF) ElseIf Not @error Then ;ConsoleWrite ( $kind[0] &' '&$i& @CRLF) EndIf If $kind[0] = $term And Data(getdate($date[0], 'year'), getdate($date[0], 'month')) = True Then $XML = StringReplace($XML, $aArray[$i], '') ;_ReplaceStringInFile($path, $aArray[$i], '') If Not @error Then ;MsgBox(16,'',$XL) ConsoleWrite($nofr & ' ' & $i & @CRLF) $nofr = $nofr + 1 EndIf ;FileDelete(@ScriptDir & '\XML_output.xml') ;FileWrite (@ScriptDir & '\XML_output.xml', StringToBinary ( StringReplace($temp, $aArray[$i], "") , 4) ) Else ConsoleWrite ('err0x0'& @CRLF) EndIf Next EndIf Global $ghOpen = FileOpen($path, $FO_UTF8_NOBOM + $FO_OVERWRITE) FileWrite($ghOpen, $XML) FileClose($ghOpen) Here, as suggested before, we are only opening the file, reading the file, and writing to the file 1 time. Your way, it was opening, reading to memory, writing as many times as the loop was long. One thing is different, the FileOpen at the bottom of the script, you never told _ReplaceStringInFile how to write the data back to the file, so it was writing it regularly, I added $FO_UTF8_NOBOM strictly because that's how you opened it before in your code example. So you may want to backup your xml file before using this code (just FYI).1 point
-
i kept looking at forums and found simple solution. not 100% effective but works 90% ild say and the answer is .. for anyone else that will need in future ... while 1 ;main gui while loop.... if $on = 1 then ;you change the variable value with a button or whatever..... while $on = 1 ;your whatever thing loop here... ;do things here... ;if you would want to exit loop while processing it through with loads of things just put this.. exitloop ;if you have more than one or two loops then for example... while $set = 1 ;do something here then ... while $go = 1 ;do something here and exit if $on = 0 then exitloop 3 ;this will exit all loops and go into the first gui loop to continue showing main gui.... wend wend wend endif ;exitloop [3] will go here automatically... :P wend those who will really need such thing will understand...1 point
-
I have a work around for IE10 - create some HTML tag eg a div - and add and eval method to it.. javascript.. var x=document.getElementById(""myIE10EvalWorkAroundDIv""); x.IE10Eval= function( s ) { return eval(s) } ; full work around '?do=embed' frameborder='0' data-embedContent>> Can anyone confirm if $oIE.document.parentwindow.eval - works on IE10?1 point
-
And as an additional info $iCtrlId = _WinAPI_GetWindowLong($hWnd, $GWL_ID) is the reversal of $hWnd = GUICtrlGetHandle($iCtrlId)1 point
-
Dana, A ControlID is actually an index to an internal AutoIt array holding details of all the controls created by the native AutoIt functions - it is a simple decimal integer. Each of these controls also has a handle - a unique ID allocated by Windows to everything created - which is stored in that array and used by AutoIt to act on the control internally. Yu can access the handle by using GUICtrlGetHandle. A UDF control returns a handle directly - which looks like a multi-digit hex integer, but is in fact a special variable type. Anything created by a non-native function (i.e. most of the UDFs) will return a handle. This is why the native GUICtrl* functions will not work on UDF controls - they require a ControlID - and why you see code like this in UDFs: ; Check handle If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) If Not IsHWnd($hWnd) Thenwhere if the user passes a ControlID it is converted to the handle before the UDF function gets to work. All clear? M231 point
-
return value of msgbox
SorryButImaNewbie reacted to PsaltyDS for a topic
"10" is not a valid MsgBox(), but it is the return value for "Try Again" (see the help file). You can run it and get the response like this: $iResponse = MsgBox(6, "test", "dsadsadsadsdsdsa") If $iResponse = 10 Then MsgBox(64, "Try Again", "OK, we'll try again...") Else MsgBox(16, "Quit", "I give up.") EndIf1 point