Jump to content

fs1234

Members
  • Posts

    14
  • Joined

  • Last visited

fs1234's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hi All, Sorry for my bad english. I tried this script with the function found here, but with Stringleft i get "Recursion level has been exceeded" error. I have no idea why. Help, pls. Thanks $s= "2143" $e= "0030" $DiffFullMin = _GetTimeDiffUtil(StringLeft($s, 2), StringRight($s, 2), 00, StringRight($e, 2)) ; it's working ;$DiffFullMin = _GetTimeDiffUtil(StringLeft($s, 2), StringRight($s, 2), StringLeft($e, 2), StringRight($e, 2)) ; it's not MsgBox(0, "", $DiffFullMin) ;Returns time difference in minutes. Only supports maximum of 23 hrs 59 mins time span. Func _GetTimeDiffUtil($sHour, $sMin, $eHour, $eMin) ;Start time and end time occurs within the same hour If $sHour == $eHour Then If $eMin > $sMin Then ;Time span is within the same hour Return $eMin - $sMin Else ;Time span is near 24 hours Return 3600 - $sMin + $eMin EndIf EndIf ;Start time and end time occur within the same day If $sHour < $eHour Then Return (60 * ($eHour - $sHour - 1)) + (60 - $sMin + $eMin) EndIf ;Start time is before midnight and end time is after midnight Return _GetTimeDiffUtil($sHour, $sMin, 24, 0) + _GetTimeDiffUtil(0, 0, $eHour, $eMin) EndFunc
  2. Hi, I would like to change the hungarian characters in a string, but I can't figure out how to do it. Help, pls. #include <MsgBoxConstants.au3> Local $sInput = "Árvíztűrő tükörfúrógép" Local $sOutput = StringRegExpReplace($sInput, "(?-i)(á)|(Á)|(é)|(É)|(í)|(Í)|(ó)|(Ó)|(ö)|(Ö)|(ő)|(Ő)|(ú)|(Ú)|(ü)|(Ü)|(ű)|(Ű)", "(?1a)(?2A)(?3e)(?4E)(?5i)(?6I)(?7o)(?8O)(?9o)(?10O)(?11o)(?12O)(?13u)(?14U)(?15u)(?16U)(?17u)(?18U)") Display($sInput, $sOutput) Func Display($sInput, $sOutput) ; Format the output. Local $sMsg = StringFormat("Input:\t%s\n\nOutput:\t%s", $sInput, $sOutput) MsgBox($MB_SYSTEMMODAL, "Results", $sMsg) EndFunc ;==>Display
  3. Damn it! Of course... Work perfectly. Thanks!
  4. Thanks Nine, When I run the script I got an error: test2.au3 (9) : ==> Unable to parse line.: ? ^ ERROR Whats wrong?
  5. Thanks abberation and Zedna, With the help of ResourcesEx I managed to solve the problem.
  6. Hi All, I tried this code, but not working: #include <Misc.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> Global $DLLUser32 = DllOpen("user32.dll"), $fRun Local $ButtonNo $gui = GUICreate("Test Button Pressed", 350, 250, -1, -1) $Button1 = GUICtrlCreateButton("Button1", 20, 40, 80, 80, $BS_BITMAP) GUICtrlSetImage($Button1, @ScriptDir & "\Button1.bmp") $Button2 = GUICtrlCreateButton("Button2", 120, 40, 80, 80, $BS_BITMAP) GUICtrlSetImage($Button2, @ScriptDir & "\Button2.bmp") $Button3 = GUICtrlCreateButton("Button3", 220, 40, 80, 80, $BS_BITMAP) GUICtrlSetImage($Button3, @ScriptDir & "\Button3.bmp") GUISetState() While 1 $MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE Exit Case $MSG = $Button1 $ButtonNo = "1" _Display() While 1 If _IsPressed("01", $DLLUser32) Then If $fRun Then GUICtrlSetImage($Button1, @ScriptDir & "\Button1_p.bmp") $fRun = False EndIf Else GUICtrlSetImage($Button1, @ScriptDir & "\Button1.bmp") $fRun = True EndIf WEnd Case $MSG = $Button2 $ButtonNo = "2" _Display() While 1 If _IsPressed("01", $DLLUser32) Then If $fRun Then GUICtrlSetImage($Button2, @ScriptDir & "\Button2_p.bmp") $fRun = False EndIf Else GUICtrlSetImage($Button2, @ScriptDir & "\Button2.bmp") $fRun = True EndIf WEnd Case $MSG = $Button3 $ButtonNo = "3" _Display() While 1 If _IsPressed("01", $DLLUser32) Then If $fRun Then GUICtrlSetImage($Button3, @ScriptDir & "\Button3_p.bmp") $fRun = False EndIf Else GUICtrlSetImage($Button3, @ScriptDir & "\Button3.bmp") $fRun = True EndIf WEnd EndSelect WEnd Func _Display() MsgBox(0, "", $ButtonNo) EndFunc The first pressed button changes continuously. Help, pls. Button1.bmp Button1_p.bmp Button2.bmp Button2_p.bmp Button3.bmp Button3_p.bmp
  7. Thanks, abberration, Your code works great with shell32.dll (icon?), but I would need it with bitmap. I didn't test with my own dll, but with the windows cards.dll. I attached the file. Thanks again cards.dll
  8. Hi All, I would like to use images on the buttons, but not working.I tried the code below: #include <GUIConstants.au3> #include <WinAPI.au3> $Form1 = GUICreate("", 400, 400) $pic = GUICtrlCreatePic("", 20, 40, 80, 80) GUISetState() $B_Button1 = GUICtrlCreateButton("Button1", 20, 40, 80, 80, $BS_BITMAP) GUICtrlSetImage(-1, GUICtrlSetImageFromDLL($pic, 'stores.dll', 1)) While 1 $MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE Exit Case $MSG = $B_Button1 $Store = "Number" $StoreName = "Name" _Display() EndSelect WEnd Func _Display() MsgBox(0, $Store, $StoreName) EndFunc Func GUICtrlSetImageFromDLL($controlID, $filename, $imageIndex) Local Const $STM_SETIMAGE = 0x0172 $hLib = _WinAPI_LoadLibrary($filename) $hBmp = _WinAPI_LoadImage($hLib, $imageIndex, $IMAGE_BITMAP, 0, 0, $LR_DEFAULTCOLOR) GUICtrlSendMsg($controlID, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp) _WinAPI_FreeLibrary($hLib) _WinAPI_DeleteObject($hBmp) EndFunc Could someone help me? Thank you!
  9. Return String($aTemp[0][0]) & " - " & String($aTemp[0][1]) & " - " & String($aTemp[0][2]) & @CRLF 2D array
  10. Hi Guys, Help me, pls! How can I do the progress of $SourceFullSize in the $ProgressBar2 with the Round($o / $Chunks)? $SourceSize = FileGetSize(@ScriptDir & "\test.zip") $SourceFullSize = FileGetSize(@ScriptDir & "\test.zip") * 8 For $i = 1 To 8 GUICtrlSetData($ProgressLabel1, "8/" & $i & ":") $Source = FileOpen(@ScriptDir & "\test.zip", 16) $Dest = FileOpen(@ScriptDir & "\" & $i & "\test.zip", 26) $Chunks = $SourceSize / 2048 For $o = 0 To $Chunks FileWrite($Dest, FileRead($Source, 2048)) GUICtrlSetData($progressbar1, Round(($o / $Chunks) * 100)) ;GUICtrlSetData($progressbar2, $i * (Round(($o / $Chunks) * 100))) Progress of $SourceFullSize Next FileClose($Dest) FileClose($Source) Next Thanks
  11. Thanks for reply Melba! Now perfectly working.
  12. Hello! Sorry for my bad english. The test .txt has approx. 3000 rows, but this script is below show me 7xx. What's wrong? Anyone can help me? Tx. GUICreate("gui", 800, 700) $Edit = GUICtrlCreateEdit("", 0, 0, 800, 500, ) $Button = GUICtrlCreateButton("OK", 300, 550, 200, 50) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 Exit Case $Button _OK() EndSwitch WEnd Func _OK() Local $file = FileOpen(@ScriptDir & "\test.txt") While 1 Local $line = FileReadLine($file) If @error = -1 Then ExitLoop GUICtrlSetData($Edit, $line & @CRLF, 1) ; MsgBox(0, "Line read:", $line) WEnd FileClose($file) EndFunc
×
×
  • Create New...