Jump to content
Image

Flum

Active Members
  • Posts

    23
  • Joined

  • Last visited

About Flum

  • Birthday 08/20/1985

Recent Profile Visitors

212 profile views

Flum's Achievements

  1. Hi Nine, i did not need to add the fireEvent code to my code to make it work. Seems like both our codes do the job filling the in the input fields. The next problem i stumble up is that after i submit the form, it wont actually submit. Because the underlying code on the form thinks that the input fields are empty while they are not!? I checked there website source code and i think it has something to do with the code below: Not sure how to solve this!?
  2. hello fellow scripters, yes you both are right, and i leaned some more tricks in the mean time. The code below finds both input fields and assign them accordingly to an object then tries to send out the form. There is one big obstacle we still got to tackle. The error handling on there website refrains the script below to send out the form. (It thinks the input fields are empty) Any ideas? #include <IE.au3> Local $oUser, $oPass, $oSubmit Local $sUser = "testUsername" Local $sPass = "testPassword" Local $url = "https://www.klikvoorwonen.nl/mijn-klik-voor-wonen/inloggen/" Local $oIE = _IECreate($url, 1) _IELoadWait($oIE) $oInputs = _IETagNameGetCollection($oIE, "input") for $oInput in $oInputs if $oInput.type = "text" And $oInput.name = "username" Then $oUser = $oInput if $oInput.type = "password" And $oInput.name = "password" Then $oPass = $oInput if $oInput.type = "submit" And $oInput.value = "Inloggen" Then $oSubmit = $oInput if isObj($oUser) And isObj($oPass) And isObj($oSubmit) then exitloop Next $oUser.value = $sUser $oPass.value = $sPass _IEAction($oSubmit, "click") _IELoadWait($oIE)
  3. Good morning dear fellow scripters, WIth help of the forum search function and the autoit help file i came up with the following code: #include <IE.au3> Opt("WinTitleMatchMode", 0) $oIE = _IECreate ("https://www.klikvoorwonen.nl/mijn-klik-voor-wonen/inloggen/") ;~ Sleep(2000) $o_form = _IEFrameGetObjByName ($oIE, "loginForm") $o_login = _IEFormElementGetObjByName ($o_form, "username") ;~ $o_login = _IEGetObjById ($o_form, "username") $o_password =_IEFormElementGetObjByName ($o_form, "password") ;~ $o_password = _IEGetObjById ($o_form, "password") $username = "test" $password = "test" _IEFormElementSetValue ($o_login, $username) _IEFormElementSetValue ($o_password, $password) WinSetState ( "Internet", "", @SW_MAXIMIZE ) As you can see i tried both the frame method as the form method. Sadly to say, both did not work. Appreciate any pointer to an efficient solution. (Other then using the mouseclick method) Thanks in advanced for the creative mind that can solve this one. You rock!
  4. @KaFu @rudi @pixelsearch This makes way more sense, i was loading up the same image trough the for loop. Also loading up _GDIPlus _Startup() and closing it multiple times, not one of my brides ideas. I am sending you all a bunch of love from The Netherlands. I will see if i can return the favor and help some other people on the forums as a return! Have a wonderfull day!
  5. #include <GDIPlus.au3> #include <ScreenCapture.au3> #include <File.au3> #include <Array.au3> #include <MsgBoxConstants.au3> #include <GuiConstantsEx.au3> #include <WinAPI.au3> global $possibility1 global $possibility2 global $dek[3] = ["sheet1", "sheet2", "sheet3"] HotKeySet("{ESC}", "_Terminate") While 1 sleep(1000) local $color = PixelGetColor (1376 , 653) if ($color <> "6590886") then FileDelete ("1.jpg") FileDelete ("2.jpg") _GDIPlus_Startup() sleep (1000) _ScreenCapture() sleep (1000) For $i = 0 To UBound($dek) -1 $excelsheet = $dek[$i] $bm1 = _GDIPlus_ImageLoadFromFile("1.jpg") ConsoleWrite(@ScriptDir & "/links/" & $excelsheet & ".jpg" & @CRLF) $bm2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "/links/" & $excelsheet & ".jpg") $antwoord = CompareBitmaps($bm1, $bm2) if ($antwoord = "True") Then ;MsgBox(0, "Alert", "We hebben je excelsheet gedetecteerd je excelsheet = " & $excelsheet) $possibility1 = $excelsheet _GDIPlus_ImageDispose($bm1) _GDIPlus_ImageDispose($bm2) FileClose($bm1) FileClose($bm2) _GDIPlus_Shutdown() _GDIPlus_Startup() ExitLoop EndIf ;;MsgBox(0, "bm1==bm2", CompareBitmaps($bm1, $bm2)) Next For $i = 0 To UBound($dek) -1 $excelsheet = $dek[$i] $bm1 = _GDIPlus_ImageLoadFromFile("2.jpg") ConsoleWrite(@ScriptDir & "/rechts/" & $excelsheet & ".jpg" & @CRLF) $bm2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "/rechts/" & $excelsheet & ".jpg") $antwoord = CompareBitmaps($bm1, $bm2) if ($antwoord = "True") Then ;MsgBox(0, "Alert", "We hebben je excelsheet gedetecteerd je excelsheet = " & $excelsheet) $possibility2 = $excelsheet _GDIPlus_ImageDispose($bm1) _GDIPlus_ImageDispose($bm2) FileClose($bm1) FileClose($bm2) _GDIPlus_Shutdown() ExitLoop EndIf ;;MsgBox(0, "bm1==bm2", CompareBitmaps($bm1, $bm2)) Next ConsoleWrite($possibility1 & " - " & $possibility2 & @CRLF) sleep (1000) ;MouseClick ($MOUSE_CLICK_LEFT, 1042, 808, 1) endif WEnd Func _ScreenCapture() Local $hBitmap, $hBitmap2, $hImage, $hImage2 _GDIPlus_Startup() ; Capture full screen $hBitmap = _ScreenCapture_Capture(false, 1454, 672, 1454+11, 672+28) $hBitmap2 = _ScreenCapture_Capture(false, 1477, 671, 1477+15, 672+45) $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) $hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap2) ; Save resultant image _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\1.jpg") _GDIPlus_ImageSaveToFile($hImage2, @ScriptDir & "\2.jpg") ; Clean up resources _GDIPlus_ImageDispose ($hImage) _GDIPlus_ImageDispose ($hImage2) _WinAPI_DeleteObject ($hBitmap) _WinAPI_DeleteObject ($hBitmap2) _GDIPlus_ShutDown () EndFunc ;==>_Main Func CompareBitmaps($bm1, $bm2) $Bm1W = _GDIPlus_ImageGetWidth($bm1) $Bm1H = _GDIPlus_ImageGetHeight($bm1) $BitmapData1 = _GDIPlus_BitmapLockBits($bm1, 0, 0, $Bm1W, $Bm1H, $GDIP_ILMREAD, $GDIP_PXF32RGB) $Stride = DllStructGetData($BitmapData1, "Stride") $Scan0 = DllStructGetData($BitmapData1, "Scan0") $ptr1 = $Scan0 $size1 = ($Bm1H - 1) * $Stride + ($Bm1W - 1) * 4 $Bm2W = _GDIPlus_ImageGetWidth($bm2) $Bm2H = _GDIPlus_ImageGetHeight($bm2) $BitmapData2 = _GDIPlus_BitmapLockBits($bm2, 0, 0, $Bm2W, $Bm2H, $GDIP_ILMREAD, $GDIP_PXF32RGB) $Stride = DllStructGetData($BitmapData2, "Stride") $Scan0 = DllStructGetData($BitmapData2, "Scan0") $ptr2 = $Scan0 $size2 = ($Bm2H - 1) * $Stride + ($Bm2W - 1) * 4 $smallest = $size1 If $size2 < $smallest Then $smallest = $size2 $call = DllCall("msvcrt.dll", "int:cdecl", "memcmp", "ptr", $ptr1, "ptr", $ptr2, "int", $smallest) _GDIPlus_BitmapUnlockBits($bm1, $BitmapData1) _GDIPlus_BitmapUnlockBits($bm2, $BitmapData2) Return ($call[0]=0) EndFunc ;==>CompareBitmaps Func _Terminate() Exit EndFunc ;==>_Terminate Goodmorning, i wrote a little script that makes 2 screenshots 1.jpg and 2.jpg and compare them seperatly with 3 other screenshots $dek[3]. I got it working perfectly the only problem i face is that it wont delete 1.jpg and 2.jpg to start a new batch. I found out it is because file 1.jpg and 2.jpg are in use. So i tried a couple of things myself: _GDIPlus_ImageDispose($bm1) _GDIPlus_ImageDispose($bm2) FileClose($bm1) FileClose($bm2) _GDIPlus_Shutdown() _GDIPlus_Startup() but the files wont delete, because they are still in use. Does anyone have a clue how i can solve it. I thought about a workarround myself of storing the images in the windows temporary folder. But i rather have them saved where they are. Yours sincerely, Chris and have a great day
  6. Thanks a bunch JohnOne and trancexx u both teached me something new. Maybe i should have known, but i really did not. Take this mighty sword as a token of my appreciation,
  7. Hi Trancexx & JohnOne Byref is indeed working, is there any explanation why this will not work with globals? Johnone said i was not using the returned value. I thought i was doing that with Return $bet Also i thought once u define a variable as Global, it would work inside and outside functions? I know how to do it now, but i dont quite understand it. From the helpfile
  8. Hi guinnes, The function is ment to take a start integer, then multiply that by two, then add the start integer to that and from there i would like to multiply each time by two. I'm testing the output with the function consolewrite, but it seems to returns 3 times 350000. I don't understand, why it is doing that.
  9. Dear Autoit scripters, So here is my code, does anyone know why $bet in the consolewrite returns the value 350000. In the function i am doing some calculations. But it seems it does not put them in $bet? Global $bet = 350000 Global $maxbet = 255000000 Global $onetime = True Global $flag = True Global $remember bet($bet) ConsoleWrite($bet & @CRLF) bet($bet) ConsoleWrite($bet & @CRLF) bet($bet) ConsoleWrite($bet & @CRLF) Func bet($bet) If $onetime = True Then $remember = $bet $onetime = False $bet = $bet + $bet Else If $flag = True Then $bet = $remember + $bet $flag = False Else $bet = $bet + $bet EndIf EndIf Return $bet EndFunc ;==>bet
  10. Hi all, Im trying to replace a string with only relevant information. My first thought was the stringreplace function. The string i wish to cutdown: HospitalInfo.set2("HospitalInfoCash", "<b>Cash</b> - ","&euro;&nbsp;1,270,876"); The information i would like to keep is the cash amount: 1,270,876 From the helpfile: #include <MsgBoxConstants.au3> ; Replace a blank space (' ') with a - (minus) character. Local $sString = StringReplace("This is a sentence with whitespace.", " ", "-") Local $iReplacements = @extended MsgBox($MB_SYSTEMMODAL, "", $iReplacements & " replacements were made and the new string is:" & @CRLF & @CRLF & $sString) Now after some research i found out u cant use double quotes. So i searched the forum and found out u should wrap the double quotes into single quotes. So i tried to search on this for the replacement: HospitalInfo.set2('"'HospitalInfoCash'"', '"'<b>Cash</b> - '"','"'&euro;&nbsp;1,270,876"); Sadly, i am still getting a syntax error. Could someone point me in the right direction.
  11. So i found out the solution, if i remove the while loop in the second gui. Then the button in the second gui will function correctly. Im curious why it wont work with a while in there?
  12. Good morning community, I wrote an Autoit script with a double Gui.The button in the second gui wont work any ideas? Much appriciated #include <ButtonConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Global $hGUI, $hGUI2 vertical() func vertical() $hGUI = GUICreate("Medication", 60, 376, -1, -1, $WS_POPUP) GUISetBkColor(0x000000) $rotatebutton = GUICtrlCreateButton("", 20, 0, 16, 16) GUICtrlSetOnEvent($rotatebutton, "rotate") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd endfunc func horizontal() $hGUI2 = GUICreate("Medication", 376, 60, -1, -1, $WS_POPUP) GUISetBkColor(0x000000) $rotatebackbutton = GUICtrlCreateButton("", 20, 0, 16, 16) GUICtrlSetOnEvent($rotatebackbutton, "rotateback") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd endfunc func rotate() msgbox(0,"ROTATE","ROTATE") GUISetState(@SW_HIDE, $hGUI) horizontal() EndFunc func rotateback() msgbox(0,"ROTATE BACK","ROTATE BACK") ; NEVER GETS TO THIS POINT? GUISetState(@SW_HIDE, $hGUI2) EndFunc
  13. Hoping to see a red billed streamertail bird here. Your tiny advice is valuable.
  14. I wish to add 2 more buttons on it, so people can move one items from the right list up and down in the list itself. What would be the best way to do such a thing?
  15. I did try out the 0x0002 ($LBS_SORT) when creating the list. But i just found out i added it as extended style. Facepalm Cheers
×
×
  • Create New...