
Ventura
Active Members-
Posts
20 -
Joined
-
Last visited
Recent Profile Visitors
125 profile views
Ventura's Achievements

Seeker (1/7)
1
Reputation
-
spudw2k reacted to a post in a topic: How to make dynamic changes input?
-
How to allow only ranging numbers in input box?
Ventura replied to Ventura's topic in AutoIt General Help and Support
It is something users will enter, and so if a user enters for example 99 in chance input it should revert to 98 and inform must be between " 0.01-98 " same goes for Payout input. -
How to make dynamic changes input?
Ventura replied to Ventura's topic in AutoIt GUI Help and Support
Well I have solved it myself after searching for... I got a code for WinAPI that makes it what I want. #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> $Form1 = GUICreate("Form1", 364, 153, 192, 124) $label1 = GUICtrlCreateLabel("Chance", 80, 32, 59, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $label2 = GUICtrlCreateLabel("Payout", 228, 31, 53, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("49.50", 144, 104, 97, 41) $Chance = GUICtrlCreateInput("49.50", 56, 63, 121, 21) $Payout = GUICtrlCreateInput("2", 208, 63, 121, 21) GUISetState(@SW_SHOW) Global $WhichFunc = 0 Global $aFuncs[2] $aFuncs[0] = _Func_1 $aFuncs[1] = _Func_2 Global $RW = 1 GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Chance Case $Payout Case $Button1 $aFuncs[$WhichFunc] () $WhichFunc = Not $WhichFunc EndSwitch WEnd Func WM_COMMAND($hWinHandle, $iMsg, $wParam, $lParam) If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $Chance Then Chance() EndIf If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $Payout Then Payout() EndIf EndFunc ;==>WM_COMMAND Func Chance() $Read1 = GUICtrlRead($Chance) $data = 99 / $Read1 GUICtrlSetData($Payout, $data) $data = 99 / $data If $RW = 1 Then GUICtrlSetData($Button1, $data) Else _Func_1() EndIf EndFunc Func Payout() $Read2 = GUICtrlRead($Payout) $data1 = 99 / $Read2 $data1 = Round($data1, 5) GUICtrlSetData($Chance, $data1) If $RW = 1 Then GUICtrlSetData($Button1, $data1) Else _Func_1() EndIf EndFunc Func _Func_2() $Read1 = GUICtrlRead($Chance) GUICtrlSetData($Button1, $Read1) $RW = 1 EndFunc Func _Func_1() $Read2 = GUICtrlRead($Chance) $Read2 = 99.99 - $Read2 GUICtrlSetData($Button1, $Read2) $RW = 2 EndFunc -
What I want is to make the Chance input to only allow between 0.01-98 and the Payout input to allow only 1.01202 to 9900 How do I make it to only allow those ranging numbers? #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 364, 153, 192, 124) $label1 = GUICtrlCreateLabel("Chance", 80, 32, 59, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $label2 = GUICtrlCreateLabel("Payout", 228, 31, 53, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("49.50", 144, 104, 97, 41) $Chance = GUICtrlCreateInput("49.50", 56, 63, 121, 21) $Payout = GUICtrlCreateInput("2", 208, 63, 121, 21) GUISetState(@SW_SHOW) Global $WhichFunc = 0 Global $aFuncs[2] $aFuncs[0] = _Func_1 $aFuncs[1] = _Func_2 Global $RW = 1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Chance Chance() Case $Payout Payout() Case $Button1 $aFuncs[$WhichFunc] () $WhichFunc = Not $WhichFunc EndSwitch WEnd Func Chance() $Read1 = GUICtrlRead($Chance) $data = 99 / $Read1 GUICtrlSetData($Payout, $data) $data = 99 / $data If $RW = 1 Then GUICtrlSetData($Button1, $data) Else _Func_1() EndIf EndFunc Func Payout() $Read2 = GUICtrlRead($Payout) $data1 = 99 / $Read2 $data1 = Round($data1, 5) GUICtrlSetData($Chance, $data1) If $RW = 1 Then GUICtrlSetData($Button1, $data1) Else _Func_1() EndIf EndFunc Func _Func_2() $Read1 = GUICtrlRead($Chance) GUICtrlSetData($Button1, $Read1) $RW = 1 EndFunc Func _Func_1() $Read2 = GUICtrlRead($Chance) $Read2 = 99.99 - $Read2 GUICtrlSetData($Button1, $Read2) $RW = 2 EndFunc
-
I want to know how can I make the inputs change instantly when I type? at the moment it only changes after I click on another input. #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 364, 153, 192, 124) $label1 = GUICtrlCreateLabel("Chance", 80, 32, 59, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $label2 = GUICtrlCreateLabel("Payout", 228, 31, 53, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("49.50", 144, 104, 97, 41) $Chance = GUICtrlCreateInput("49.50", 56, 63, 121, 21) $Payout = GUICtrlCreateInput("2", 208, 63, 121, 21) GUISetState(@SW_SHOW) Global $WhichFunc = 0 Global $aFuncs[2] $aFuncs[0] = _Func_1 $aFuncs[1] = _Func_2 Global $RW = 1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Chance Chance() Case $Payout Payout() Case $Button1 $aFuncs[$WhichFunc] () $WhichFunc = Not $WhichFunc EndSwitch WEnd Func Chance() $Read1 = GUICtrlRead($Chance) $data = 99 / $Read1 GUICtrlSetData($Payout, $data) $data = 99 / $data If $RW = 1 Then GUICtrlSetData($Button1, $data) Else _Func_1() EndIf EndFunc Func Payout() $Read2 = GUICtrlRead($Payout) $data1 = 99 / $Read2 $data1 = Round($data1, 5) GUICtrlSetData($Chance, $data1) If $RW = 1 Then GUICtrlSetData($Button1, $data1) Else _Func_1() EndIf EndFunc Func _Func_2() $Read1 = GUICtrlRead($Chance) GUICtrlSetData($Button1, $Read1) $RW = 1 EndFunc Func _Func_1() $Read2 = GUICtrlRead($Chance) $Read2 = 99.99 - $Read2 GUICtrlSetData($Button1, $Read2) $RW = 2 EndFunc
-
well I don't a thing about regex other than just replacing plain text /: So I have this text <data> <us1></us1> <eu1></eu1> <rt2></rt2> <le2></le2> </data> I want to remove all those text inside the data so I get output like this <data> </data> SO far after searching the forum for hours I have come up with this $sText = "<data><us1><eu1><rt2><le2></data>" Local $sStart = "(\<data>)" Local $sEnd = "(\</data>)" Local $sReplace = ""& @CRLF &"" $Text = StringRegExpReplace($sText, "(?i)" & $sStart & "([^\<]*)" & $sEnd , "$1" & $sReplace & "$3") MsgBox(0, "", $Text) It works only with text inside the data but not after putting several "<>" ..
-
Ventura reacted to a post in a topic: FileWriteToLine doesn't work as expected
-
FileWriteToLine doesn't work as expected
Ventura replied to Ventura's topic in AutoIt General Help and Support
Both works thanks.. -
FileWriteToLine doesn't work as expected
Ventura replied to Ventura's topic in AutoIt General Help and Support
Well then it was because of the function ... but the loop has done a lot of things for me with no problem. What Brew just said and only slight change made it work with my loop. -
#include <File.au3> Global $line = 2, $num = 1 Do _FileWriteToLine(@ScriptDir & "\data.txt", $line, 'Name'&@CRLF&'<ID>"'&$num&'"', 0) $line = $line + 3 $num = $num + 1 Sleep(100) Until $line = 14 Like the title says, I need _FileWriteToLine to write data into a text file that already has this text data---------------- data---------------- What I need is to put informations in between the two "data------------------" data---------------- Name <ID>"1" Name <ID>"2" Name <ID>"3" Name <ID>"4" data---------------- So it looks like the above example, but it doesn't, instead it just puts 1 information between the "data------------------", while I want the 4 informations in it. There is nothing wrong with the loop, I have tested it with msgbox and nothing wrong with it absolutely.. so I think it must be about _FileWriteToLine function but not so sure.
-
Here is my full code.. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> $Form = GUICreate("Form1", 300, 340, 0, 0) GUISetBkColor(0x494E48) $Border = GUICtrlCreateGraphic(10, 10, 280, 280) $Header = GUICtrlCreateGraphic(10, 10, 280, 25) $Label = GUICtrlCreateLabel("SPLITS", 15, 15, 40, 15) $splits = GUICtrlCreateButton("Add Item", 50, 300, 80, 30) $getsplit = GUICtrlCreateButton("Show Item", 160, 300, 80, 30) GUICtrlSetColor($Border, 0x696A65) GUICtrlSetColor($Header, 0x696A65) GUICtrlSetColor($Label, 0x00FF00) GUICtrlSetState($Border, $GUI_DISABLE) GUICtrlSetState($Header, $GUI_DISABLE) $Listview = GUICtrlCreateListView("Column1|Column2|Column3|Column4", 15, 40, 270, 240, _ BitOR($LVS_SHOWSELALWAYS, $LVS_NOCOLUMNHEADER), $WS_EX_TRANSPARENT) GUICtrlSetColor($Listview, 0xEEEEEE) _GUICtrlListView_SetExtendedListViewStyle($Listview, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_TRANSPARENTBKGND, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_SetColumnWidth($Listview, 0, 67) _GUICtrlListView_SetColumnWidth($Listview, 1, 67) _GUICtrlListView_SetColumnWidth($Listview, 2, 67) _GUICtrlListView_SetColumnWidth($Listview, 3, 69) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $splits Addtolist() Case $getsplit EndSwitch WEnd Func Timer(Const $Timer) Local $Ms = Int(Mod(TimerDiff($Timer), 1000)) Local $Timer2 = TimerDiff($Timer) / 1000 Local $Mins = Int($Timer2 / 60) Local $Secs = Floor(Mod($Timer2, 60)) Return StringFormat("%01i:%02i:%03i", $Mins, $Secs, $Ms) EndFunc ;==>Timer Func Addtolist() $i = 0 $rw = 0 Local $aItem1, $aItem2, $aItem3 While 1 $Time = TimerInit() Sleep(1000) ;; Some function to do here $splits1 = Timer($Time) _GUICtrlListView_AddItem($Listview, $splits1, $i) $Time = TimerInit() Sleep(1000) ;; Some function to do here $splits2 = Timer($Time) _GUICtrlListView_AddSubItem($Listview, $i, $splits2, 1, 1) $Time = TimerInit() Sleep(1000) ;; Some function to do here $splits3 = Timer($Time) _GUICtrlListView_AddSubItem($Listview, $i, $splits3, 2, 2) $i = $i + 1 $aItem1 = _GUICtrlListView_GetItem($Listview, $rw) $aItem2 = _GUICtrlListView_GetItem($Listview, $rw, 1) $aItem3 = _GUICtrlListView_GetItem($Listview, $rw, 2) $aItemT = $aItem1[3] + $aItem2[3] + $aItem2[3] MsgBox(1, "1", "Total time:" & @TAB & $aItemT) $rw = $rw + 1 WEnd EndFunc ;==>Addtolist
-
This what I'm trying to do.. The function I use actually does what I want, I get three or two formatted timestamps for the time taken and I put it in my gui as list.. So all I want was a way to add those two or three times and show exactly how long it took as a whole. For example (Mins : Secs . MS) 0:31.570 + 0:51.329 + 0:34.887 = 1:57.786 Adding those three will give me 1 min 57 secs and 786 ms.. just like this page does Maybe I have taken wrong approach for the code in OP because after looking both posts above it doesn't show exactly time taken but InunoTaishou code is closer to what I want.
-
I use a function to make the Timer tho show as Minutes:Seconds.Miliseonds but I have an issue. It doesn't add the timers and thus it shows 0 as the return. It works for the normal timer and also for TicksToTime but doesn't with this function. ; Should show 0:xx.xxx as the return but shows 0 Func Timer(Const $Timer) Local $Ms = Int(Mod(TimerDiff($Timer), 1000)) Local $Timer2 = TimerDiff($Timer) / 1000 Local $Mins = Int($Timer2 / 60) Local $Secs = Floor(Mod($Timer2, 60)) Return StringFormat("%01i:%02i.%03i", $Mins, $Secs, $Ms) EndFunc ;==>Timer $iBegin = TimerInit() Sleep(Random(500,2000)) $Int1 = Timer($iBegin) $iBegin = TimerInit() Sleep(Random(500,2000)) $Int2 = Timer($iBegin) $IntT = $Int1 + $Int2 MsgBox(0, '', $IntT)
-
Both of them works thanks @Damein It is working, just that there is 4 digits showing after every 999+, even sometimes showing 1100 for the miliseconds. @InunoTaishou I have been searching it for hours, I haven't seen one exactly like mine. So about your code I tried it works, the only thing is that it doesn't add leading zero to numbers below 100 ms, I have fixed it by making the StringFormat %03i for ms.
-
I have a timer that uses _TicksToTime which normally shows Hours, Mins and Seconds... which isn't what I want. I wanted the timer to show like this Mins:Seconds:Miliseconds Basically so it will look like 1:53.964 which is 1 mins 53 secs and 964 ms The usual way they use for sports racing.. #Include <Date.au3> Global $iHours = 0, $iMins = 0, $iSecs = 0 $Timer = TimerInit() While 1 Sleep(100) $Time = TimerDiff($Timer) _TicksToTime($Time, $iHours, $iMins, $iSecs) ToolTip(StringFormat( "%02i:%02i:%02i:%02i", $iHours, $iMins, $iSecs)) WEnd
-
How to run/open files inside compiled script?
Ventura replied to Ventura's topic in AutoIt General Help and Support
I mean run file inside the .exe Normally we use FileInstall but i want without the need of FileInstall and run/open the file inside the .exe I compiled.. I have read those posts in above links and I can't seem to understand anything to hard for me.. i'm novice to this... maybe if someone can show me how to use them. -
I have this simple GUI code here, I wanted to run/open files as title says, inside a compiled script instead of using FileInstall, I have added files with Wrapper, but the only way I can run/open it is to use FileInstall and run normally which I know.. so if I click run file in GUI it will run the file insdie the compiled .exe, so is this possible? i have searched around and didn't seen a topic for it. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_File_Add=C:\server\serverstart.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form = GUICreate("Run", 278, 127, 316, 216) $Button = GUICtrlCreateButton("Run file", 82, 43, 113, 41) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button EndSwitch WEnd