Search the Community

Showing results for tags 'if'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Chat
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 24 results

  1. my esteemed autoits, i need your help once again. The bold and italics below are what i will be referring to. I need a message box to exit the script if Cancel is pressed and to continue the script if OK is pressed. I have tried multiple ways to do this to no avail. Can someone please breakdown how i go about this via Message box, and or Input box as I'm sure they will follow the same logic. I appreciate your time and assistance. Example: global $url, $username, $password, $sspassword $url = "https://securegateway.fairview.org" $username = "XXX" $password = "YYY" $sspassword = "ZZZ" #include <Constants.au3> #include <msgboxconstants.au3> ShellExecute ($url) WinWaitActive("window") send($username) send("{tab}") send($password) send("{enter}") msgbox($mb_okcancel, "Wait for the page to load then select OK to continue script", "Wait for the page to load then select OK to continue script") if($idok) send("+{tab 8}") send("{enter}") if ($idcancel) then Exit EndIf
  2. Hello everyone I would like to have some help regarding my issue. I am trying to extract some information from excel sheet, I use _Excel_RangeFind then I get the array for the value then I check the array. In case the array is true the next will be to get some information based on the extracted array if no array because the value is not found it gives a messages box that the value is not found. My problem that the button works for one time only if i tried any value which exist in the sheet it gives me that value not found. I suspect that there is a problem regarding While loop. here is my code #include <GUIConstantsEx.au3> #include <WinAPI.au3> #Include <GuiListBox.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> #include <ExcelConstants.au3> if FileExists ("result.txt") Then Sleep (100) Else readxl() EndIf Global $oExcel = _Excel_Open(False,False) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeFind Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Global $oWorkbook = _Excel_BookOpen($oExcel, "D:\info.xlsx",False,False) If @error Then MsgBox($MB_SYSTEMMODAL, "Excel Error", "Error opening workbook '" & $oWorkbook & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit EndIf Local $lab1 = _Excel_RangeRead($oWorkbook, Default,"B1") Local $lab2 = _Excel_RangeRead($oWorkbook, Default,"C1") Local $lab3 = _Excel_RangeRead($oWorkbook, Default,"D1") Local $lab4 = _Excel_RangeRead($oWorkbook, Default,"E1") Global $sResult1,$sResult2,$sResult3,$sResult4,$sResult5,$sResult6 Global $asKeyWords = stringsplit (FileRead (@ScriptDir & "\result.txt"),@CRLF) Global Const $xlUp = -4162 ;~ _Main() Local $hGUI, $hList, $hInput, $aSelected, $sChosen, $hUP, $hDOWN, $hENTER, $hESC Local $sCurrInput = "", $aCurrSelected[2] = [-1, -1], $iCurrIndex = -1, $hListGUI = -1 $hGUI = GUICreate("Rimo System", 253, 270, 192, 124) Global $hInput = GUICtrlCreateInput("", 24, 48, 169, 21) Global $Label1 = GUICtrlCreateLabel("Rimo System", 80, 16, 150, 25) GUICtrlSetFont(-1, 14, 800, 0, "MS Serif") Global $Input2 = GUICtrlCreateInput("", 72, 144, 161, 21) Global $Input3 = GUICtrlCreateInput("", 72, 176, 161, 21) Global $Input4 = GUICtrlCreateInput("", 72, 208, 161, 21) Global $Input5 = GUICtrlCreateInput("", 72, 240, 161, 21) $Input6 = GUICtrlCreateInput("", 72, 272, 161, 21) $Input7 = GUICtrlCreateInput("", 72, 304, 161, 21) $Button1 = GUICtrlCreateButton("Get Info", 72, 88, 89, 33) $Label2 = GUICtrlCreateLabel("Label2", 16, 144, 36, 17) GUICtrlSetData( -1,$lab1) $Label3 = GUICtrlCreateLabel("Label3", 16, 176, 36, 17) GUICtrlSetData( -1,$lab2) $Label4 = GUICtrlCreateLabel("Label4", 16, 208, 36, 17) GUICtrlSetData( -1,$lab3) $Label5 = GUICtrlCreateLabel("Label5", 16, 240, 36, 17) GUICtrlSetData( -1,$lab4) $Label6 = GUICtrlCreateLabel("", 16, 272, 36, 17) $Label7 = GUICtrlCreateLabel("", 16, 304, 36, 17) $Button2 = GUICtrlCreateButton("Cancel", 112, 416, 121, 25) GUISetState(@SW_SHOW, $hGUI) Global $sSearch = guictrlread ($hInput) $hUP = GUICtrlCreateDummy() $hDOWN = GUICtrlCreateDummy() $hENTER = GUICtrlCreateDummy() $hESC = GUICtrlCreateDummy() Dim $AccelKeys[4][2] = [["{UP}", $hUP], ["{DOWN}", $hDOWN], ["{ENTER}", $hENTER], ["{ESC}", $hESC]] GUISetAccelerators($AccelKeys) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Button2 Exit Case $Button1 Global $aResult = _Excel_RangeFind($oWorkbook, guictrlread($hInput) ,"A2:A2000") Global $aExtract = _ArrayExtract($aResult, 0, 0, 2, 2) if _elementExists($aExtract,0) Then getdata() Else MsgBox(0,"","Value Does Not Exist") EndIf Case $hESC If $hListGUI <> -1 Then ; List is visible. GUIDelete($hListGUI) $hListGUI = -1 Else ExitLoop EndIf Case $hUP If $hListGUI <> -1 Then ; List is visible. $iCurrIndex -= 1 If $iCurrIndex < 0 Then $iCurrIndex = 0 EndIf _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndIf Case $hDOWN If $hListGUI <> -1 Then ; List is visible. $iCurrIndex += 1 If $iCurrIndex > _GUICtrlListBox_GetCount($hList) - 1 Then $iCurrIndex = _GUICtrlListBox_GetCount($hList) - 1 EndIf _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndIf Case $hENTER If $hListGUI <> -1 And $iCurrIndex <> -1 Then ; List is visible and a item is selected. $sChosen = _GUICtrlListBox_GetText($hList, $iCurrIndex) EndIf Case $hList $sChosen = GUICtrlRead($hList) EndSwitch Sleep(10) $aSelected = _GetSelectionPointers($hInput) If GUICtrlRead($hInput) <> $sCurrInput Or $aSelected[1] <> $aCurrSelected[1] Then ; Input content or pointer are changed. $sCurrInput = GUICtrlRead($hInput) $aCurrSelected = $aSelected ; Get pointers of the string to replace. $iCurrIndex = -1 If $hListGUI <> -1 Then ; List is visible. GUIDelete($hListGUI) $hListGUI = -1 EndIf $hList = _PopupSelector($hGUI, $hListGUI, _CheckInputText($sCurrInput, $aCurrSelected)) ; ByRef $hListGUI, $aCurrSelected. EndIf If $sChosen <> "" Then GUICtrlSendMsg($hInput, 0x00B1, $aCurrSelected[0], $aCurrSelected[1]) ; $EM_SETSEL. _InsertText($hInput, $sChosen) $sCurrInput = GUICtrlRead($hInput) GUIDelete($hListGUI) $hListGUI = -1 $sChosen = "" EndIf WEnd GUIDelete($hGUI) Func _CheckInputText($sCurrInput, ByRef $aSelected) Local $sPartialData = "" If (IsArray($aSelected)) And ($aSelected[0] <= $aSelected[1]) Then Local $aSplit = StringSplit(StringLeft($sCurrInput, $aSelected[0]), " ") $aSelected[0] -= StringLen($aSplit[$aSplit[0]]) If $aSplit[$aSplit[0]] <> "" Then For $A = 1 To $asKeyWords[0] If StringLeft($asKeyWords[$A], StringLen($aSplit[$aSplit[0]])) = $aSplit[$aSplit[0]] And $asKeyWords[$A] <> $aSplit[$aSplit[0]] Then $sPartialData &= $asKeyWords[$A] & "|" EndIf Next EndIf EndIf Return $sPartialData EndFunc ;==>_CheckInputText Func _PopupSelector($hMainGUI, ByRef $hListGUI, $sCurr_List) Local $hList = -1 If $sCurr_List = "" Then Return $hList EndIf $hListGUI = GUICreate("", 280, 160, 23, 62, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_MDICHILD), $hMainGUI) $hList = GUICtrlCreateList("", 0, 0, 170, 150, BitOR(0x00100000, 0x00200000)) GUICtrlSetData($hList, $sCurr_List) GUISetControlsVisible($hListGUI) ; To Make Control Visible And Window Invisible. GUISetState(@SW_SHOWNOACTIVATE, $hListGUI) Return $hList EndFunc ;==>_PopupSelector Func _InsertText(ByRef $hEdit, $sString) #cs Description: Insert A Text In A Control. Returns: Nothing #ce Local $aSelected = _GetSelectionPointers($hEdit) GUICtrlSetData($hEdit, StringLeft(GUICtrlRead($hEdit), $aSelected[0]) & $sString & StringTrimLeft(GUICtrlRead($hEdit), $aSelected[1])) Local $iCursorPlace = StringLen(StringLeft(GUICtrlRead($hEdit), $aSelected[0]) & $sString) GUICtrlSendMsg($hEdit, 0x00B1, $iCursorPlace, $iCursorPlace) ; $EM_SETSEL. EndFunc ;==>_InsertText Func _GetSelectionPointers($hEdit) Local $aReturn[2] = [0, 0] Local $aSelected = GUICtrlRecvMsg($hEdit, 0x00B0) ; $EM_GETSEL. If IsArray($aSelected) Then $aReturn[0] = $aSelected[0] $aReturn[1] = $aSelected[1] EndIf Return $aReturn EndFunc ;==>_GetSelectionPointers Func GUISetControlsVisible($hWnd) ; By Melba23. Local $aControlGetPos = 0, $hCreateRect = 0, $hRectRgn = _WinAPI_CreateRectRgn(0, 0, 0, 0) Local $iLastControlID = _WinAPI_GetDlgCtrlID(GUICtrlGetHandle(-1)) For $i = 3 To $iLastControlID $aControlGetPos = ControlGetPos($hWnd, '', $i) If IsArray($aControlGetPos) = 0 Then ContinueLoop $hCreateRect = _WinAPI_CreateRectRgn($aControlGetPos[0], $aControlGetPos[1], $aControlGetPos[0] + $aControlGetPos[2], $aControlGetPos[1] + $aControlGetPos[3]) _WinAPI_CombineRgn($hRectRgn, $hCreateRect, $hRectRgn, 2) _WinAPI_DeleteObject($hCreateRect) Next _WinAPI_SetWindowRgn($hWnd, $hRectRgn, True) _WinAPI_DeleteObject($hRectRgn) EndFunc Func _elementExists($array, $element) If $element > UBound($array)-1 Then Return False ; element is out of the array bounds Return True ; element is in array bounds EndFunc Func getdata() ;~ Local $sResult1 = _Excel_RangeRead($oWorkbook, Default,StringReplace(StringReplace ($aExtract[0],"$",""),"A","B")) ;~ Local $sResult2 = _Excel_RangeRead($oWorkbook, Default,StringReplace(StringReplace ($aExtract[0],"$",""),"A","C")) ;~ Local $sResult3 = _Excel_RangeRead($oWorkbook, Default,StringReplace(StringReplace ($aExtract[0],"$",""),"A","D")) ;~ Local $sResult4 = _Excel_RangeRead($oWorkbook, Default,StringReplace(StringReplace ($aExtract[0],"$",""),"A","E")) ;~ Local $sResult5 = _Excel_RangeRead($oWorkbook, Default,StringReplace(StringReplace ($aExtract[0],"$",""),"A","F")) ;~ Local $sResult6 = _Excel_RangeRead($oWorkbook, Default,StringReplace(StringReplace ($aExtract[0],"$",""),"A","G")) guictrlsetdata($Input2,$sResult1) guictrlsetdata($Input3,$sResult2) guictrlsetdata($Input4,$sResult3) guictrlsetdata($Input5,$sResult4) guictrlsetdata($Input6,$sResult5) guictrlsetdata($Input7,$sResult6) _Excel_Close($oExcel,Default,True) EndFunc Func readxl() Global $oExcel = _Excel_Open(False,False) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeFind Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Global $oWorkbook = _Excel_BookOpen($oExcel, "D:\info.xlsx",False,False) LOcal Const $xlUp = -4162 With $oWorkbook.ActiveSheet ; process active sheet $oRangeLast = .UsedRange.SpecialCells($xlCellTypeLastCell) ; get a Range that contains the last used cells $iRowCount = .Range(.Cells(1, 1), .Cells($oRangeLast.Row, $oRangeLast.Column)).Rows.Count ; get the the row count for the range starting in row/column 1 and ending at the last used row/column $iLastCell = .Cells($iRowCount + 1, "B").End($xlUp).Row ProgressOn("Copying Cells", "Copying Cells progress", "0%") For $i = 2 to $iLastCell Local $total = Int(($i/$iLastCell)*100) Local $sResult3 = _Excel_RangeRead($oWorkbook, Default, "A" & $i) FileWriteLine("result.txt",$sResult3) ProgressSet(($i/$iLastCell)*100, $total & "%") Next ;~ FileWrite("result.txt",$sResult3) ProgressSet(100, "Done", "Complete") Sleep (1500) ProgressOff() _Excel_Close($oExcel,Default,True) EndWith EndFunc
  3. I'm new to Auotit but I have built a simple script that "runs" a different "batch" file based on certain days of the workweek. The script works now, but I was wanting to eliminate the need for a manual date entry. For example "First Batch' needs to run every Tuesday thru Thursday however "Second Batch" needs to run only on Friday and "Third Batch" needs to run only on Monday. In addition the 1st batch file runs on Tuesday, say 06/06 (the "FW" section) but then needs to actually report (the F4 date) the next weekday so this Batch actually needs 2 dates verified. What I'm trying to do is when the script is initiated it gets the date, verifies if and which weekday it is and in turn goes to and runs the appropriate "Batch' file. I've found ways to verify weekdays but can't find anything to do all of the above. Any help is MUCH appreciated. ;P10 ShellExecute("C:\Program Files (x86)\Ericom Software\PowerTerm Enterprise\Sessions\mir00p10.PTS") WinWait('(A) Soutwest P10 : PowerTerm Pro Enterprise Suite') WinActivate('(A) Soutwest P10 : PowerTerm Pro Enterprise Suite') Send('$Login) Sleep(3000) Send('{Enter}') Sleep(3000) Send($Password) Send('{Enter}') Sleep(3000) ; ****First Batch file run Send('Batch') Sleep(3000) Send('{Enter}') Send('FW') Send('{Enter}') Send('{DOWN}') Send($Date) Send('{Enter}') Send('{Enter}') Send($Date) Send('{F9}') Send('Y') Sleep(3000) Send('{Enter}') Send('{F4}') Send('Y') Sleep(3000) Send('{Enter}') Send($Date) Send('{Enter}') Send('0620') Send('{Enter}') SEND('{!}SW0410PM.FWR') Send('{Enter}') Sleep(3000) Send('Y') Send('{Enter}') Sleep(3000) Send('{F9}') Sleep(3000) ; ****Second Batch file run Send('Batch') Sleep(3000) Send('{Enter}') Send('FW') Send('{Enter}') Send('{DOWN}') Send($Date) Send('{Enter}') Send('{Enter}') Send($Date) Send('{F9}') Send('Y') Sleep(3000) Send('{Enter}') Send('{F4}') Send('Y') Sleep(3000) Send('{Enter}') Send($Date) Send('{Enter}') Send('0620') Send('{Enter}') SEND('{!}SO0411AM.FWR') Send('{Enter}') Sleep(3000) Send('Y') Send('{Enter}') Sleep(3000) Send('{F9}') Sleep(3000) ; ****Third Batch file run Send('Batch') Sleep(3000) Send('{Enter}') Send('FW') Send('{Enter}') Send('{DOWN}') Send($Date) Send('{Enter}') Send('{Enter}') Send($Date) Send('{F9}') Send('Y') Sleep(3000) Send('{Enter}') Send('{F4}') Send('Y') Sleep(3000) Send('{Enter}') Send($Date) Send('{Enter}') Send('0620') Send('{Enter}') SEND('{!}SW0411AM.LOA') Send('{Enter}') Sleep(3000) Send('Y') Send('{Enter}') Sleep(3000) Send('{F9}') Sleep(3000) Send('EXIT')
  4. can anyone help me plz how can you put mouseclick in if statement or is it possible example: if Mouseclick = "left" then Tooltip(" you click left mouse") thank you
  5. I know on other languages when you try to use a string like this Global $sString = "Some String" If ($sString) Then ; ... EndIf The compiler will fail because string cannot be used in an expression where it needs a bool (something along those lines). But I see instances in other languages where using $sString in an expression will work and implicitly use the length of the string (or because there is some value in that variable). I'm wondering why AutoIt doesn't do the same. If the $sString is used like in my example (or some other expression where it wants a bool type) implicitly use the length of the string instead of the converting to 0?
  6. Hello, i am creating a program that 1. it will check if the computer is connected to the internet 2. will display a message if it is connected 3.if not connected then it will continue to check until the computer connects to the internet then it runs the function which would have been executed if the computer was connected to the internet. what i tried. i connected my computer to the internet and run the code. Which displayed the msgbox that am connected i later turn my internet off and run the cold , i saw it running in process list.. i waited for 5 minutes and it was still waiting for internet connection (running), but when i turned the internet on and got internet connectivity, the app just close without displaying the msg that am connected. Please need help where i went wrong. or if anything should be added. this is the code #AutoIt3Wrapper_icon=1.ico $ping = Ping("www.google.com") If Not @error Then MsgBox("", "AlexFing", "You are connect") Else Do $ping = Ping("www.google.com") Until Not @error EndIf
  7. Is there possibility to do it like this? Cause as I see compiler doesn't see If statement in case of #include functions. It includes these two files all time. If $var == True Then #include 'func/funcsByTabs/main_Moda.au3' Else #include 'func/funcsByTabs/main_Others.au3' EndIf
  8. Okay so here's the problem. I have a script I'm testing out where I want it to search for a certain color and if it finds that certain color I want it to check for a second color. I only want it to check for the second color after checking for the first color. If it finds the first color it will check for the second color and whether or not that second color is present it will cause certain actions to be undertaken. Well at least that's what I want it to do. I want this all to be done in a loop where it's constantly checking for the first color. However, once it does find the first color and it executes one of the actions regarding the second, I want the program to quit. I'm having trouble figuring out how to nest conditional statements here. If anyone could help me out it would be much appreciated. HotKeySet("{ESC}", "Terminate") HotKeySet("!c", "getColor") HotKeySet("!l", "ClickPositions") Global $color Global $interval $interval = "10000" MsgBox (0, "Starting Up", "Starting, use ESC to quit, Alt + C to get color, and Alt + L to begin Test") Func Terminate() Exit 1 EndFunc Func ClickPositions() MsgBox(0, "Beginning Test", "Hope to god this works") While 1 $Coords = PixelSearch(1006, 48, 1074, 79, 0xECECEC) $1stcoords = PixelSearch(930, 621, 1066, 649, 0x8A211E) $point = MouseGetPos() $posx = Random(930, 1066) $posy = Random(621, 649) $clicklogx = Random(1076, 1093) $clicklogy = Random(38, 54) If IsArray($Coords) Then ;check to see if the first color is there If IsArray($1stcoords) Then ;if it is check for the second color and if that one is there: MouseClick( "left", $point[0], $point[1], 1) If IsArray(<>$1stcoords) Then ;if the second color is not there: MouseClick("left", $clicklogx, $clicklogy, 1, Random(1000, 2500)) Sleep(3000) MouseClick( "left" , $posx, $posy, 1, Random ( 1000 , 2500)) EndIf EndIf EndIf Sleep(2000) WEnd EndFunc While 1 Sleep(250) WEnd
  9. Hi all, I'm going crazy while I try and work out why a fairly simply if condition isn't working. I will try and explain it clearly, in the hope someone can find out the cause. The portion of the script for these if conditions is copied in below. The first PixelGetColor func is denoted in Screenshot 1, the RED dot signifies where the color is extracted from. The second PixelGetColor func is denoted in Screenshot 2, the YELLOW dot signifies where the color is extracted from. The script is tested for 3 scenarios, where 1. no resource is found (Screenshot 1), 2. multiple resources are found (Screenshot 2), and 3. only 1 resource is found (Screenshot 3). This application is being run via RDP hence I can't access the controls, and therefore relying on the pixel colours. The issue is, for all three scenarios, only the first If condition's first result is shown, even though the actual program shows the 3 screenshots for each of the three scenarios. Any ideas where I'm going wrong? If PixelGetColor(697, 446, 0xF0F0F0) Then ;If resource is not found, cancel out Sleep(200) MsgBox(64, 'Error', 'Resource is not found, therefore this pool will not be saved and will cancel out. Click OK to continue.') _Excel_RangeWrite($oWorkbook, 'CHFT Pools & RTE Rules', 'Fail', 'I' & $ColumnIRow) _Excel_RangeWrite($oWorkbook, 'CHFT Pools & RTE Rules', 'Resource not found. ' & $Notes, 'J' & $ColumnIRow) Sleep(500) WinActivate('Scheduling Help') Sleep(500) Send('{ENTER}') ;Click OK Sleep(500) Send('{SHIFTDOWN}{TAB}{SHIFTUP}{ENTER}') ;Click Cancel Sleep(500) Send('{SHIFTDOWN}{TAB}{TAB}{TAB}{TAB}{SHIFTUP}{ENTER}') ;Click Close Sleep(500) WinActivate('Scheduling: DB Flex Rule Tool - Inbox Pool Routing') Sleep(500) Send('{TAB}{ENTER}') ;Click Yes Sleep(500) WinActivate('Rules for Pool') Sleep(500) Send('{TAB}{TAB}{TAB}{ENTER}') ;Click Cancel Sleep(500) MouseClick('Primary', 1259, 653, 1) ;Click Cancel Else Send('{TAB}{TAB}{DOWN}') ;Find resource If PixelGetColor(725, 383, 0x3399FF) Then ;If there are multiple resources, cancel out Sleep(200) MsgBox(64, 'Error', 'There are multiple resources, therefore this pool will not be saved and will cancel out. Click OK to continue.') _Excel_RangeWrite($oWorkbook, 'CHFT Pools & RTE Rules', 'Redo', 'I' & $ColumnIRow) _Excel_RangeWrite($oWorkbook, 'CHFT Pools & RTE Rules', 'Multiple resources. ' & $Notes, 'J' & $ColumnIRow) Sleep(500) WinActivate('Scheduling Help') Sleep(500) Send('{TAB}{TAB}{ENTER}') ;Click Cancel Sleep(500) Send('{SHIFTDOWN}{TAB}{TAB}{TAB}{TAB}{SHIFTUP}{ENTER}') ;Click Close Sleep(500) WinActivate('Scheduling: DB Flex Rule Tool - Inbox Pool Routing') Sleep(500) Send('{TAB}{ENTER}') ;Click Yes Sleep(500) WinActivate('Rules for Pool') Sleep(500) Send('{TAB}{TAB}{TAB}{ENTER}') ;Click Cancel Sleep(500) MouseClick('Primary', 1259, 653, 1) ;Click Cancel Else ;Select the resource Send('{ENTER}') ;Select Order Physician MsgBox(0, '', 'save button clicks now') _Excel_RangeWrite($oWorkbook, 'CHFT Pools & RTE Rules', 'Complete', 'I' & $ColumnIRow) _Excel_RangeWrite($oWorkbook, 'CHFT Pools & RTE Rules', 'Success. ' & $Notes, 'J' & $ColumnIRow) ;Send('{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}') ;Click Save EndIf EndIf
  10. Hi, I want to tell pixelsearch to search for red color shades in for example 5 different x,y,h,w of the screen. If color red was not found in these 5 area, then do something. I wrote this, but it's working only if the first case is not found. Is select a good choice? or it's better to use switch or if or something else? ٍEdit: all "do something"s are same function. (search for red color untill in these 5 areas, it couldnot find red color, then if it couldn't find red color, perform that 1 function) Thanks Select Case 1 $color1 = PixelSearch(67, 614, 77, 617, 0xE62121, 10) If @error Then do something... EndIf Case 2 $color2 = PixelSearch(165, 614, 175, 617, 0xE62121, 10) If @error Then do something... EndIf Case 3 $color3 = PixelSearch(265, 614, 275, 617, 0xE62121, 10) If @error Then do something... EndIf Case 4 $color4 = PixelSearch(365, 614, 375, 617, 0xE62121, 10) If @error Then do something... EndIf Case 5 $color5 = PixelSearch(465, 614, 475, 617, 0xE62121, 10) If @error Then do something... EndIf EndSelect
  11. so right now i have a small project and i wanted to print this text out every second. i have made a random number for the sleep function. but when i want to print out with the while loop it just doesn't work. Run("notepad.exe") Sleep(1000) Local $rndSleep = Int (Random(180000,240000,1000)) While $rndSleep <> 0 $rndSleep - 1 If Mod ( $rndSleep, 1000 ) == 0 Then Send("This note will show the sleeptime before closing the tabs, you got " & $rndSleep & " seconds left.") EndIf WEnd plis halp me
  12. #include <Misc.au3> While 1 If _IsPressed(59) Then Send("{B}") MouseDown("left") Else Send("{B}") MouseUp("left") EndIf WEnd I want the script to do this: - if I press "Y", send "B" once and hold left click down until i release "Y". - if I take my hands off of "Y" key, then send "B" once again and release left click. but the script I made has problems. when I run the script, it starts sending "B" repeatedly, and my left click won't work. I'm not smart enough to figure out what the problem is... please help me! sorry for bad English.
  13. Basically i am trying to make a script that detects if the currently active window is 1920 x 1080 or bigger. If it detects a window that is active, that is indeed that size. It will do some stuff. The problem i am having is that it is detecting my desktop whenever i click on my desktop, so it's doing stuff when i don't want it to. So all i need to know, is how can i do a simple check to see if a window = a title. Here is what i have so far $wintitledesktop = WinGetTitle("[ACTIVE]") If not $wintitledesktop = "Program Manager" Then ;does stuff endif Program Manager is what my desktop is called btw. The problem with that code is that the script is still detecting the desktop and doing the code. In case you need the whole section of the code, here it is. $winsizecheck1 = WinGetClientSize("[ACTIVE]") $wintitledesktop = WinGetTitle("[ACTIVE]") If WinActive("[ACTIVE]") Then sleep(100) If $winsizecheck1[0] >= 1920 Then If $winsizecheck1[1] >= 1080 Then If not $wintitledesktop = "Program Manager" Then $gamesfolderstate = WinGetState($gamesfolder) If WinExists($gamesfolder) Then If Not BitAND($gamesfolderstate, 16) Then WinSetState($gamesfolder,"",@SW_MINIMIZE) EndIf EndIf EndIf EndIf EndIf EndIf
  14. Hello reader, I would like to know if and/or how it is possible to check if recycle bin has files or folders in it. So my code would eventually be like this (if these were the commands) if fileshere then FileRecycleEmpty() ;empties recylce bin endif
  15. Hi all, I'm looking for some help to finish my last bit of code. So far my code scrapes an XML from a webpage and then sends and email on a trigger but what i need to do is find a way to see if a string is in the XML. example Global $Site = IniRead("settings.ini", "Site", "web", "") ;============================================================ while 1 if @HOUR >= 05 and @HOUR <= 18 then $sXML = BinaryToString(InetRead($Site)) $Day = StringRegExpReplace($sXML, '(?is).*<availability.*?day="([^"]+).*</availability.*', '$1') $4WD = StringRegExpReplace($sXML, '(?is).*?<members.*? name="4WD Operations".*?day="([^"]+).*</members.*', '$1') $ARS = StringRegExpReplace($sXML, '(?is).*?<members.*? name="Advance Rescue Shorting".*?day="([^"]+).*</members.*', '$1') $ART = StringRegExpReplace($sXML, '(?is).*?<members.*? name="Advanced Rescue Tools Equipment".*?day="([^"]+).*</members.*', '$1') $ASO = StringRegExpReplace($sXML, '(?is).*?<members.*? name="Air Search Observer".*?day="([^"]+).*</members.*', '$1') check("Day Crew", $day) check("4WD Operations",$4WD) check("Advance Rescue Shorting",$ARS) check("Advanced Rescue Tools Equipment",$ART) check("Air Search Observer",$ASO) sleep(3000000) ; Sleep for 50 mins cause the extra 10 mins is outside of the if EndIf WEnd func check($Class, $ScrapeValue) $Num = IniRead("settings.ini", "Numbers", $class, "") if $Num == 0 Then EndIf if $ScrapeValue < $Num then box($class, $ScrapeValue, $Num) EndFunc func box ($class, $ScrapeValue, $Num) MsgBox(6,"test", $class & $ScrapeValue &$Num ) EndFunc So right now if I open the settings.ini and made day = 2 and the XML site has day as 1 the message box shows message. (great) But if <members.*? name="4WD Operations".*?day="([^"]+).*</members is not in the XML is shows the whole XML. So i need a way to do a if $class not in $sXML skip else keep running script Global $Site = IniRead("settings.ini", "Site", "web", "") ;============================================================ while 1 if @HOUR >= 05 and @HOUR <= 18 then $sXML = BinaryToString(InetRead($Site)) $Day = StringRegExpReplace($sXML, '(?is).*<availability.*?day="([^"]+).*</availability.*', '$1') $4WD = StringRegExpReplace($sXML, '(?is).*?<members.*? name="4WD Operations".*?day="([^"]+).*</members.*', '$1') $ARS = StringRegExpReplace($sXML, '(?is).*?<members.*? name="Advance Rescue Shorting".*?day="([^"]+).*</members.*', '$1') $ART = StringRegExpReplace($sXML, '(?is).*?<members.*? name="Advanced Rescue Tools Equipment".*?day="([^"]+).*</members.*', '$1') $ASO = StringRegExpReplace($sXML, '(?is).*?<members.*? name="Air Search Observer".*?day="([^"]+).*</members.*', '$1') check("Day Crew", $day) check("4WD Operations",$4WD) check("Advance Rescue Shorting",$ARS) check("Advanced Rescue Tools Equipment",$ART) check("Air Search Observer",$ASO) sleep(3000000) ; Sleep for 50 mins cause the extra 10 mins is outside of the if EndIf WEnd func check($Class, $ScrapeValue) $Num = IniRead("settings.ini", "Numbers", $class, "") if $Num == 0 Then EndIf if $Class Not In $sXML ; At this point I need to see if the Class is in the XML if its not skip EndIf ElseIf $ScrapeValue < $Num then box($class, $ScrapeValue, $Num) EndFunc func box ($class, $ScrapeValue, $Num) MsgBox(6,"test", $class & $ScrapeValue &$Num ) EndFunc any ideas ?
  16. So I need some help... basically all I want to do is have Autoit generate a random number between 1 and 3 and then have an if statement that reads the random number... and lets say if it = 3 it will say the number 3 in a msgbox (like this) sleep(500) Random(1,3) If Random = 2 Then MsgBox(0,"","2") EndIf If Random = 1 Then MsgBox(0,"","1") EndIf If Random = 3 Then MsgBox(0,"","3") EndIf can anyone help me? (thanks in advance!)
  17. Hello, I am relatively new to autoit (and this type of programming in general, typically do front end web dev). I have been tasked with writing some scripts to login to, navigate, and download files from some private websites. I have been hacking my way through these projects with plenty of wrong turns, cursing, and confusion. I currently have a script that works, but utilizes some rather lengthy Sleep times to manage varying page loading times. During page loads, there will often be text that says "Page Loading" I am trying to write some code to check whether this exists after particular steps, then if it does sleep for a few seconds, then check again until it no longer exists (page has loaded) then proceed. This is what I was trying based on sample code that I've seen throughout my google searches. It doesn't seem to work correctly, can someone point out what I'm doing wrong, or provide links to a 'for dummies' explanation of how to do what I'm trying to do? $body = _IEBodyReadHTML($oIE) While If StringInStr($body, "Page Loading")== 1 Then Sleep(5000) Else EndIf WEndThank you for your insight.
  18. Hey can anyone help me with the right syntax of writing 2 IF conditionals before completing an action? (two IFs must be completed so the action be performed) should i write it " If(....) and If(......) then " or " If(....) , If(....) then " or these are wrong ways? SugarBall
  19. Global $i = 3;Assign 3 to variable $i ConsoleWrite("count is:"&$i&@CRLF);It says variable value is 3 If Not $i=45 Then;The bug is here ConsoleWrite("count is:"&$i&@CRLF);This should say count is:3 but it don't because of the bug EndIfThis is a very simplified example of the bug, anyone knows why this happen?
  20. Hello all, i have another question. My script not working, how is it correct ? Need script for this: If is Input 2 empty then call function odoslat() Else call function obrazok2() Thanks for help Func obrazok1() Local $oForm = _IEFormGetObjByName ($oIE, "formpridani") $obrazok1 = GUICtrlRead($Input1) $obrazok2 = GUICtrlRead($Input2) $oUpload = _IEGetObjByName($oForm, "souborp") Sleep (500) _IEAction($oUpload, "focus") Send("{SPACE}") Sleep (500) Send($obrazok1) Send("{Enter}") If $obrazok2 = (0) Then Call ("odoslat") Else Call ("obrazok2") EndIf EndFunc
  21. Is there a way to create an IF loop comparing multiple values in a single statement? Something like below. IF $x <> "1" OR "2" OR "3" Then ConsoleWrite("Success") EndIf Thanks!
  22. Hi, I'm wondering if it is possible to exitloop base on a value in an inifile? If IniRead($iniwarning, "Master", "msg") = "" then exitloop Somthing like the "code" over?
  23. Hello, i try to parse some info from one site, just for fun and experience. But have some problems, while parsing can't find needed formula, to make it more easy and performance, can someone help. Critics allowed, i know code is very bad.. sorry long time no sleep. Trouble part: I have removed coz question is to stupid ^^ sry for spam. Thanks in any case.
  24. Hello, i'm making this tool to convert "English" letters To "Arabic" letters but i have some problems in reading "input1" Notice: it isn't translator!! here's the script: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> $Form1 = GUICreate("Form1", 257, 155, 339, 282) $Input1 = GUICtrlCreateInput("", 32, 32, 201, 21) $Input2 = GUICtrlCreateInput("", 32, 88, 201, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_RIGHT)) $Label1 = GUICtrlCreateLabel("English", 104, 8, 38, 17) $Button1 = GUICtrlCreateButton("Ta7weel", 96, 120, 75, 25) $Label2 = GUICtrlCreateLabel("Franco", 104, 64, 37, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Local $Read1 = GUICtrlRead($Input1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; If StringInStr($Read1, "3") Then _GUICtrlEdit_AppendText($Input2, "ع") EndIf If StringInStr($Read1, "3'") Then _GUICtrlEdit_AppendText($Input2, "غ") EndIf If StringInStr($Read1, "5") Then _GUICtrlEdit_AppendText($Input2, "خ") EndIf If StringInStr($Read1, "7") Then _GUICtrlEdit_AppendText($Input2, "ح") EndIf If StringInStr($Read1, "9") Then _GUICtrlEdit_AppendText($Input2, "ص") EndIf If StringInStr($Read1, "a") Then _GUICtrlEdit_AppendText($Input2, "ا") EndIf If StringInStr($Read1, "b") Then _GUICtrlEdit_AppendText($Input2, "ب") EndIf If StringInStr($Read1, "c") Then _GUICtrlEdit_AppendText($Input2, "س") EndIf If StringInStr($Read1, "d") Then _GUICtrlEdit_AppendText($Input2, "د") EndIf If StringInStr($Read1, "e") Then _GUICtrlEdit_AppendText($Input2, "ي") EndIf If StringInStr($Read1, "f") Then _GUICtrlEdit_AppendText($Input2, "ف") EndIf If StringInStr($Read1, "g") Then _GUICtrlEdit_AppendText($Input2, "ج") EndIf If StringInStr($Read1, "h") Then _GUICtrlEdit_AppendText($Input2, "ه") EndIf If StringInStr($Read1, "i") Then _GUICtrlEdit_AppendText($Input2, "ي") EndIf If StringInStr($Read1, "j") Then _GUICtrlEdit_AppendText($Input2, "ج") EndIf If StringInStr($Read1, "k") Then _GUICtrlEdit_AppendText($Input2, "ك") EndIf If StringInStr($Read1, "l") Then _GUICtrlEdit_AppendText($Input2, "ل") EndIf If StringInStr($Read1, "m") Then _GUICtrlEdit_AppendText($Input2, "م") EndIf If StringInStr($Read1, "n") Then _GUICtrlEdit_AppendText($Input2, "ن") EndIf If StringInStr($Read1, "o") Then _GUICtrlEdit_AppendText($Input2, "و") EndIf If StringInStr($Read1, "p") Then _GUICtrlEdit_AppendText($Input2, "ب") EndIf If StringInStr($Read1, "q") Then _GUICtrlEdit_AppendText($Input2, "ق") EndIf If StringInStr($Read1, "r") Then _GUICtrlEdit_AppendText($Input2, "ر") EndIf If StringInStr($Read1, "s") Then _GUICtrlEdit_AppendText($Input2, "س") EndIf If StringInStr($Read1, "t") Then _GUICtrlEdit_AppendText($Input2, "ت") EndIf If StringInStr($Read1, "u") Then _GUICtrlEdit_AppendText($Input2, "و") EndIf If StringInStr($Read1, "v") Then _GUICtrlEdit_AppendText($Input2, "ف") EndIf If StringInStr($Read1, "w") Then _GUICtrlEdit_AppendText($Input2, "و") EndIf If StringInStr($Read1, "x") Then _GUICtrlEdit_AppendText($Input2, "ق") EndIf If StringInStr($Read1, "y") Then _GUICtrlEdit_AppendText($Input2, "ي") EndIf If StringInStr($Read1, "z") Then _GUICtrlEdit_AppendText($Input2, "ز") EndIf ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EndSwitch WEnd the script working well. but the problem is arranging the output letters e.g. i want convert this word "fas"... it must be "فاس" but it converted to "افس". problem reason: autoit has read "A" letter before "F" & "S" so output will be arranged as reading. what i need: convert and arragne "Arabic" letters wherever it is as "English" letters. !! e.g. A= 1 B= 2 C= 3 D=4 Text what will be converted: "CBDA" so it must be convert like that "3241" but in the script above it converting like that "123". sorry for bad english and thanks for help Resolved: Edit: resolved