;***************************************** ;imagesearchexample.au3 by ;Created with ISN AutoIt Studio v. 1.09 ;***************************************** ;#RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include #include #include #include #include #include #include #include #include #include $Left = 0 $Top = 0 $Bottom = @DesktopHeight $Right = @DesktopWidth $x = 0 $y = 0 $Url = "librarian.libgen.io/librarian/" $sFilePath = ("C:\Users\max\Desktop\book2.txt") Global $g_bPaused = False HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ; Shift-Alt-d WHILE _FileCountLines ( $sFilePath ) > 0 ShellExecute("chrome.exe", $Url, "--start-maximized") ;sleep (2000) _signin() Nexttext() WEnd MsgBox(0, "Finished", "All files processed") Func Nexttext() _FileCountLines ( $sFilePath ) Local $sFileRead = FileReadLine ( $sFilePath, 1 ) _FileWriteToLine($sFilePath,1,"",1) Global $aLines _FileReadToArray($sFilePath, $aLines) For $i = $aLines[0] To 1 Step -1 If $aLines[$i] = "" Then _ArrayDelete($aLines, $i) EndIf Next _FileWriteFromArray($sFilePath, $aLines, 1) ; Set the state of the Notepad window to "show". WinSetState("libgen.io - Google Chrome", "", @SW_MAXIMIZE) ; Send("{ALTDOWN}{SPACE}{ALTUP}x") ; backup for maximise window Sleep(200) $result = _ImageSearchArea("Images/enterlink.png", 1, $Left, $Top, $Right, $Bottom, $x, $y, 100) If $result = 1 Then ;MouseMove($x, $y, 20) MouseClick("left",$x,$y,5) ; locate input for file url placement Send ($sFileRead) send("{TAB}{ENTER}") waitlibrarian() $result = _ImageSearchArea("Images/alreadyindatabase.png", 1, $Left, $Top, $Right, $Bottom, $x, $y, 100) If $result = 0 Then getmeta() setlanguage() registerbook() ELSE EndIf EndIf Send("{CTRLDOWN}w{CTRLUP}") EndFunc ;==>Example Func _signin() sleep(3000) If WinExists("librarian.libgen.io/librarian/ - Google Chrome","") Then ; $result = _ImageSearchArea("Images/libgenwantslogin.png", 1, $Left, $Top, $Right, $Bottom, $x, $y, 100) ; If $result = 1 Then ;MouseMove($x, $y, 20) Send("genesis{TAB}upload{ENTER}") sleep(1000) ; Else ; MsgBox(0, "Empty/Missing", "no login screen detected") EndIf EndFunc ;==>_IEAutoLogin FUNC setlanguage() ; set language $result = _ImageSearchArea("Images/language.png", 1, $Left, $Top, $Right, $Bottom, $x, $y, 100) If $result = 1 Then MouseMove($x, $y, 20) MouseClick("left",$x,$y,5) Send("{DOWN}{ENTER}") sleep(200) EndIf EndFunc FUNC registerbook() $result = _ImageSearchArea("Images/register.png", 1, $Left, $Top, $Right, $Bottom, $x, $y, 100) If $result = 1 Then MouseMove($x, $y, 20) MouseClick("left",$x,$y,5) ; locate input for file url placement SLEEP(500) EndIf EndFunc FUNC waitlibrarian() $result = _ImageSearchArea("Images/waitforlibrarian.png", 1, $Left, $Top, $Right, $Bottom, $x, $y, 100) WHILE $result <> 0 $result = _ImageSearchArea("Images/waitforlibrarian.png", 1, $Left, $Top, $Right, $Bottom, $x, $y, 100) MouseMove($x, $y, 20) WEnd EndFunc FUNC getmeta() ; insert metadata $result = _ImageSearchArea("Images/getmetadata.png", 1, $Left, $Top, $Right, $Bottom, $x, $y, 100) If $result = 1 Then MouseMove($x, $y, 20) MouseClick("left",$x,$y,5) ; locate input for file url placement waitlibrarian() EndIf EndFunc Func Terminate() Exit EndFunc ;==>Terminate Func ShowMessage() MsgBox($MB_SYSTEMMODAL, "", "This is a message.") EndFunc ;==>ShowMessage