10031992 Posted April 8, 2009 Share Posted April 8, 2009 (edited) I have a program TrainerAnd I have a big doubt in my script of text is stopped, but would like it move left or righthttp://img7.imageshack.us/img7/8341/howmovetext.jpg I am using the following scriptGUICreate("LC " & $country & " Program Beta " & $version, 500, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "onautoitexit") GUISetBkColor(0xFFFFFF) GUICtrlCreateList(" How move Text ?? - ", 50, 10, 306, 40, 10 ) GUICtrlSetFont(-1, 17, 400, 2, "Monotype Corsiva") GUICtrlSetColor(-1, 0x000000)what should I add to this part of my scriptfor the Text to scrollThanks, waiting for reply Edited April 8, 2009 by 10031992 -------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program Link to comment Share on other sites More sharing options...
Authenticity Posted April 8, 2009 Share Posted April 8, 2009 (edited) expandcollapse popup#include <GuiConstants.au3> #include <WinAPI.au3> Dim Const $R2_XORPEN = 7 Dim $hDll = DllOpen('gdi32.dll') Dim $hntdll = DllOpen('ntdll.dll') Dim $sStr = 'Scrolling Text...' Dim $hGUI = GUICreate('Test', 300, 200) Dim $Button = GUICtrlCreateButton('Te&st', 115, 100, 70, 23) GUISetBkColor(0x0078CC) Dim $hDC = _WinAPI_GetDC($hGUI) _GDI32_SetROP2($hDC, $R2_XORPEN) GUISetState() While 1 Switch GUIGetMsg() Case $Button _MoveText($sStr, $hDC) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch Sleep(20) WEnd _WinAPI_ReleaseDC($hGUI, $hDC) GUIDelete() DllClose($hntdll) DllClose($hDll) Func _GDI32_SetROP2($hDDC, $iR2) Local $aRet = DllCall($hDll, 'int', 'SetROP2', 'int', $hDDC, 'int', $iR2) If Not @error Then Return $aRet[0] Return SetError(-1, 0, -1) EndFunc Func _GDI32_TextOut($hDDC, $iXStart, $iYStart, $sString) Local $icbSring = StringLen($sString) Local $aRet = DllCall($hDll, 'int', 'TextOut', 'int', $hDDC, 'int', $iXStart, _ 'int', $iYStart, 'str', $sString, 'int', $icbSring) If Not @error Then Return $aRet[0] Return SetError(-1, 0, -1) EndFunc Func _GDI32_GetTextExtentPoint32($hDDC, $sString, ByRef $tSIZE) Local $icbSring = StringLen($sString) Local $aRet = DllCall($hDll, 'int', 'GetTextExtentPoint32', 'int', $hDDC, _ 'str', $sString, 'int', $icbSring, 'ptr', DllStructGetPtr($tSIZE)) If Not @error Then Return $aRet[0] Return SetError(-1, 0, -1) EndFunc Func _MoveText($sString, $hDDC) Local $tSZ = DllStructCreate($tagSIZE) Local $iDeltaX = 1 Local $iX = 0 Local $iWidth _GDI32_GetTextExtentPoint32($hDDC, $sString, $tSZ) $iWidth = DllStructGetData($tSZ, 'X') GUISetBkColor(0x0078CC) For $i = 1 To 10 While 1 _GDI32_TextOut($hDDC, $iX, 20, $sString) For $j = 0 To 10 _HighPrecisionSleep(0.09, $hntdll) Next _GDI32_TextOut($hDDC, $iX, 20, $sString) $iX += $iDeltaX If $iX + $iWidth >= 300 Or $iX <= 0 Then ExitLoop WEnd $iDeltaX *= -1 Next EndFunc ; #FUNCTION#;=============================================================================== ; ; Name...........: _HighPrecisionSleep() ; Description ...: Sleeps down to 0.1 microseconds ; Syntax.........: _HighPrecisionSleep( $iMicroSeconds, $hDll=False) ; Parameters ....: $iMicroSeconds - Amount of microseconds to sleep ; $hDll - Can be supplied so the UDF doesn't have to re-open the dll all the time. ; Return values .: None ; Author ........: Andreas Karlsson (monoceres) ; Modified.......: ; Remarks .......: Even though this has high precision you need to take into consideration that it will take some time for autoit to call the function. ; Related .......: ; Link ..........; ; Example .......; No ; ;;========================================================================================== Func _HighPrecisionSleep($iMicroSeconds,$hDll=False) Local $hStruct, $bLoaded If Not $hDll Then $hDll=DllOpen("ntdll.dll") $bLoaded=True EndIf $hStruct=DllStructCreate("int64 time;") DllStructSetData($hStruct,"time",-1*($iMicroSeconds*10)) DllCall($hDll,"dword","ZwDelayExecution","int",0,"ptr",DllStructGetPtr($hStruct)) If $bLoaded Then DllClose($hDll) EndFunc lol it's flickering and you have to call _HighPrecisionSleep to get the effect between 0.09 and 0.1. Edited April 8, 2009 by Authenticity Link to comment Share on other sites More sharing options...
10031992 Posted April 8, 2009 Author Share Posted April 8, 2009 Olá, talvez eu nao tenha explicado muito bem, mas o que eu queroÉ que o Text fique passando dentro do quadrado, Exemplo : Test Text Move >>>>> Test Text Move >>>>>>repetitivamenteHello, maybe I have not explained very well, but what I wantAnd that the textis going into the left or right and not stopit is inside the box,Example:Test Text Move >>>>> Test Text Move >>>>>>repeatedlyequal to many sites, and only thishttp://img25.imageshack.us/img25/9079/sitevi8.jpg -------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program Link to comment Share on other sites More sharing options...
Skruge Posted April 8, 2009 Share Posted April 8, 2009 Like this?#include <GUIConstants.au3> $country = "BRA" $version = "4.0(BETA)" local $listText, $s_TempText opt("GUIOnEventMode", 1) GUICreate("LC " & $country & " Program Beta " & $version, 500, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "_QuitApp") GUISetBkColor(0xFFFFFF) $listText = GUICtrlCreateList(" How move Text ?? - ", 50, 10, 306, 40, 10 ) GUICtrlSetFont(-1, 17, 400, 2, "Monotype Corsiva") GUICtrlSetColor(-1, 0x000000) GUISetState() While 1 Sleep(200) $s_TempText = GUICtrlRead($listText) GUICtrlSetData($listText, "|" & StringTrimLeft($s_TempText, 1) & StringLeft($s_TempText, 1)) WEnd Func _QuitApp() Exit EndFunc [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
10031992 Posted April 9, 2009 Author Share Posted April 9, 2009 Like this?#include <GUIConstants.au3> $country = "BRA" $version = "4.0(BETA)" local $listText, $s_TempText opt("GUIOnEventMode", 1) GUICreate("LC " & $country & " Program Beta " & $version, 500, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "_QuitApp") GUISetBkColor(0xFFFFFF) $listText = GUICtrlCreateList(" How move Text ?? - ", 50, 10, 306, 40, 10 ) GUICtrlSetFont(-1, 17, 400, 2, "Monotype Corsiva") GUICtrlSetColor(-1, 0x000000) GUISetState() While 1 Sleep(200) $s_TempText = GUICtrlRead($listText) GUICtrlSetData($listText, "|" & StringTrimLeft($s_TempText, 1) & StringLeft($s_TempText, 1)) WEnd Func _QuitApp() Exit EndFunc Thanks Skruge, was what I wanted thanks, I add in my script -------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program 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