Jump to content

zerobazar

Active Members
  • Posts

    26
  • Joined

  • Last visited

Profile Information

  • Location
    France

zerobazar's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. You may find some help with _WinGetHandleByPID() Best Regards.
  2. Very well spotted Hubertus ! (I am not an expert of AM/PM, being French...) Is this better? #include <Date.au3> Local $sStartDate = "11/7/2008" Local $sStartTime = "12:30AM" Local $sEndDate = "11/7/2008" Local $sEndTime = "12:30PM" $sStart = _DateTimeConvert($sStartDate, $sStartTime) $sEnd = _DateTimeConvert($sEndDate, $sEndTime) MsgBox(0,"_DateDiff", $sStart & @LF & $sEnd & @LF & "Diff: " & _DateDiff ("h", $sStart, $sEnd)) Func _DateTimeConvert($Date, $Time) Local $temp, $res $temp = StringRegExp($Date, "(\d\d?)/(\d\d?)/(\d{4})",1) $res = StringFormat("%4i/%02i/%02i", $temp[2], $temp[0], $temp[1]) $temp = StringRegExp($Time, "(\d\d?):(\d\d?)[ ]?(AM|PM)",1) If $temp[0] = 12 Then $temp[0] = 0 If $temp[2] = "PM" Then $temp[0] = $temp[0] + 12 $res &= StringFormat(" %02i:%02i:00", $temp[0], $temp[1]) Return $res EndFunc Cheers.
  3. If you may encounter "11:25 AM" and "11:25AM" at the same time, then a small change will do: #include <Date.au3> Local $sStartDate = "11/7/2008" Local $sStartTime = "11:30AM" Local $sEndDate = "11/7/2008" Local $sEndTime = "3:00PM" $sStart = _DateTimeConvert($sStartDate, $sStartTime) $sEnd = _DateTimeConvert($sEndDate, $sEndTime) MsgBox(0,"_DateDiff", $sStart & @LF & $sEnd & @LF & "Diff: " & _DateDiff ("h", $sStart, $sEnd)) Func _DateTimeConvert($Date, $Time) Local $temp, $res $temp = StringRegExp($Date, "(\d\d?)/(\d\d?)/(\d{4})",1) $res = StringFormat("%4i/%02i/%02i", $temp[2], $temp[0], $temp[1]) $temp = StringRegExp($Time, "(\d\d?):(\d\d?)[ ]?(AM|PM)",1) If $temp[2] = "PM" Then $temp[0] = $temp[0] + 12 $res &= StringFormat(" %02i:%02i:00", $temp[0], $temp[1]) Return $res EndFunc It now works on both cases. Enjoy! Edit: small improvement...
  4. This is beautiful Malkey! You make me discover how to use StringFormat with more than 1 variable... So we now have: #include <Date.au3> Local $sStartDate = "11/7/2008" Local $sStartTime = "11:30AM" Local $sEndDate = "11/7/2008" Local $sEndTime = "3:00PM" $sStart = _DateTimeConvert($sStartDate, $sStartTime) $sEnd = _DateTimeConvert($sEndDate, $sEndTime) MsgBox(0,"_DateDiff", $sStart & @LF & $sEnd & @LF & "Diff: " & _DateDiff ("h", $sStart, $sEnd)) Func _DateTimeConvert($Date, $Time) Local $temp, $res $temp = StringRegExpReplace($Date, "(\d\d?)/(\d\d?)/(\d{4})","\3/\1/\2") $temp = StringSplit($temp, "/") $res = StringFormat("%4i/%02i/%02i", $temp[1], $temp[2], $temp[3]) $temp = StringRegExp($Time, "(\d\d?):(\d\d?)(AM|PM)",1) If $temp[2] = "PM" Then $temp[0] = $temp[0] + 12 $res &= StringFormat(" %02i:%02i:00", $temp[0], $temp[1]) Return $res EndFunc Many thanks for the hint.
  5. Have a loot at function "execute" in the help file. Best Regards.
  6. This should work: #include <Date.au3> Local $sStartDate = "11/7/2008" Local $sStartTime = "11:30AM" Local $sEndDate = "11/7/2008" Local $sEndTime = "3:00PM" $sStart = _DateTimeConvert($sStartDate, $sStartTime) $sEnd = _DateTimeConvert($sEndDate, $sEndTime) MsgBox(0,"_DateDiff", $sStart & @LF & $sEnd & @LF & "Diff: " & _DateDiff ("h", $sStart, $sEnd)) Func _DateTimeConvert($Date, $Time) Local $temp, $res $temp = StringRegExpReplace($Date, "(\d\d?)/(\d\d?)/(\d{4})","\3/\1/\2") $temp = StringSplit($temp, "/") $res = $temp[1] & "/" & StringFormat("%02i", $temp[2]) & "/" & StringFormat("%02i", $temp[3]) $temp = StringRegExp($Time, "(\d\d?):(\d\d?)(AM|PM)",1) If $temp[2] = "PM" Then $temp[0] = $temp[0] + 12 $res = $res & " " & StringFormat("%02i", $temp[0]) & ":" & StringFormat("%02i", $temp[1]) & ":00" Return $res EndFunc Best Regards.
  7. Or, depending how is formated your $source (need to have each line terminated by linefeed and/or carriage return), this : $PosR = StringRegExp($Source, ".*>(\d)<.*", 3) MsgBox(0, '', $PosR[0] & @LF & $PosR[1]) should be sufficient. Best Regards.
  8. Easy. If StringRegExp($objItem.Description, "(?i).*(Broadcom 801\.11g|Wireless Connection).*") Then $sWirelessList &= $objItem.Description & "|" Best Regards.
  9. If StringRegExp($objItem.Description, "(?i).*\ Broadcom 801\.11g.*") Then $sWirelessList &= $objItem.Description & "|" should make it , I guess. The key thing with your example (Broadcom 801.11g) is to not forget to escape the period (.) of the pattern you are looking for, because they have special meaning within the RegEx. Best Regards. Edit: typo
  10. And Obfuscator is already doing the cleaning for you, if you need. Best regards.
  11. Then you should test like this: ... If $inivar = "0" Then ... You see the quotes? No problem to use FileOpenDialog to pick the file you want to try/read. Best Regards. Oops. Pain has been too fast!
  12. It can be even more surprising. Try this: $1 = "zero" $2 = 0 if $1 = $2 Then MsgBox(0,"","1 "&$1 &" 2 "&$2) Else MsgBox(0,"","work ?") EndIf Conclusion: never play with mixing numbers and string in conditionnals. That may hurt! Best Regards.
  13. You may also replace the first "Endfunc" by "Return" Check in the help file.
  14. Hi, You can find an updated version of AnyGui UDF: here It has a link to the original thread too. Best regards
  15. Ok, I see. But I think that conditional testing can only be use to choose an alternative between 2 further matches. It cannot be used to choose an alternative between 2 string replacement (unfortunately). Regarding your need to rename TV show files, I suggest you have a look at Renamer which is a very nice program to rename files, using various technics, including Regex ! Best regards.
×
×
  • Create New...