Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/19/2018 in all areas

  1. @oemript dog ate your help file? Take a look at String Management in the help file and you'll see several ways, including StringInStr (you almost typed it verbatim in your post) and StringSplit, as well as more complex Regex entries.
    2 points
  2. A single function to convert UTC to/from local time, and/or change the time string representation format. the function accepts a time string (in various formats), a conversion flag, existing input format, and desired output format. all parameters are optional. Note #1: It is understood that core functionality of this UDF can be achieved by the built-in _Date_Time_* functions of the Date UDF - but these are too complex to be used, unless you are a programmer experienced with DLL structs and pointers. Note #2: UTC conversion will return incorrect results for dates for which your system has no DST configured. for example, dates earlier than 1970, or dates in the not-too-near future, or years where your country changed it's DST settings for political reasons and it was not updated in retrospect by Microsoft. UDF (v2.2): #include-Once #include 'TimeConvertConstants.au3' ; #INDEX# ======================================================================================================================= ; Title .........: TimeConvert ; AutoIt Version : 3.3.10.2 ; UDF Version ...: 2.2 ; Status ........: Production ; Language ......: English ; Description ...: A single function to convert UTC to/from local time, and/or change the time string representation format. ; It is understood that core functionality of this UDF can be achieved by the built-in _Date_Time_* functions of ; the Date UDF - but these are too complex to be used, unless you are a programmer experienced with DLL structs ; and pointers. ; Dll ...........: kernel32.dll ; Author(s) .....: orbs ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_TimeConvert ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _TimeConvert ; Description ...: Converts UTC to/from local time, and/or changes the time string representation format. ; Syntax.........: _TimeConvert([$sTime = ''[, $iUTC_Convert = $__TIMECONVERT_CONVERT_NONE[, $sFormatInput = $__TIMECONVERT_FORMAT_SYSTEM[, $sFormatOutput = $__TIMECONVERT_FORMAT_SYSTEM]]]]) ; Parameters ....: $sTime - [optional] A string representation of the time to process. ; $iUTC_Convert - [optional] Instructs the function to convert $sTime as follows: ; $__TIMECONVERT_CONVERT_NONE (0) - (default) Do not convert ; $__TIMECONVERT_CONVERT_UTC_TO_LOCAL (1) - Convert from UTC to local time ; $__TIMECONVERT_CONVERT_LOCAL_TO_UTC (-1) - Convert from local time to UTC ; $sFormatInput - [optional] Specifies the format of $sTime as follows: ; $__TIMECONVERT_FORMAT_SYSTEM ("YYYYMMDDHHNNSS") - (default) 14-digits time stamp. ; $__TIMECONVERT_FORMAT_LOGICAL ("YYYY/MM/DD HH:NN:SS") ; $__TIMECONVERT_FORMAT_UK ("DD/MM/YYYY HH:NN:SS") ; $__TIMECONVERT_FORMAT_US ("MM/DD/YYYY HH:NN:SS") ; $__TIMECONVERT_FORMAT_LOGICAL_WIDE ("YYYY/MM/DD HH:NN:SS") ; $__TIMECONVERT_FORMAT_UK_WIDE ("DD/MM/YYYY HH:NN:SS") ; $__TIMECONVERT_FORMAT_US_WIDE ("MM/DD/YYYY HH:NN:SS") ; $__TIMECONVERT_FORMAT_US_LITERAL_LONG ("MMMM DTH, YYYY, H:NN PM") ; $__TIMECONVERT_FORMAT_US_LITERAL_SHORT ("MMM-DD YYYY, H:NN PM") ; $sFormatOutput - [optional] Specifies the desired format of the return value. Use same values as $sFormatInput ; Return values .: Success - Returns the conversion result. ; Failure - Returns the partly-processed input and sets @error to 1. ; Author ........: orbs ; Modified ......: ; Remarks .......: - Constants are defined in the file "TimeConvertConstants.au3". ; - The predefined formats for $sFormatInput and $sFormatOutput are common but not exhaustive, and you can ; define your own custom formats as you see fit. ; - Note that WIDE values for $sFormatInput and $sFormatOutput have two spaces between date and time substrings. ; You can find the wide format commonly used by Excel. ; - All parameters are optional; if all are omitted, the return value is the current local time as a 14-digits ; time stamp ("YYYYMMDDHHNNSS"). ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _TimeConvert($sTime = '', $iUTC_Convert = $__TIMECONVERT_CONVERT_NONE, $sFormatInput = $__TIMECONVERT_FORMAT_SYSTEM, $sFormatOutput = $__TIMECONVERT_FORMAT_SYSTEM) ; >>> bug workaround = for some reason, default values do not apply when script passes "Default" as parameter If $sTime = '' Then $sTime = @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC If $iUTC_Convert = Default Then $iUTC_Convert = $__TIMECONVERT_CONVERT_NONE If $sFormatInput = Default Then $sFormatInput = $__TIMECONVERT_FORMAT_SYSTEM If $sFormatOutput = Default Then $sFormatOutput = $__TIMECONVERT_FORMAT_SYSTEM ; >>> end of bug workaround ; sanitize input for default format If $sFormatInput = $__TIMECONVERT_FORMAT_SYSTEM And (StringLen($sTime) <> 14 Or Not StringIsDigit($sTime)) Then Return SetError(1, 0, $sTime) Local Const $tagSYSTEMTIME = 'struct;word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds;endstruct' Local $sYYYY, $sYY, $sMMMM, $sMMM, $sMM, $sDTH, $sDD, $sD, $sHH, $sH, $sPM, $sNN, $sSS Local $aMonths[12] = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] Local $iMonth Local $iMonthNameMaxLength = 9 ; length of "September" Local $tSystemTime_BeforeConversion, $tSystemTime_AfterConversion If $sFormatInput <> $__TIMECONVERT_FORMAT_SYSTEM Then $sYYYY = StringMid($sTime, StringInStr($sFormatInput, 'YYYY', 1), 4) If $sYYYY = '' Then $sYYYY = @YEAR $sYY = StringRight($sYYYY, 2) $sMMMM = StringMid($sTime, StringInStr($sFormatInput, 'MMMM', 1), $iMonthNameMaxLength) If $sMMMM = '' Then ; no long month, maybe there is abbr month $sMMM = StringMid($sTime, StringInStr($sFormatInput, 'MMM', 1), 3) If $sMMM = '' Then ; no abbr month, maybe there is numeric month $sMM = StringMid($sTime, StringInStr($sFormatInput, 'MM', 1), 2) Else ; there is abbr month, process it For $iMonth = 0 To UBound($aMonths) - 1 If StringLeft($aMonths[$iMonth], 3) = $sMMM Then $sMM = StringFormat('%02i', $iMonth + 1) Next EndIf Else ; there is long month, process it For $iMonth = 0 To UBound($aMonths) - 1 If $aMonths[$iMonth] = StringLeft($sMMMM, StringLen($aMonths[$iMonth])) Then $sMM = StringFormat('%02i', $iMonth) Next EndIf If $sMM = '' Then $sMM = @MON $sDD = StringMid($sTime, StringInStr($sFormatInput, 'DD', 1), 2) If $sDD = '' Then ; no DD, maybe there is DTH $sDTH = StringMid($sTime, StringInStr($sFormatInput, 'DTH', 1), 4) If $sDTH = '' Then ; no DTH, maybe there is D $sD = StringMid($sTime, StringInStr($sFormatInput, 'D', 1), 2) If StringIsDigit($sD) Then ; 2-digits day $sDD = $sD ElseIf StringIsDigit(StringLeft($sD, 1)) Then ; 1-digit day $sDD = '0' & StringLeft($sD, 1) EndIf Else ; DTH If StringIsDigit(StringMid($sDTH, 2, 1)) Then ; 2-digits day $sDD = StringLeft($sDTH, 2) Else ; 1-digit day $sDD = '0' & StringLeft($sDTH, 1) EndIf EndIf EndIf If Number($sDD) = 0 Then $sDD = @MDAY $sHH = StringMid($sTime, StringInStr($sFormatInput, 'HH', 1), 2) If $sHH = '' Then ; no HH, maybe there is H $sH = StringMid($sTime, StringInStr($sFormatInput, 'H', 1), 2) If StringIsDigit($sH) Then ; 2-digits hour $sHH = $sH ElseIf StringIsDigit(StringLeft($sH, 1)) Then ; 1-digit hour $sHH = '0' & StringLeft($sH, 1) Else $sHH = @HOUR EndIf EndIf If StringInStr($sFormatInput, 'PM', 1) And StringInStr($sTime, 'pm', 1) Then $sHH = StringFormat('%02i', Number($sHH) + 12) $sNN = StringMid($sTime, StringInStr($sFormatInput, 'NN', 1), 2) If $sNN = '' Then $sNN = @MIN $sSS = StringMid($sTime, StringInStr($sFormatInput, 'SS', 1), 2) If $sSS = '' Then $sSS = @SEC $sTime = $sYYYY & $sMM & $sDD & $sHH & $sNN & $sSS EndIf If Not (StringIsDigit($sTime) And StringLen($sTime) = 14) Then Return SetError(1, 0, $sTime) If $iUTC_Convert = $__TIMECONVERT_CONVERT_LOCAL_TO_UTC Or $iUTC_Convert = $__TIMECONVERT_CONVERT_UTC_TO_LOCAL Then $sYYYY = StringLeft($sTime, 4) $sMM = StringMid($sTime, 5, 2) $sDD = StringMid($sTime, 7, 2) $sHH = StringMid($sTime, 9, 2) $sNN = StringMid($sTime, 11, 2) $sSS = StringMid($sTime, 13, 2) $tSystemTime_BeforeConversion = DllStructCreate($tagSYSTEMTIME) DllStructSetData($tSystemTime_BeforeConversion, 'Month', $sMM) DllStructSetData($tSystemTime_BeforeConversion, 'Day', $sDD) DllStructSetData($tSystemTime_BeforeConversion, 'Year', $sYYYY) DllStructSetData($tSystemTime_BeforeConversion, 'Hour', $sHH) DllStructSetData($tSystemTime_BeforeConversion, 'Minute', $sNN) DllStructSetData($tSystemTime_BeforeConversion, 'Second', $sSS) $tSystemTime_AfterConversion = DllStructCreate($tagSYSTEMTIME) If $iUTC_Convert = $__TIMECONVERT_CONVERT_LOCAL_TO_UTC Then DllCall('kernel32.dll', 'bool', 'TzSpecificLocalTimeToSystemTime', 'ptr', 0, 'ptr', DllStructGetPtr($tSystemTime_BeforeConversion), 'struct*', $tSystemTime_AfterConversion) Else DllCall('kernel32.dll', 'bool', 'SystemTimeToTzSpecificLocalTime', 'ptr', 0, 'ptr', DllStructGetPtr($tSystemTime_BeforeConversion), 'struct*', $tSystemTime_AfterConversion) EndIf $sTime = StringFormat('%04d%02d%02d%02d%02d%02d', _ DllStructGetData($tSystemTime_AfterConversion, 'Year'), _ DllStructGetData($tSystemTime_AfterConversion, 'Month'), _ DllStructGetData($tSystemTime_AfterConversion, 'Day'), _ DllStructGetData($tSystemTime_AfterConversion, 'Hour'), _ DllStructGetData($tSystemTime_AfterConversion, 'Minute'), _ DllStructGetData($tSystemTime_AfterConversion, 'Second')) EndIf If $sFormatOutput <> $__TIMECONVERT_FORMAT_SYSTEM Then $sYYYY = StringLeft($sTime, 4) $sYY = StringRight($sYYYY, 2) $sMM = StringMid($sTime, 5, 2) $sMMMM = $aMonths[Number($sMM) - 1] $sMMM = StringLeft($sMMMM, 3) $sDD = StringMid($sTime, 7, 2) $sD = String(Number($sDD)) Switch $sD Case '1' $sDTH = $sD & 'st' Case '2' $sDTH = $sD & 'nd' Case Else $sDTH = $sD & 'th' EndSwitch $sHH = StringMid($sTime, 9, 2) $sPM = 'am' If StringInStr($sFormatOutput, 'PM', 1) And Number($sHH) > 12 Then $sHH = StringFormat('%02i', Number($sHH) - 12) $sPM = 'pm' EndIf $sH = String(Number($sHH)) $sNN = StringMid($sTime, 11, 2) $sSS = StringMid($sTime, 13, 2) $sTime = $sFormatOutput $sTime = StringReplace($sTime, 'YYYY', $sYYYY, 0, 1) $sTime = StringReplace($sTime, 'YY', $sYY, 0, 1) $sTime = StringReplace($sTime, 'DTH', $sDTH, 0, 1) $sTime = StringReplace($sTime, 'DD', $sDD, 0, 1) $sTime = StringReplace($sTime, 'D', $sD, 0, 1) $sTime = StringReplace($sTime, 'HH', $sHH, 0, 1) $sTime = StringReplace($sTime, 'H', $sH, 0, 1) $sTime = StringReplace($sTime, 'PM', $sPM, 0, 1) $sTime = StringReplace($sTime, 'NN', $sNN, 0, 1) $sTime = StringReplace($sTime, 'SS', $sSS, 0, 1) $sTime = StringReplace($sTime, 'MMMM', $sMMMM, 0, 1) $sTime = StringReplace($sTime, 'MMM', $sMMM, 0, 1) $sTime = StringReplace($sTime, 'MM', $sMM, 0, 1) EndIf Return $sTime EndFunc ;==>_TimeConvert constants: #include-once ; #INDEX# ======================================================================================================================= ; Title .........: TimeConvert_Constants ; AutoIt Version : 3.3.10.2 ; Description ...: Constants for the TimeConvert UDF (v2.x) ; Author(s) .....: orbs ; =============================================================================================================================== ; #CONSTANTS# =================================================================================================================== ; UTC/local convertion instructions Global Const $__TIMECONVERT_CONVERT_NONE = 0 Global Const $__TIMECONVERT_CONVERT_UTC_TO_LOCAL = 1 Global Const $__TIMECONVERT_CONVERT_LOCAL_TO_UTC = -1 ; common string formats for time representation Global Const $__TIMECONVERT_FORMAT_SYSTEM = 'YYYYMMDDHHNNSS' Global Const $__TIMECONVERT_FORMAT_LOGICAL = 'YYYY/MM/DD HH:NN:SS' Global Const $__TIMECONVERT_FORMAT_UK = 'DD/MM/YYYY HH:NN:SS' Global Const $__TIMECONVERT_FORMAT_US = 'MM/DD/YYYY HH:NN:SS' Global Const $__TIMECONVERT_FORMAT_LOGICAL_WIDE = 'YYYY/MM/DD HH:NN:SS' Global Const $__TIMECONVERT_FORMAT_UK_WIDE = 'DD/MM/YYYY HH:NN:SS' Global Const $__TIMECONVERT_FORMAT_US_WIDE = 'MM/DD/YYYY HH:NN:SS' Global Const $__TIMECONVERT_FORMAT_US_LITERAL_LONG = 'MMMM DTH, YYYY, H:NN PM' Global Const $__TIMECONVERT_FORMAT_US_LITERAL_SHORT = 'MMM-DD YYYY, H:NN PM' ; =============================================================================================================================== example script: #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include 'TimeConvert.au3' Global $sTimeStamp_Local = _TimeConvert() Global $sTimeStamp_Random = Random(1970, 2038, 1) & StringFormat('%02i', Random(1, 12, 1)) & StringFormat('%02i', Random(1, 28, 1)) & StringFormat('%02i', Random(0, 23, 1)) & StringFormat('%02i', Random(0, 59, 1)) & StringFormat('%02i', Random(0, 59, 1)) MsgBox(0, 'TimeConvert UDF demo', _ 'Local Time :' & @TAB & $sTimeStamp_Local & @CRLF & _ 'UTC Description :' & @TAB & _TimeConvert($sTimeStamp_Local, $__TIMECONVERT_CONVERT_LOCAL_TO_UTC, Default, $__TIMECONVERT_FORMAT_US_LITERAL_LONG) & @CRLF & _ @CRLF & _ 'Random Time :' & @TAB & $sTimeStamp_Random & @CRLF & _ 'UTC, UK-style :' & @TAB & _TimeConvert($sTimeStamp_Random, $__TIMECONVERT_CONVERT_LOCAL_TO_UTC, Default, $__TIMECONVERT_FORMAT_UK))
    1 point
  3. Danp2

    WinAppDriver and Appium

    Strange that the Readme references the JSON Wire Protocol, which has been replaced by W3C specifications.
    1 point
  4. Earthshine

    WindowInfo - control ID

    IUI Automation by junkew. FAQ 31
    1 point
  5. Bowmore

    WindowInfo - control ID

    On that control the developers have helpfully provided a name for the button, I would recommend that you use that. It should work reliably ControlClick('Innovaya Studio', '', "[NAME:butOpenInv]")
    1 point
  6. UH there is an example in the helpfile? https://www.autoitscript.com/autoit3/docs/functions/WinSetOnTop.htm ;Example #include <AutoItConstants.au3> Example() Func Example() ; Retrieve the handle of the active window. Local $hWnd = WinGetHandle("[ACTIVE]") ; Set the active window as being ontop using the handle returned by WinGetHandle. WinSetOnTop($hWnd, "", $WINDOWS_ONTOP) ; Wait for 2 seconds to display the change. Sleep(2000) ; Remove the "topmost" state from the active window. WinSetOnTop($hWnd, "", $WINDOWS_NOONTOP) EndFunc ;==>Example #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 353, 209, 192, 114) Global $ONTOPON = GUICtrlCreateButton("ON TOP ON", 32, 40, 137, 65) Global $exit = GUICtrlCreateButton("EXIT", 105, 118, 137, 65) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $ONTOPOFF = GUICtrlCreateButton("ON TOP OFF", 184, 41, 137, 65) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ONTOPON Example($Form1, True) Case $ONTOPOFF Example($Form1, False) Case $exit Exit EndSwitch WEnd Func Example($hWnd, $bTrue) If Not IsHwnd($hWnd) Then Msgbox(0,"Error" "Invalid hWnd") If $bTrue Then ; Set the active window as being ontop using the handle YOU supply. WinSetOnTop($hWnd, "", $WINDOWS_ONTOP) Else ; Remove the "topmost" state from the handle YOU supply. WinSetOnTop($hWnd, "", $WINDOWS_NOONTOP) EndIF EndFunc ;==>Example #include <AutoItConstants.au3> If Not IsHwnd($hWnd) Then Msgbox(0,"Error", "Invalid hWnd")
    1 point
  7. Bilgus

    WindowInfo - control ID

    Its Probably the app you are trying to automate is there something else unique about the button like a specific class name to it? Local $hWnd = WinWait("[Title:Calculator; CLASS:CalcFrame; INSTANCE:1]") ConsoleWrite("Calc hWnd =" & $hWnd & @CRLF) Local $iRes = ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:" & GetCtrlInstanceFromText($hWnd, "CE") & "]", "left", 1) ; CE Button If $iRes Then $iRes = ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:" & GetCtrlInstanceFromText($hWnd, "7") & "]", "left", 7) ;7 Button If $iRes Then $iRes = ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:" & GetCtrlInstanceFromText($hWnd, "+") & "]", "left", 1) ; + Button If $iRes Then $iRes = ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:" & GetCtrlInstanceFromText($hWnd, "3") & "]", "left", 1) ; 3 Button If $iRes Then $iRes = ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:" & GetCtrlInstanceFromText($hWnd, "=") & "]", "left", 1) ; = Button ConsoleWrite("Success = " & $iRes & @CRLF) ;Didn't Work :( Local $iRes = ControlClick($hWnd, "", "[CLASS:Button; ID:" & "82" & "]", "left", 1) ; CE Button If $iRes Then $iRes = ControlClick($hWnd, "", "[CLASS:Button; ID:" & "135" & "]", "left", 7) ;5 Button If $iRes Then $iRes = ControlClick($hWnd, "", "[CLASS:Button; ID:" & "93" & "]", "left", 1) ; + Button If $iRes Then $iRes = ControlClick($hWnd, "", "[CLASS:Button; ID:" & "131" & "]", "left", 1) ; 1 Button If $iRes Then $iRes = ControlClick($hWnd, "", "[CLASS:Button; ID:" & "121" & "]", "left", 1) ; = Button ConsoleWrite("Success = " & $iRes & @CRLF) Func GetCtrlInstanceFromText($hWnd, $sCtrlText) Local $iInstance = -1 Local $iErr = 0 Local $sText For $i = 0 To 100 $sText = ControlGetText($hWnd, "", "[CLASS:Button; INSTANCE:" & $i & "]") If @error Then ConsoleWrite("Skipped: " & $i & @CRLF) ContinueLoop ElseIf StringInStr($sText, $sCtrlText) Then ConsoleWrite("Found: " & $sText & @CRLF) $iInstance = $i ExitLoop Else ConsoleWrite($sText & " Instance: " & $i & @CRLF) EndIf Next Return $iInstance EndFunc Now note that the first try should be called like this for each ControlClick($hWnd, "", "[CLASS:Button; TEXT:CE]") Not ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:" & GetCtrlInstanceFromText($hWnd, "CE") & "]" I just expanded a different example and wanted you to see the inner workings https://www.autoitscript.com/autoit3/docs/intro/controls.htm Barring the other options You could try going through all instances till you get one at a particular coordinate And Finally you could resort through looking for the button with a pixel search
    1 point
  8. Earthshine

    WindowInfo - control ID

    i like to use their class or classname and the text they have associated with them.
    1 point
  9. mikell

    WindowInfo - control ID

    Maybe not. It depends on the app The info tool provides more informations about controls so you can use them in Control* funcs (see here )
    1 point
  10. You want to be able to do this to OTHER people's computers? Are you giving them the option to not let you do this when they run your program? I know I'd be PISSED if your program did this to my computer without telling me.
    1 point
  11. Melba23

    How to find Yesterday?

    UnknownUser, Welcome to the AutoIt forums. But do you realise that the post above yours is from 14 years ago? Please do not necro-post like this again. And _DateAdd is now in the standard Date.au3 include file - which is why necro-posting is a bad idea as the language advances and past-requested functionalities might well be included in core or UDF code by now. M23
    1 point
  12. i give up, it is clear you won't show any details .... maybe others like to stab in the dark. Jos
    1 point
  13. You're getting mixed up between characters and digits. A digit is 0-9 when its forming a number. A and / aren't digits. Try this. #include <Array.au3> Local $s_FileRead = FileRead(@ScriptDir & '\test.txt') Local $as_Matches = StringRegExp($s_FileRead, '(?m)(A70\d+/\d+/\d{1,6})', $STR_REGEXPARRAYGLOBALMATCH) _ArrayDisplay($as_Matches) test.txt
    1 point
  14. Bilgus, The term "current" to describe the GUI in which controls will be created (usually the last created unless changed via GUISwitch) is used throughout the Help file, but I agree it could be clearer. And I concur that the "current" GUI is not reset when you use GUIGetCursorInfo: #include <GUIConstantsEx.au3> $hGUI_L = GUICreate("Test_L", 200, 200, 100, 100) GUISetState() $hGUI_R = GUICreate("Test_R", 200, 200, 400, 100) GUISetState() ; Last created is "current" GUI, so controls are created within it $cLabel_1 = GUICtrlCreateLabel("In Test_R", 10, 10, 150, 30) ; Move mouse to GUI_L MouseMove(200, 200) ; Get info with no handle $aInfo = GUIGetCursorInfo() ; And with no handle we get info for "current" GUI - GUI_R ConsoleWrite($aInfo[0] & @CRLF) ; Get info with handle $aInfo = GUIGetCursorInfo($hGUI_L) ; And we get from GUI_L ConsoleWrite($aInfo[0] & @CRLF) ; But which is the current GUI now? GUICtrlCreateLabel("Is this in Test_L?", 10, 40, 150, 30) ; Set it to GUI_L GUISwitch($hGUI_L) GUICtrlCreateLabel("In Test_L now!", 10, 40, 150, 30) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd I will amend the Help file accordingly - thanks for the report. In future, could you please raise such matters using Trac - it makes it much easier to follow and all the Devs get to see it. M23
    1 point
  15. _CtrlSequence("{END}", "{TAB}", 5) Func _CtrlSequence($arg1, $arg2, $count) Send("{CTRLDOWN}") For $i = 1 To $count Send($arg1) Send($arg2) Next Send("{CTRLUP}") EndFunc
    1 point
  16. it's obvious that it's your machine by now. I've given you plenty of things you can do to check the health of your environment. hopefully you will find the culprit. Some update, or AV or something is messing with your environment, and, you may be powerless to change that, but I think, if it still works good on another computer or VM, then you should be OK as you can reimage your machine and get your dev software reinstalled. Sorry, I get that nothing changed stuff so often--sorry to take that out on you. Promise I will try to let that go. Most times, I get it, someone does something and they don't want anyone to know, like they are going to get in trouble, so they come and tell me nothing changed and all too often things don't go too well, lots of wasted time, etc.. There are also free applications you can run while testing your system to see where all the resources are getting chewed up. The Performance Monitor can tell you what's going on in CPU, DISK, MEM, etc.. See where stuff is hanging up.
    1 point
  17. ISI360

    ISN AutoIt Studio

    Yeah the ISN would definitely benefit from tutorial videos, but as a "one man show" i don´t have the time to make such videos. (And you really don´t want to hear me speaking english ) But if anyone is interessted to make such videos, i will support them as good as i can. And about extracode: Yeah it´s different here in the ISN than Visual Studio. Extracode means only "add you own au3 code to (below) the control). You can see it in the "generate au3 code" window in the form studio how it´s managed. And as a Tipp: You do not need to copy past the gui code from the formstudio to your script. Simply include the .isf file as an include! (see testproject)
    1 point
  18. UEZ

    click on link label

    Here another fast hack: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 300, 200) $label = GUICtrlCreateLabel("www.autoitscript.com", 50, 80, 200, 30) GUICtrlSetFont(-1, 16, 100, 4) GUICtrlSetColor(-1, 0x000000) GUISetState() $set_1 = False $set_2 = False While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $label ShellExecute("http://www.autoitscript.com") ;open web site when clicking label EndSwitch ;change color of label when mouse hovers it $array = GUIGetCursorInfo($hGUI) If $array[4] = $label Then If Not $set_1 Then ;avoid flickering GUICtrlSetColor(-1, 0x0000FF); RRGGBB $set_1 = True $set_2 = False EndIf Else If Not $set_2 Then ;avoid flickering GUICtrlSetColor(-1, 0x000000) $set_1 = False $set_2 = True EndIf EndIf WEnd GUIDelete() Br, UEZ
    1 point
  19. first of all, many tnx to Bytencoder from Softpedia forum, he revealed his secret of intercepting Winfast PVR remote control keys. If you give any credit to this script it all goes to his nickname ;] The following script was made to intercept remote control keys from your WinFast PVR application. If you have Leadtek TV card, or WinFast PVR application, and remote control, you might find this useful, you could turn your TV card remote control into ultimate, distant PC control device. Please read the first few lines of the script, and choose first global variable, if you have WinFast PVR1, then use: Global $class = "Alec@Video(^0^)" if you have WinFast PVR2 or higher, then use: Global $class = "Alec@DVBT(>_<)" Also, this script was made tnx to register class function: http://www.autoitscript.com/forum/index.php?showtopic=79575 #Include <WinAPI.au3> #Include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> ;choose the class which depends on your PVR you're using. PVR1 = "Alec@Video(^0^)", PVR2 and higher = "Alec@DVBT(^_^)" ;~ Global $class = "Alec@Video(^0^)" ;for pvr1 Global $class = "Alec@DVBT(^_^)" ;for pvr2 and up Global $enabled = true Global Const $CS_VREDRAW = 0x0001; Global Const $CS_HREDRAW = 0x0002; Global Const $CS_DBLCLKS = 0x0008; Global Const $CS_OWNDC = 0x0020; Global Const $CS_CLASSDC = 0x0040; Global Const $CS_PARENTDC = 0x0080; Global Const $CS_NOCLOSE = 0x0200; Global Const $CS_SAVEBITS = 0x0800; Global Const $CS_BYTEALIGNCLIENT = 0x1000; Global Const $CS_BYTEALIGNWINDOW = 0x2000; Global Const $CS_GLOBALCLASS = 0x4000; Global Const $CS_DROPSHADOW = 0x00020000; Global Const $CS_DEFAULTSTYLE = BitOR($CS_VREDRAW, $CS_HREDRAW) Global Const $CW_USEDEFAULT = 0x80000000 ;#CS Global Const $CURSOR_ARROW =32512 Global Const $CURSOR_IBEAM =32513 Global Const $CURSOR_WAIT =32514 Global Const $CURSOR_CROSS =32515 Global Const $CURSOR_UPARROW =32516 Global Const $CURSOR_SIZENWSE =32642 Global Const $CURSOR_SIZENESW =32643 Global Const $CURSOR_SIZEWE =32644 Global Const $CURSOR_SIZENS =32645 Global Const $CURSOR_SIZEALL =32646 Global Const $CURSOR_NO =32648 Global Const $CURSOR_APPSTARTING =32650 Global Const $CURSOR_HELP =32651 ;#CE _WinAPI_RegisterClassEx($class, "WindowCallback", 0, 0, -1, $CS_DEFAULTSTYLE) ;registering window class which is designed to recieve PVR's remote ctrl commands, and setting up a func. for hooking msges from that class (this last require a window, that's why we have next line) $hWnd = _WinAPI_CreateWindowEx(0, $class, "REMOTE CONTROL", $WS_OVERLAPPEDWINDOW, @DesktopWidth+500, @DesktopHeight+500, 0, 0, 0) ;creating a window with registered class (required, but doesn't need to be shown) $gui = GUICreate("test", 400, 300) ;creating main GUI $button1 = GUICtrlCreateButton("Disable", 10, 10, 100) ;button for disabling/enabling keys intercepting (actually, registering and unregistering required window's class $display_label = GUICtrlCreateLabel("", 10, 50, 380, 20, 0x01) ;label for displaying keys you stroke on your remote ctrl. GUICtrlSetFont(-1, 12, 800, -1, "Arial") GUISetState(@SW_SHOW) While 1 Local $nMsg = GUIGetMsg($gui) Switch $nMsg case $button1 if $enabled = true Then GUICtrlSetData($button1, "Enable") $enabled = false _WinAPI_UnregisterClass($class) ;unregistering class and... _WinAPI_DestroyWindow($hWnd) ;...killing window with registered class $hWnd = 0 Else GUICtrlSetData($button1, "Disable") $enabled = true _WinAPI_RegisterClassEx($class, "WindowCallback", 0, 0, -1, $CS_DEFAULTSTYLE) ;just like @ the top of the script $hWnd = _WinAPI_CreateWindowEx(0, $class, "REMOTE CONTROL", $WS_OVERLAPPEDWINDOW, @DesktopWidth+500, @DesktopHeight+500, 0, 0, 0) EndIf Case $GUI_EVENT_CLOSE _WinAPI_UnregisterClass($class) Exit EndSwitch Sleep(10) WEnd Func _WinGetClassName($hWnd) $x = DLLCall("user32.dll","int","GetClassName","hWnd",$hWnd,"str","","int",64) ;getting classname of a window If Not @error And $x[0] <> 0 Then Return $x[2] Return "" EndFunc Func WindowCallback($hWnd, $iMsg, $wParam, $lParam) ;callback func. for recieving msges Switch $iMsg Case $WM_CLOSE _WinAPI_UnregisterClass($class) Exit EndSwitch Switch $wParam ;set your functions here: (this is the part that recognize your remote ctrl keys) case 0 if $iMsg = 2560 Then GUICtrlSetData($display_label, "Power") EndIf case 1 ;dunno case 2 ;dunno case 3 GUICtrlSetData($display_label, "Full screen") case 4 GUICtrlSetData($display_label, "Vol +") case 5 GUICtrlSetData($display_label, "Ch. 1") case 6 GUICtrlSetData($display_label, "Ch. 2") case 7 GUICtrlSetData($display_label, "Ch. 3") case 8 GUICtrlSetData($display_label, "Vol -") case 9 GUICtrlSetData($display_label, "Ch. 4") case 10 GUICtrlSetData($display_label, "Ch. 5") Case 11 GUICtrlSetData($display_label, "Ch. 6") case 12 GUICtrlSetData($display_label, "Ch. UP") case 13 GUICtrlSetData($display_label, "Ch. 7") case 14 GUICtrlSetData($display_label, "Ch. 8") Case 15 GUICtrlSetData($display_label, "Ch. 9") case 16 GUICtrlSetData($display_label, "Ch. Down") case 17 GUICtrlSetData($display_label, "Switch to previous") case 18 GUICtrlSetData($display_label, "Ch. 0") case 19 GUICtrlSetData($display_label, "Enter") case 20 GUICtrlSetData($display_label, "Mute") case 22 GUICtrlSetData($display_label, "Display") case 27 GUICtrlSetData($display_label, "Audio") case 30 GUICtrlSetData($display_label, "Video") case 31 GUICtrlSetData($display_label, "Teletext") case 64 GUICtrlSetData($display_label, "Sleep") case 65 GUICtrlSetData($display_label, ". (Dot)") case 66 GUICtrlSetData($display_label, "Previous") case 67 GUICtrlSetData($display_label, "Play/Pause") case 68 GUICtrlSetData($display_label, "Next") case 69 GUICtrlSetData($display_label, "Time Shifting") case 70 GUICtrlSetData($display_label, "Stop") case 71 GUICtrlSetData($display_label, "Rec") case 72 GUICtrlSetData($display_label, "(M) SnapShot") case 73 GUICtrlSetData($display_label, "Boss Key") case 74 GUICtrlSetData($display_label, "Pic. in Pic.") case 75 GUICtrlSetData($display_label, "Red color") case 76 GUICtrlSetData($display_label, "Green color") case 77 GUICtrlSetData($display_label, "Yellow color") case 78 GUICtrlSetData($display_label, "Blue color") case 79 GUICtrlSetData($display_label, "Menu") case 80 GUICtrlSetData($display_label, "Cancel") case 81 GUICtrlSetData($display_label, "Chan. Surf") case 82 GUICtrlSetData($display_label, "[...]") case 83 GUICtrlSetData($display_label, "EPG") case 84 GUICtrlSetData($display_label, "Backward") case 85 GUICtrlSetData($display_label, "Forward") case 1011 ;DVD or sometimes FM, so disable and not use is the best solution case Else GUICtrlSetData($display_label, "key for case: " & @CRLF & $wParam & @CRLF & "is not defined...") EndSwitch Return _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) EndFunc ;---------------------------------------------------------------------------------------- ; register class function and it's details/authors shown below ; link: http://www.autoitscript.com/forum/index.php?showtopic=79575 ;---------------------------------------------------------------------------------------- #cs _WinAPI_RegisterClassEx($sClassName, $sCallbackFunction, $hIcon=0, $hCursor=0, $iBkColor=$COLOR_BTNFACE, $iStyle=$CS_DEFAULTSTYLE) $sClassName - Classname $sCallbackFunction - WindowProc callback function $hIcon - Handle to a icon which will be be used as the window icon (Default = application icon) $hCursor - Handle to cursor which will be used as the window cursor (Default = arraow cursor) Use _WinAPI_LoadCursor() [also included with this UDF] to load a system cursor: $CURSOR_ARROW $CURSOR_IBEAM $CURSOR_WAIT $CURSOR_CROSS $CURSOR_UPARROW $CURSOR_SIZENWSE $CURSOR_SIZENESW $CURSOR_SIZEWE $CURSOR_SIZENS $CURSOR_SIZEALL $CURSOR_NO $CURSOR_APPSTARTING $CURSOR_HELP Example: _WinAPI_LoadCursor(0, $CURSOR_IBEAM) Do not use the $IDC_ constants declared in Constants.au3 $iBkColor - RGB color code of window background color $iStyle - Class style. A combination of these values: (Default = $CS_DEFAULTSTYLE) $CS_VREDRAW $CS_HREDRAW $CS_DBLCLKS $CS_OWNDC $CS_CLASSDC $CS_PARENTDC $CS_NOCLOSE $CS_SAVEBITS $CS_BYTEALIGNCLIENT $CS_BYTEALIGNWINDOW $CS_GLOBALCLASS $CS_DROPSHADOW Function: Creating a class which can be used with CreateWindowEx, and others Author: Original - amel27 Working version - Kip #ce Func _WinAPI_RegisterClassEx($sClassName, $sCallbackFunction="", $hIcon=0, $hCursor=0, $iBkColor=$COLOR_BTNFACE, $iStyle=$CS_DEFAULTSTYLE) If not $hIcon Then Local $aIcon = DllCall("user32.dll", "hwnd", "LoadIcon", "hwnd", 0, "int", $IDI_APPLICATION) $hIcon = $aIcon[0] EndIf If not $hCursor Then $hCursor = _WinAPI_LoadCursor(0,$CURSOR_ARROW) EndIf local $hWndProc = DLLCallbackRegister ($sCallbackFunction, "int", "hwnd;int;wparam;lparam") Local $pCallback = DllCallbackGetPtr($hWndProc) Local $tWndClassEx = DllStructCreate("uint cbSize;uint style;ptr lpfnWndProc;int cbClsExtra;int cbWndExtra;hwnd hInstance;hwnd hIcon;hwnd hCursor;hwnd hbrBackground;ptr lpszMenuName;ptr lpszClassName;hwnd hIconSm") Local $tClassName = DllStructCreate("char["& StringLen($sClassName)+1 &"]") DllStructSetData($tClassName, 1, $sClassName) DllStructSetData($tWndClassEx, "cbSize", DllStructGetSize($tWndClassEx) ) DllStructSetData($tWndClassEx, "style", $iStyle) DllStructSetData($tWndClassEx, "lpfnWndProc", $pCallback) DllStructSetData($tWndClassEx, "hInstance", _WinAPI_GetModuleHandle("")) DllStructSetData($tWndClassEx, "hIcon", $hIcon) DllStructSetData($tWndClassEx, "hCursor", $hCursor) DllStructSetData($tWndClassEx, "hbrBackground", _WinAPI_CreateSolidBrush(RGB_to_BGR($iBkColor))) DllStructSetData($tWndClassEx, "lpszClassName", DllStructGetPtr($tClassName)) DllStructSetData($tWndClassEx, "hIconSm", $hIcon) Local $aRet = DllCall("user32.dll", "dword", "RegisterClassExA", "ptr", DllStructGetPtr($tWndClassEx) ) Return $aRet[0] EndFunc Func _WinAPI_UnregisterClass($sClassName) Local $aRet = DllCall("user32.dll", "int", "UnregisterClassA", "str", $sClassName, "hwnd", _WinAPI_GetModuleHandle("")) Return $aRet[0] EndFunc Func _WinAPI_LoadCursor($hInstance, $iCursor) $GuiCursor = DllCall("user32.dll", "hwnd", "LoadCursor", "hwnd", $hInstance, "int", $iCursor) Return $GuiCursor[0] EndFunc Func RGB_to_BGR($BRG) $b = BitAND(BitShift($BRG, 16), 0xFF) $g = BitAND(BitShift($BRG, 8), 0xFF) $r = BitAND($BRG, 0xFF) Return "0x"&Hex($r,2)&Hex($g,2)&Hex($b,2) EndFunc ...would be great if some leadtek TV card owners could test ;]
    1 point
  20. Jos

    How to find Yesterday?

    Download the DateNew.au3 from my autoit stuff page and put it into the autoit3\include directory. #include <DateNew.au3> $yesterday = _DateAdd('d', -1, @YEAR & "/" & @MON & "/" & @MDAY) MsgBox(4096, 'debug:', '$yesterday:' & $yesterday);### Debug MSGBOX
    1 point
  21. @Arema, Welcome to Autoit forum... I think you've missed our forum rules on your way in...
    0 points
×
×
  • Create New...