toonboon
Active Members-
Posts
171 -
Joined
-
Last visited
About toonboon
- Birthday 11/18/1992
Profile Information
-
Location
Eindhoven - The Netherlands
-
Interests
Doing stuff on my PC, scripting in AutoIt.
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
toonboon's Achievements
Prodigy (4/7)
0
Reputation
-
Hello, I am trying to import some mtg cards into a database for personal track-keeping. Whilst testing the program I came to an issue when processing the card information. should become The code I have thus far for this is $sText = StringReplace(StringReplace(StringReplace($sText, '<img src="/Handlers/Image.ashx?size=small&name=', '') _, '&type=symbol" ', '') _, ' align="absbottom" />', '') Which makes it easier for processing with the help of a regular expression by trimming it down to this: Now the part which I actually need help with, the regular expression. Right now I have the following: $sText = StringRegExpReplace($sText, '([:alnum:]+)((alt=")(.*?{1})")', '{1}') But this doesn't work. I have no idea why, it looks correct to me, but it just doesn't. If anyone could help me with this by either just giving me a correct line of code to use or, much preferred, telling me what's wrong and explaining a solution to me. That'd be great.
-
Allright so from the following reddit thread I've started to work on something that does exactly what OP asks: http://www.reddit.com/r/AskReddit/comments/ywqq3/is_there_a_way_to_make_my_laptop_wallpaper_a/ The code I got so far is working out pretty well, the hex values for the colours I'm getting are the correct values for the corresponding power level. The only issue I'm having is with the WinAPI_SetSysColors function, because it turns my redish colours into blueish colours. If anyone knows what's up and/or how to fix this, then that'd be greatly appreciated! Code below #include <WinAPI.au3> #include <WindowsConstants.au3> $bDebug = True If $bDebug Then HotKeySet("{ESC}", "_Terminate") Global $iOldBatteryLevel = 0 $hEnd = 0x33cc33 $hStart = 0xcc3333 Global $start_r = Dec(StringMid(Hex($hStart), 3, 2)) Global $start_g = Dec(StringMid(Hex($hStart), 5, 2)) Global $start_b = Dec(StringMid(Hex($hStart), 7, 2)) Global $end_r = Dec(StringMid(Hex($hEnd), 3, 2)) Global $end_g = Dec(StringMid(Hex($hEnd), 5, 2)) Global $end_b = Dec(StringMid(Hex($hEnd), 7, 2)) While 1 Dim $info $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!.rootcimv2") $objBatt = $objWMIService.ExecQuery("Select * from Win32_Battery") For $object In $objBatt $iBatteryLevel = $object.EstimatedChargeRemaining Next ;~ If $iBatteryLevel <> $iOldBatteryLevel Then _GetBackgroundColor() _SetBackgroundColor(_GetColor($iBatteryLevel)) ;~ $iOldBatteryLevel = $iBatteryLevel ;~ EndIf Sleep(5000) WEnd Func _GetColor($iPowerLevel) $red = Round($start_r - ($start_r - $end_r) * ($iPowerLevel / (100))); $green = Round($start_g - ($start_g - $end_g) * ($iPowerLevel / (100))); $blue = Round($start_b - ($start_b - $end_b) * ($iPowerLevel / (100))); $color = StringRight(Hex($red), 2) & StringRight(Hex($green), 2) & StringRight(Hex($blue), 2) ClipPut($color) Return '0x' & $color Exit EndFunc ;==>_GetColor Func _GetBackgroundColor() Return _WinAPI_GetSysColor($COLOR_BACKGROUND) EndFunc ;==>_GetBackgroundColor Func _SetBackgroundColor($bColor) Local $iError = 0 _WinAPI_SetSysColors($COLOR_BACKGROUND, $bColor) If @error Then $iError = 1 EndIf Return SetError($iError, 0, $bColor) EndFunc ;==>_SetBackgroundColor Func _Terminate() Exit EndFunc ;==>_Terminate EDIT: Additionally, when I PixelGetColor the background and use _WinAPI_SetSysColors to set the background to the colour PixelGetColor gave me the background gets set to the correct color I tried to set it to at first. Wierd right?
-
I know I've done it before, but I forgot how I did it, and any and all searches give me no usable results so I'll just post a thread. How do I create an edit control with scroll bars that only show when the text length/width exceeds the control size?
-
Obviously a script that ends will stop running, if you want it to keep running add in an endless loop somewhere. while 1 sleep(10) wend
-
$gui = GUICreate("", 500, 500, -1, -1, -1, -1, WinGetHandle("Program Manager")) OR$gui = GUICreate("", 500, 500, -1, -1, -1DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($gui), "hwnd", )GUISetState()the second solution is neater imo, because it hides it from the taskbar
-
Hi, I'm trying to get the current selection in a listbox from a gui which is from another process. So I've got the parent process with the GUI and the child process with the reading. Problem is I cant get the child to read the data =( these are the two sources: Parent: #Include <GuiListView.au3> $Debug_LV = False $GUI = GUICreate("Parent GUI", 350, 550) $UserList = GUICtrlCreateListView("Monkey Names", 8, 8, 164, 400) $PassList = GUICtrlCreateListView("Food Types", 180, 8, 164, 400) _GUICtrlListView_SetColumnWidth($Names, 0, 160) _GUICtrlListView_SetColumnWidth($Food, 0, 160) For $a = 65 To 125 GUICtrlCreateListViewItem(Chr($a), $Names) Next For $a = 1 To 6 GUICtrlCreateListViewItem($a, $Food) Next GUISetState() $UserList = GUICtrlGetHandle($Names) Run(@ComSpec & " /c " & "Child.exe " & GUICtrlGetHandle($Names), "", @SW_HIDE, 2) _GUICtrlListView_SetItemSelected($Names, 0) while 1 $i = _GUICtrlListView_GetSelectedIndices($Names) ToolTip($i & "-" & _GUICtrlListView_GetItemText($Names, Number($i)), 0, 15) $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch sleep(100) WEnd Child: #Include <GuiListView.au3> #AutoIt3Wrapper_Run_Debug_Mode=y If $CmdLine[0]=0 Then $Handle = ClipGet() Else $Handle = $CmdLine[1] EndIf while WinExists("Parent GUI") ToolTip("-" & _GUICtrlListView_GetSelectedIndices($Handle, False), 0, 0) sleep(100) WEnd
-
Oh my... It's that easy... Sorry for not searching enough >_
-
Hi, After some searching I couldn't find the answer to this question, so I'm posting this thread >_< Is it possible to get the state of a control in another window from another process? ~Toon
-
_StringBetween returns an array. $File = FileRead($S_TXT) $File = _HexToString($File) $File = StringSplit($File, 'º') For $i = 1 To $File[0] If StringInStr($File[$i], '!' & $Name_S) Then $Pm = _StringBetween($File[$i], '!' & $Name_S, '-') $Pm = $Pm[0] $From = _StringBetween($File[$i], '-', '*') $From = $From[0] $sFile = FileRead($S_TXT) $sFile = _HexToString($sFile) $Msg = _StringBetween ($File[$i], $Name_S, '*º') $sFile = StringReplace($sFile, @CRLF & 'º!' & $Name_S & $Msg[0] & '*º' & @CRLF, '') $sFile = _StringToHex($sFile) FileDelete($S_TXT) FileWrite($S_TXT, $sFile) MsgBox (0,'', $Pm[0]) EndIf If StringLeft($File[$i], 1) = '!' Then $File[$i] = '' If StringLeft($File[$i], 1) = '$' Then $File[$i] = '' If StringLeft($File[$i], StringLen($Ignore)) = $Ignore Then $File[$i] = '' GUICtrlSetData($Main, GUICtrlRead($Main) & $File[$i]) Next I think this should work... EDIT: Edited in my double post xD
-
Help with Noticing changes in GUI
toonboon replied to Regency's topic in AutoIt GUI Help and Support
WinFlash()for flashing the window and try looking at _INetGetSource for the page source =) -
DirGetSize()
-
Script for "Risk your life" game
toonboon replied to Sirgijoe's topic in AutoIt General Help and Support
What you are doing now is sending the E key 100 times per second. IIRC that is far more than a human is able to do so you spamming the key and not having any lag-issues is not applicable in this case. Try setting the sleep to 100 for 10 times per second or some other way that works for you. -
Get Filename From FileOpenDialog
toonboon replied to FinalVersion's topic in AutoIt General Help and Support
the $sB returns the full path of the file that has been selected. Try looking at stringsplit to acomplish it. -
Share data between 2 instances of a script?
toonboon replied to EmkioA's topic in AutoIt General Help and Support
How about asking the question, 'Could you help me on my way to solving this problem?' -
how the hell can you send a control C if there is no window to select text in? or am I stupid on this one?