Jump to content

kakarotsaiyan

Members
  • Posts

    15
  • Joined

  • Last visited

Recent Profile Visitors

127 profile views

kakarotsaiyan's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. @FrancescoDiMuro Its an software for categorizing patients and labelling them, its pretty simple and color coded. i use a script to make my work easier as all it does is find for a uncategorized profile(red color) and shows No. of uncategorized ones as a message and functions like controlsend didn't work on it.
  2. @BrewManNH i am a noob, i just got some of my work done with basic functions but i want to make my scripts run in the background hence i searched for a pixelsearch that worked on inactive windows and found this script- i tried it and it worked for my scripts but the problem was to get it search a specific area.I read that a person had a similar problem and he solved it using _winapi_bitblt so i asked my friend who also uses autoit and he said i was right in using that and should offset the x and y values to get the desired area but i couldnt get it to work. since i didnt want to bother him anymore i posted it here hoping some one would help me understand.
  3. i got the pixel search to work properly using proper handles. But i still cant use the winapi bitblt to search only the part of the window. i tried the following by setting the rectangle to a small box on the top where the desired pixel is not present but when i call the function it still finds the pixel outside of the rectangle. Func Start() $hDC = _WinAPI_GetWindowDC($handle) $hMemDC = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $aWinPos[2], $aWinPos[3]) _WinAPI_SelectObject($hMemDC, $hBitmap) _PrintWindow($handle, $hMemDC) _WinAPI_BitBlt($hMemDC, 0, 0, 10, 10, $hDC, 0, 0, $SRCCOPY) $lookup = _PixelSearchEx($hBitmap, 0xF04847) _ArrayDisplay($lookup) _WinAPI_DeleteDC($hMemDC) _WinAPI_ReleaseDC($handle, $hDC) _WinAPI_DeleteObject($hBitmap) EndFunc i'm stuck on this and have no idea how to proceed.
  4. Looks like i didn't use proper controls, I tried using the above script in paint and the values for pixel location are always offset as the script searches the whole window instead of only the white canvas. i tried using $window = "[CLASS:Afx:00007FF6CD820000:8; INSTANCE:1]" and the $winpos values ended up as error. Using MSPaintApp as Class just searches the whole paint window. How to make it search only the canvas?
  5. i am trying to make my scripts to run even on an inactive window. One of my script uses pixel search a lot which cannot be used on a inactive window so i searched and found this script called pixelsearch EX which is even faster and can be used on a inactive window. But i don't want the whole window to be searched, just a portion of the window so i tried to use the _WinAPI_BitBlt but i couldn't get it to work. Any help is Appreciated. Thank you. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #Include <WinAPIEx.au3> #include <Array.au3> GUICreate("File Sender", 270, 50, 1070, 300, Default,$WS_EX_TOPMOST) GUISetState(@SW_SHOW) $window = "[CLASS:HospitalDataStruc]" $handle = WinGetHandle($window) $aWinPos = WinGetPos($handle) HotKeySet ("{numpaddot}", "MyExit") HotKeySet ("{numpad1}", "Start") Func Start() $hDC = _WinAPI_GetWindowDC($handle) $hMemDC = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $aWinPos[2], $aWinPos[3]) _WinAPI_SelectObject($hMemDC, $hBitmap) _PrintWindow($handle, $hMemDC) $lookup = _PixelSearchEx($hBitmap, 0xF04847) _ArrayDisplay($lookup) _WinAPI_DeleteDC($hMemDC) _WinAPI_ReleaseDC($handle, $hDC) _WinAPI_DeleteObject($hBitmap) EndFunc Func _PixelSearchEx($hBitmap, $iColor) Static $pProc = 0 If Not $pProc Then If @AutoItX64 Then ; Not implemented! Return SetError(1, 0, 0) Else $pProc = __Init(Binary( _ '0x5553575631C0505050837C24280074118B6C2428837D14007407B801000000EB' & _ '0231C021C0747F8B6C24288B5D084B891C2431C03B04247F6DC7442404000000' & _ '008B6C24288B5D044B3B5C24047C528B6C24288B5D148B7C24048B34248B6C24' & _ '280FAF750401F7C1E70201FB895C24088B6C24088B5D0081E3FFFFFF003B5C24' & _ '2475188B5C24048B6C24288B7D082B3C244FC1E71009FB89D8EB14FF44240471' & _ 'A0FF0C24718CB8FFFFFFFFEB0231C083C40C5E5F5B5DC21000')) EndIf EndIf Local $tDIB, $tInt, $tPos, $aPos, $Ret, $Error = True $hBitmap = _WinAPI_CopyBitmap($hBitmap) If @error Then Return SetError(1, 0, 0) EndIf Do $tDIB = DllStructCreate($tagDIBSECTION) If (Not _WinAPI_GetObject($hBitmap, DllStructGetSize($tDIB), DllStructGetPtr($tDIB))) Or (DllStructGetData($tDIB, 'bmBitsPixel') <> 32) Or (DllStructGetData($tDIB, 'biCompression')) Then ExitLoop EndIf $Ret = _WinAPI_CallWindowProc($pProc, 0, $iColor, DllStructGetPtr($tDIB), 0) If (@error) Or ($Ret = -1) Then ExitLoop EndIf $Error = False Until 1 _WinAPI_DeleteObject($hBitmap) If $Error Then Return SetError(1, 0, 0) EndIf $tInt = DllStructCreate('int') $tPos = DllStructCreate('ushort;ushort', DllStructGetPtr($tInt)) DllStructSetData($tInt, 1, $Ret) Dim $aPos[2] For $i = 0 To 1 $aPos[$i] = DllStructGetData($tPos, $i + 1) Next Return $aPos EndFunc Func _PrintWindow($hWnd, $hMemDC, $iFlag = 0) $aRet = DllCall("User32.dll", "int", "PrintWindow", _ "hwnd", $hWnd, _ "hwnd", $hMemDC, _ "int", $iFlag) Return $aRet[0] EndFunc Func MyExit() Exit EndFunc While 1 Sleep(10) WEnd
  6. @ajag i tried but it just opened a cmd window where there was no directory, i couldn't even enter anything manually. In the below code the window just closes -as the script ended but not because of the exit command as it didn't even get entered. OK, i got it- i needed to add StdinWrite($pid, @CRLF) #include <AutoItConstants.au3> $pid = Run(@ComSpec & " /k " & "cd D:\Program Files\Admin\Secureset","",@SW_SHOW, $STDIN_CHILD) WinWait("Administrator: C:\WINDOWS\system32\cmd.exe","",10) $hCmd = WinGetHandle("Administrator: C:\WINDOWS\system32\cmd.exe") Sleep(500) StdinWrite($pid, "exit" & "{ENTER}") StdinWrite($pid, @CRLF) .THANK YOU <3
  7. @FrancescoDiMuro It didn't work . Is there something wrong in what i did below? as the CMD.exe didn't exit $pid = Run(@ComSpec & " /k " & "cd D:\Program Files\Admin\Secureset","",@SW_SHOW) WinWait("Administrator: C:\WINDOWS\system32\cmd.exe","",10) $hCmd = WinGetHandle("Administrator: C:\WINDOWS\system32\cmd.exe") Sleep(500) StdinWrite($pid, "exit" & "{ENTER}")
  8. I'm trying to tweak an application using command prompt. Everything works fine, the script runs in the background except for "shift" key i guess because i'm using chrome while the script is running and some of the text i'm typing get capitilized and "enter" key too i think. Is there some other command to send text to CMD.exe more effectively in the background? Any help is appreciated. Thank you. Run(@ComSpec & " /k " & "cd D:\Program Files\Admin\Secureset","",@SW_HIDE) WinWait("Administrator: C:\WINDOWS\system32\cmd.exe","",10) $hCmd = WinGetHandle("Administrator: C:\WINDOWS\system32\cmd.exe") Sleep(500) ControlSend($hCmd, "", "", "{!}check connected 192.168.0.25" & "{ENTER}") .... => remaining script similar commands of controlsend.
  9. I'm trying to learn autoit since a month, i wanted to send text to IE when its not active using controlsend- it works but when a text cursor containing app or window is active or in the foreground, the text is entered over there like i open chrome and it starts to enter the text in chrome. I guess i'm doing something wrong, if anyone can point it out it would be helpful. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> #RequireAdmin GUICreate("TEST", 270, 100, 850, 300, Default,$WS_EX_TOPMOST) GUISetState(@SW_SHOW) HotKeySet ("{numpaddot}", "MyExit") GUICtrlCreateLabel("Send", 5, 12) $key1 = GUICtrlCreateInput(IniRead("configTEST.ini", "Config", "$key1",""), 45, 10, 80) GUICtrlCreateLabel("➽ [ Numpad Dot ] TO EXIT", 4, 65) Local $startbutton = GUICtrlCreateButton("Start", 165, 8, 60) Opt("SendKeyDelay", 75) While 1 $msg = GUIGetMsg() Select Case $msg = $startbutton $send1 = GUICtrlRead($key1) Sleep(2000) While 1 ControlSend("HospitalfilesADMIN - Internet Explorer", "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", $send1) Sleep(2000) WEnd EndSelect WEnd Func MyExit() IniWrite("configTEST.ini","Config","$key1",GUICtrlRead($key1)) Exit EndFunc
  10. Thank You, guys. i now understand. I'll get back if i get stuck again. EDIT : Thank u @Melba23 the code worked and i was able to edit it accordingly. Thank you for helping a beginner
  11. I have been trying to learn autoit for the past few days. I decided to make a simple drop down select to display hex code of a color. But i'm stuck on how to proceed as running the below script only displays the Color name. Any help is appreciated, Thank You. #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> HotKeySet ("{numpaddot}", "MyExit") GUICreate("Hexinfo", 300, 50) Local $idComboBox = GUICtrlCreateCombo("", 10, 10, 185, 20) GUICtrlSetData($idComboBox, "White|Red|Green|Black") GUISetState(@SW_SHOW) Local $sComboRead = "" Local $arr[4] $arr[0] = 0xFFFFFF $arr[1] = 0xFF0000 $arr[2] = 0x008000 $arr[3] = 0x000000 While 1 Switch GUIGetMsg() Case $idComboBox $sComboRead = GUICtrlRead($idComboBox) MsgBox($MB_SYSTEMMODAL, "", "The combobox is currently displaying: " & $sComboRead, 0) EndSwitch WEnd Func MyExit() Exit EndFunc
  12. k thank you, i use that now- what a relief but does the window needs to be active for pixel search and pixel get color if i use that UDF? and could u help me with my code that i mentioned?
  13. hey thanks, i'm using it for chrome for my website. i been using send for a few scripts as controlsend doesn't work for chrome. Pixelsearch is what i use for my previous scripts as i need to detect color changes. could you help me with these?
  14. (Here is the code) Everything works fine except it keeps sending "4" and doesn't stop when there is a pixel change. What am i doing wrong? While 1 Send("al") Send("{ENTER}") Sleep(1000) $crystal = PixelSearch( 385, 635, 400, 650, 0xFAA61A) If IsArray($crystal) = True Then Send("al") Send("{ENTER}") Sleep(1000) EndIf Send("4") Send("{ENTER}") Sleep(1000) $success = PixelSearch( 385, 555, 400, 575, 0x00FF00) If IsArray($success) = False Then Do Send(" 4") Send("{ENTER}") Sleep(1000) Until IsArray($success) = True EndIf WEnd
×
×
  • Create New...