Search the Community
Showing results for tags 'Multiple'.
-
Split multiple selectors for use with jQuery
guinness posted a topic in Developer General Discussion
I needed a quick and dirty approach to splitting up jQuery multiple selectors, so I could record if a selector pattern had already been used. So I came up with this "quick 'n' dirty" hack. If someone can up with better let me know. I tried to look at the sizzle source, but didn't have enough time to plough through 2000 lines of code. // Split the following multiple selectors into an array var selector = '#nav-bar-temp-1 a, #nav-bar-temp-2 a'; console.log(getSelectors(selector)); /** * Get a list of selectors (singule or multiple) * * @param {string} selector A valid jQuery selector string * @returns {array} An array or selectors; otherwise, an empty array */ function getSelectors(selector) { var isInQuoteMark = false, // True/false when inside a quotation mark i.e. commas should be ignored isNextSelector = false, // If passed a comma set to true, so whitespace can be escaped before meeting a next non-whitespace character isQuoteMark = false, // True/false as to whether a quotation mark reQuoteMark = /[\"\']/, // Regex to determine a quotation mark selectors = [], // Array to hold found selectors temporary = ''; // Temp variable to store the selector for (var i = 0, length = selector.length; i < length; i++) { // Is it a quotation mark? isQuoteMark = selector[i].match(reQuoteMark); if (isQuoteMark && !isInQuoteMark) { // Appears to be the start of a string isInQuoteMark = true; } else if (isQuoteMark && isInQuoteMark) { // Appears to be the end of a string isInQuoteMark = false; } else if (selector[i] === ',' && !isInQuoteMark) { // If a comma and not inside a string then push to the array isNextSelector = true; selectors.push(temporary); temporary = ''; // So as not to add the comma to the temporary variable continue; } else if (selector[i] !== ' ' && isNextSelector) { // If not an empty space but the next selector has started then set to false isNextSelector = false; } // If the character can be concatanated i.e. not whitespace after a comma, then add if (!isNextSelector) { temporary += selector[i]; } } // If temporary is not empty, then push to the array if (temporary) { selectors.push(temporary); } // Return the array of selectors. Note it could be empty return selectors; }- 2 replies
-
- jquery
- javascript
-
(and 3 more)
Tagged with:
-
I am struggling with activating the 2nd GUI. References of https://www.autoitscript.com/wiki/Managing_Multiple_GUIs did not help. Gui2 and controls are created, but the buttons are not active. I have tried to remove extra code. Thanks for any help. ; ; cabinet maker process to automate MasterCam ; ATP nesting process ; #include <AutoItConstants.au3> #include <Array.au3> ;#include <file.au3> ;#include <FileConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WinAPI.au3> #include <WinAPIFiles.au3> #include <WindowsConstants.au3> ;#include <XML.au3>; If XML library is updated, note that this script requires that save file will overwrite an existing file Opt("GUIOnEventMode", 1) ; 1 = OnEvent mode Opt("WinWaitDelay", 500) ; milliseconds Opt("TrayIconDebug", 1) Opt("WinSearchChildren", 1) Global $hMainGUI Global $hMainGUI2 Func GetAllWindowsControls($hCallersWindow, $bOnlyVisible = Default, $sStringIncludes = Default, $sClass = Default) If Not IsHWnd($hCallersWindow) Then ConsoleWrite("$hCallersWindow must be a handle...provided=[" & $hCallersWindow & "]" & @CRLF) Return False EndIf ; Get all list of controls If $bOnlyVisible = Default Then $bOnlyVisible = True If $sStringIncludes = Default Then $sStringIncludes = "" If $sClass = Default Then $sClass = "" $sClassList = WinGetClassList($hCallersWindow) ; Create array $aClassList = StringSplit($sClassList, @CRLF, 2) ; Sort array _ArraySort($aClassList) _ArrayDelete($aClassList, 0) ; Loop $iCurrentClass = "" $iCurrentCount = 1 $iTotalCounter = 1 If StringLen($sClass) > 0 Then For $i = UBound($aClassList) - 1 To 0 Step -1 If $aClassList[$i] <> $sClass Then _ArrayDelete($aClassList, $i) EndIf Next EndIf For $i = 0 To UBound($aClassList) - 1 If $aClassList[$i] = $iCurrentClass Then $iCurrentCount += 1 Else $iCurrentClass = $aClassList[$i] $iCurrentCount = 1 EndIf $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]") $text = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}") $aPos = ControlGetPos($hCallersWindow, "", $hControl) $sControlID = _WinAPI_GetDlgCtrlID($hControl) $bIsVisible = ControlCommand($hCallersWindow, "", $hControl, "IsVisible") If $bOnlyVisible And Not $bIsVisible Then $iTotalCounter += 1 ContinueLoop EndIf If StringLen($sStringIncludes) > 0 Then If Not StringInStr($text, $sStringIncludes) Then $iTotalCounter += 1 ContinueLoop EndIf EndIf If IsArray($aPos) Then ;ConsoleWrite("ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aPos[0]) & "] YPos=[" & StringFormat("%4s", $aPos[1]) & "] Width=[" & StringFormat("%4s", $aPos[2]) & "] Height=[" & StringFormat("%4s", $aPos[3]) & "] IsVisible=[" & $bIsVisible & "] Text=[" & $text & "]." & @CRLF) ConsoleWrite("Func=[GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aPos[0]) & "] YPos=[" & StringFormat("%4s", $aPos[1]) & "] Width=[" & StringFormat("%4s", $aPos[2]) & "] Height=[" & StringFormat("%4s", $aPos[3]) & "] IsVisible=[" & $bIsVisible & "] Text=[" & $text & "]." & @CRLF) Else ;ConsoleWrite("ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $text & "]." & @CRLF) ConsoleWrite("Func=[GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $text & "]." & @CRLF) EndIf If Not WinExists($hCallersWindow) Then ExitLoop $iTotalCounter += 1 Next ;MsgBox($MB_SYSTEMMODAL, "title", "check console for control list") EndFunc ;==>GetAllWindowsControls ; ======= Func GetAllWindowsControls($hCallersWindow, $bOnlyVisible = Default, $sStringIncludes = Default, $sClass = Default) ========= Func setNestingOverlay() $ovrWidth = 400 $ovrHeight = 60 $ovrLeft = -1 ;$mcamWindow[0] + $nestControlRelative[0] $ovrTop = -1;$mcamWindow[1] + $nestControlRelative[1]+ 10 $hMainGUI = GUICreate("covering mastercam buttons", $ovrWidth, $ovrHeight, $ovrLeft, $ovrTop, -1, $WS_EX_TOPMOST) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseButton2") Local $iOKButton1 = GUICtrlCreateButton("Continue to gui2", 20, 20, 80) GUICtrlSetOnEvent($iOKButton1, "NestResultButtonOverlay") GUISetState(@SW_SHOW, $hMainGUI) GetAllWindowsControls(WinGetHandle("[ACTIVE]")) ;loop to monitor button click While 1 Sleep(50) ; Sleep to reduce CPU usage WEnd ConsoleWrite(" exit loop setNestingOverlay") EndFunc ;==>setNestingOverlay ;=== 2nd gui ======= 2nd gui ======= 2nd gui ======= 2nd gui ======= 2nd gui ======= 2nd gui ==== func NestResultButtonOverlay() $ovrWidth = -1;$mcamWindow[2] - 10 $ovrHeight = 70 ;40 $ovrLeft = -1 ;$mcamWindow[0] + 5 ;+ $nestControlRelative[0] $ovrTop = -1 ;$mcamWindow[1] + $nestControlRelative[1]+ 10 $hMainGUI2 = GUICreate("gui2-- covering nest result buttons", $ovrWidth, $ovrHeight, $ovrLeft, $ovrTop, -1, $WS_EX_TOPMOST) ;width, height, left, top ;GUISetState(@SW_DISABLE + @SW_MINIMIZE, $hMainGUI) ;GUISwitch($hMainGUI2) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseButton2") local $iBackNestingButton = GUICtrlCreateButton("Back to Nesting", 20, 10, 120) GUICtrlSetOnEvent($iBackNestingButton, "backtoNesting") Local $iOKButton2 = GUICtrlCreateButton("Continue for g-Code", 160, 10, 120) GUICtrlSetOnEvent(-1, "generateGCode") ;GUICtrlSetOnEvent($iOKButton2, "generateGCode") Local $iDoneButton2 = GUICtrlCreateButton("Oops go back to vortex", 300, 10, 120) GUICtrlSetOnEvent($iDoneButton2, "CloseButton2") GUISetState(@SW_SHOW, $hMainGUI2) GUISetState(@SW_DISABLE + @SW_MINIMIZE, $hMainGUI) GUISwitch($hMainGUI2) GetAllWindowsControls(WinGetHandle("[ACTIVE]")) While 1 Sleep(50) ; Sleep to reduce CPU usage WEnd ConsoleWrite(" exit loop NestResultButtonOverlay") EndFunc ;==>setNestingOverlay func backtoNesting() msgbox($MB_SYSTEMMODAL, "gui2","backtoNesting") EndFunc Func CloseButton2() msgbox($MB_SYSTEMMODAL, "gui2","CloseButton2") Exit EndFunc func generateGCode() msgbox($MB_SYSTEMMODAL, "gui2","generateGCode") EndFunc ; =========== main =========== main =========== main =========== main =========== main =========== main setNestingOverlay()
-
Hello I have a query please It is about windows file explorer If i design a tool in autoit language to delete files for example and i added it in the context menu in File Explorer If i right-click on any file And you choose the tool, it will be get the path of the selected file or folder The problem here is If i select a set of files or folders it only detect the first one The code that i used is if $CMDLine[0] = 0 then msgBox(16, "error", "you don't selecte any files") exit else for $i = 1 to $CMDLine[0] msgBox(0, "files", $CMDLine[$i] next endIf exit
-
Im creating a tab Global $Tab1 = GUICtrlCreateTab(30, 30, 600, 420, $TCS_BUTTONS, -1) And what we see in the function reference: https://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateTab.htm GUICtrlCreateTab ( left, top [, width [, height [, style = -1 [, exStyle = -1]]]] ) ok in 5 arg I got $TCS_BUTTONS But How can I use multiple args like this below Global $Tab1 = GUICtrlCreateTab(30, 30, 600, 420, [$TCS_BUTTONS, $TCS_MULTILINE], -1)
-
Hello all, I've been working on 4 standalone scripts. They each have their own GUI and are now independent .exe's. But instead of having 4 separate icons on my computer, is it possible to put them all together into one .exe? What I want is one interface with tabs. Each script's GUI would be on their own respective tab. Is this possible? The different scripts don't need to communicate with one another. I just want them all in one .exe. I can't find this anywhere... Any help would be greatly appreciated. Thank you!
-
I am trying to script the opening of multiple tabs in IE with each tab having a separate login/password. I have been able to make a successful script that will open 3 separate IE sessions with the correct webpage and login or a script that will open 3 tabs in one session (which I want) but will not login. I have tried _IECreate, IEAttach etc. This is the script I am currently using . #include <IE.au3> Const $navOpenInNewTab = 0x0800 Dim $oIE = _IECreate('http://asag.xxxxxxx.com/AAAA/index.htm') ;$o_IE.Navigate2('http://asag.xxxxxxx.com/apps/yyyyyyy/LogInSAG/login.asp', $navOpenInNewTab) ;$o_IE.Navigate2('http://asag.xxxxxxx.com/apps/yyyyyyy/LogInSAG/login.asp', $navOpenInNewTab) Call ("YYYYYYYSignIn") Func YYYYYYYSignIn () Local $username = _IEGetObjByName ($oIE,"uname") Local $password = _IEGetObjByName ($oIE,"pword") $oIE.Navigate2('http://asag.xxxxxxx.com/apps/xxxxxxx/LogInSAG/login.asp',2048) _IEFormElementSetValue ($username, "xxxxxxx") _IEFormElementSetValue ($password, "xxxxxxx") Send('{Enter}') EndFunc Call ("xxxxxxxSignIn") Func xxxxxxxSignIn () __IENavigate($oIE, "https://soa1gui.xxxxxxx.biz/gateway/NFServlet;jsessionid=1E3B8F6520DE0A1EC914A8ABB7E86341?NFH_MessageId=&NFH_Page=%2fpages%2fsearch%2fsearch.jsp", 1, 0x800) Local $domain = _IEGetObjByName ($oIE,"NF_CustomerID") Local $User_Name = _IEGetObjByName ($oIE,"NF_UserName") Local $Password = _IEGetObjByName ($oIE,"NF_Password") _IEFormElementSetValue ($domain, xxxxxxx") _IEFormElementSetValue ($User_Name, "xxxxxxx") _IEFormElementSetValue ($Password, "xxxxxxx") ;Send('{Enter}') EndFunc
-
I've tried to wrap my head around it but just can't imagine how to embed 2 IE browsers in the same GUI. Here's what I'm doing so far. #include <GuiConstantsEx.au3> #include <windowsconstants.au3> #include <IE.au3> Global $oIE = _IECreateEmbedded() ; Create a simple GUI for our output Global $hGUI = GUICreate("Embedded Web control Test", 1280, 580, (@DesktopWidth - 1280) / 2, (@DesktopHeight - 580) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN, $WS_MAXIMIZEBOX)) Global $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 1100, 500) _IENavigate($oIE, "http://xxxxxxxxxx.com") Global $o_doc = _IEDocGetObj($oIE) $o_doc.DocumentElement.ScrollTop = 140 $o_doc.DocumentElement.ScrollLeft = 170 GUISetState() While GUIGetMsg() <> -3 WEnd
-
Hi friends, Suppose MyProgram is a tabbed program, meaning that it allows for opening multiple files in the same instance. I want to open File1, File2 and File3 in one instance of MyProgram from an AutoIT script. How can I do this? I have read the AutoIT Help File about "ShellExecute" and "Run", but I have found nothing helpful. Thanks for reading my question. Any answer would be very appreciated.
-
Hello guys, I'm trieng to get my script to send arrow left 134 times rapidly to set the type position to a set point, I can't get this to work as {25 134} will send 25 134 times, instead of arrow left. here is a snippet of my code: Send("[url=https://google.com][color=lime][b][/b][/color][/url][right][acronym='TrippingSync is awesome!'][color=grey][sup]Hover over me[/sup][/color][/acronym][/right]") Send(25, 134)I tried several methods, but none seem to work :S Thanks in advance, TrippingSync
-
Hello. First of all, my full code: #include <WinAPI.au3> #include <File.au3> #include <String.au3> Local $aFiles, $IntOrFloat Local $aFileToRead = _WinAPI_GetOpenFileName("Open file to read", "Text Files (*.txt)") Local $aFinalFile = _WinAPI_GetSaveFileName("How do you want to save the file?", "Text Files (*.txt)") Local $sFilenameWithoutExtension = _StringBetween($aFinalFile[2],"",".") Local $sLinesPerLine = InputBox("Lines Per Line", "How many lines per line do you want?","","") Local $sCountLines = _FileCountLines($aFileToRead[2]) If ($sCountLines/$sLinesPerLine) >= 1 Then ; When the division result is a number with decimal, there will be less words in the last file and the script won't create it , therefore I add 1 to the result to prevent a file lack. Am I wrong? For example: if user introduces 3 the operation will be "4/3=1.33" and I need two files, the first "line1,line2,line3" and the second "line4". $IntOrFloat = $sCountLines/$sLinesPerLine Else $IntOrFloat = ($sCountLines/$sLinesPerLine) + 1 EndIf For $i = 1 To $IntOrFloat MsgBox(0,"", "Creating file " & $i) $aFiles = $aFinalFile[1] & "\" & $sFilenameWithoutExtension[0] & "-" & $i & ".txt" _FileCreate($aFiles) FileOpen($aFiles,2) For $a = ( ( ( $i - 1 ) * $sLinesPerLine ) + 1 ) To ( $i * $sLinesPerLine ) FileWrite($aFinalFile[2],FileReadLine($aFileToRead[2], $a) & ",") Next FileClose($aFiles) Next MsgBox(0,"Done","Done")With it I want to read a text file with a lot of lines and I wanna split it in multiple files with multiple lines (of the first file) in each line, separated by commas. For example: the user executes the script and selects a text file to open that contains: Then, the user selects the path and name of the result files. Suppose "C:\result.txt" Finally, the user introduces the number of lines per line (lines of the initial text file to each line of the result text files). Suppose the user enters 2. So far my code works fine. But I tried to code a loop for do (continuing the example): Start first loop repetition.Create "C:\result.-1.txt", and write on it "Line 1 asdf,Line 2 asdf"End first loop repetition.Start second loop repetition.Create "C:\result.-2.txt", and write on it "Line 3 asdf,Line 4 asdf"End second loop repetition.But my code results (continuing the example) in three files created: C:\result.txt that contains "Line 1 asdf,Line 2 asdf,Line 3 asdf,Line 4 asdf,"C:\result.-1.txt that contains nothing.C:\result.-2.txt that contains nothing.Where is the error? I can't understand where is it...
-
Hi, is there a way to convert this Code to an Code which can make more than one Color in one line? Func _GUICtrlRichEdit_WriteLine($hWnd, $sText, $iIncrement = 0, $sAttrib = "", $iColor = -1) ; Count the @CRLFs StringReplace(_GUICtrlRichEdit_GetText($hWnd, True), @CRLF, "") Local $iLines = @extended ; Adjust the text char count to account for the @CRLFs Local $iEndPoint = _GUICtrlRichEdit_GetTextLength($hWnd, True, True) - $iLines ; Add new text _GUICtrlRichEdit_AppendText($hWnd, $sText & @CRLF) ; Select text between old and new end points _GuiCtrlRichEdit_SetSel($hWnd, $iEndPoint, -1) ; Convert colour from RGB to BGR $iColor = Hex($iColor, 6) $iColor = '0x' & StringMid($iColor, 5, 2) & StringMid($iColor, 3, 2) & StringMid($iColor, 1, 2) ; Set colour If $iColor <> -1 Then _GuiCtrlRichEdit_SetCharColor($hWnd, $iColor) ; Set size If $iIncrement <> 0 Then _GUICtrlRichEdit_ChangeFontSize($hWnd, $iIncrement) ; Set weight If $sAttrib <> "" Then _GUICtrlRichEdit_SetCharAttributes($hWnd, $sAttrib) ; Clear selection _GUICtrlRichEdit_Deselect($hWnd) EndFunc
-
Hi, guys I'm in need of a little advice , help with my coding, I currently have 10 tab Gui pages 1-9 all have the same screen layout, on these screens i have a button that needs to access a function to do some workings out, but I don't want to have to copy this out 9 times all with different variable names is there a way to use a function that can be accessed by multiple screens ? working outs is done within the script but the output from this goes to tab one if button on tab one is used and so on for the 9 screens, sorry if this has been answered before or if im not looking at the correct sections of the help file, if your able to help or even point me to the correct section that tells me how to share a function accorss that would be great
-
So I have several functions spread out among different scripts (makes it easier to sort out); Each with some sort of #include, lets say for ex: #include<arrays.au3>. so if in the main script I bring all these scripts together by #including them, then do they over and over #include<array.au3> again and again, unnecessarily bulking the main script up?
-
Hi all, question to those who are familiar with Winhttp, in particular _WinHttpSimpleFormFill() I have a form that I fill out and submit using _WinHttpSimpleFormFill() which then returns a subsequent form based on the first form. How do I then fill out the subsequent form? #include "WinHTTP.au3" $sFile = @ScriptDir & "\test.csv" $sFileHTM = @ScriptDir & "\Form.htm" $hSession = _WinHttpOpen('Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0'); create new session $hConnect = _WinHttpConnect($hSession, "www.server.com") ; connect to server $sHTM = _WinHttpSimpleFormFill($hConnect, "form.cfm", "name:CFForm_2", "name:FileContents", $sFile, "name:import_vendor", "Generic") ;HERE I NEED TO FILL OUT THE SECOND FORM THAT IS RETURNED IN $sHTM If $sHTM Then MsgBox(64 + 262144, "Done!", "Will open returned page in your default browser now." & @CRLF & _ "It should show array of uploaded files below the form.") $hFileHTM = FileOpen($sFileHTM, 2) FileWrite($hFileHTM, $sHTM) FileClose($hFileHTM) ShellExecuteWait($sFileHTM) EndIf Cheers!
-
Hi everyone I trying for more than a hour to get this regular expression right, what I want to do is grab multiple strings inside a table/div on a webpage the problem is to put this to check multiple times for the expressions to capture between (in the example " and "</table") In this example I'm trying to get all the topic names listed on first page of "General Help and Support" from Autoit forum's but limiting the search/capture between '<table class="ipb_table topic_list hover_rows " summary="Topics In This Forum "General Help and Support"" id="forum_table">' and '</table>' (I don't know how to paste this tidy, if some one experienced in the mater can share the secret I'll be grateful ) #include <Array.au3> $pg = InetRead("http://www.autoitscript.com/forum/forum/2-general-help-and-support/",1) If $pg <> '' Then $exp = '(?i)<table class="ipb_table topic_list hover_rows " summary="Topics In This Forum "General Help and Support"" id="forum_table">.*?'& _ '(?:<a itemprop="url" id=".*?" href=".*?" title="(.*?) - started .*?" class="topic_title">)*?.*?</table>' $aTopics = StringRegExp(BinaryToString($pg),String($exp),3) ConsoleWrite(@error&@LF) _ArrayDisplay($aTopics) Else ConsoleWrite("Cannot DL the page"&@LF) EndIf Exit EDIT: Code updated, forgot to add 'BinaryToString' to $pg var
- 12 replies
-
- stringregexp
- div
- (and 5 more)
-
I'm working on a new project that is going to immitate a RPG I play online. It's a pretty simple Isometric/Tile Based project and I am trying to figure out how to target all the controls on the screen (mainly pic controls) so that when I click and drag they all will move in the same fashion. I know I could go through and specifically pick on each control but I was looking for a way to grab them all in a general manner without pointing out each variable name. I figure I could put them all in an array and some how loop through the array but If there is a quicker means to this I would love to know how. I've searched through the forum but I think the words I search are just too general. Any help?
-
While i am waiting for Better Solutions for Finding Multiple @error Cases and React according to them, i am hoping that some1 could explain me what my problem in this (time consuming) function is.. The Idea is that i check for @Errors from the 3 PixelSearch i am doing, and give Message according to it. I am changing Colors In Paint for Every Loop To Test If the Color Searches Are Correct. All Cases are Working Fine, and the Right MsgBoxes are Triggered, Except the Case where all 3 Colors are Missing: HotKeySet("{ESC}", "End") Global $pixelSearchError1 = @error Global $pixelSearchError2 = @error Global $pixelSearchError3 = @error While 1 Sleep(10) $pixelsearch1 = PixelSearch(100,300,200,512,0x0000ff,10) ;Blue $pixelSearchError1 = @error $pixelsearch2 = PixelSearch(250,310,400,512,0xfa0000,10) ;Red $pixelSearchError2 = @error $pixelsearch3 = PixelSearch(500,300,600,512,0x00ff00,10) ;Green $pixelSearchError3 = @error Call("_errorcheck") WEnd Func _errorcheck() Sleep(100) Select ;Check for Blue Color, Then Proceed. Case Not $pixelSearchError1 ;Found Blue MsgBox(0,"Message","Blue Pixel Found!") Select ;Blue Found. Now check for Red Case Not $pixelSearchError2 ;Found Blue and Red MsgBox(0,"Message","Blue and Red Pixel Found!") Select ;Blue and Red found. Now check for Green Case Not $pixelSearchError3 ;Found Blue, Red and Green MsgBox(0,"Message","Blue,Red and Green Pixel Found!") Case $pixelSearchError3 ;Blue, Red But not Green MsgBox(0,"Message","Found Blue, Red But Not Green") EndSelect Case $pixelSearchError2 ;Blue Found, But Not Red MsgBox(0,"Message","Blue Found, But Not Red") Select ;Blue and Red found. Now check for Green Case Not $pixelSearchError3 ;Found Blue, Green But not Red MsgBox(0,"Message","Found Blue, Green But Not Red") Case $pixelSearchError3 ;Blue, But not Red or Green MsgBox(0,"Message","Could only Find Blue") EndSelect EndSelect Case $pixelSearchError1 ;Blue Not Found MsgBox(0,"Message","Blue Pixel Not Found") Select ;Blue Not Found. Now check for Red Case Not $pixelSearchError2 ;Found Red, But not Blue MsgBox(0,"Message","Found Red, But not Blue") Select ;Found Red, But not Blue Now check for Green Case Not $pixelSearchError3 ;Red and Green, but not Blue MsgBox(0,"Message","Red,Green But not Blue") Case $pixelSearchError3 ;Red, But not Blue or Green MsgBox(0,"Message","Could only Find Red") EndSelect Case $pixelSearchError2 ;Could not find Blue or Red MsgBox(0,"Message","Could not Find Blue and Red") Select ;Blue and Red Not found. Now check for Green Case Not $pixelsearch3 ;Only found Green MsgBox(0,"Message","Only found Green") Case $pixelSearchError3 ;Did not Find Blue,Red or Green MsgBox(0,"Message","No Color was found") EndSelect EndSelect EndSelect Sleep(10) EndFunc I Made a Picture that should make it far easier to see where one Select Case Starts and Ends Check the Link Below. http://imageshack.us/f/9/selectcasegreenerror.gif/ I can't see why the Last Case is not working.. When Blue,Red AND Green are Missing i still get the "Only found Green" Please Help Also, Building the Cases Like this takes up allot of Time and Space, so if you have a Easier way please Tell Like: If Not @error 1 And @error 2 And @error 3 Then But i don't think that Works. I probably want to run 5 PixelSearches and that would mean 5 Select an 32 Cases !!!1!!11 So it would be Great if there was another way of doing this If not, Please do still tell what the problem of my Function is
- 16 replies
-
- pixelsearch
- error
- (and 5 more)