
soft4pedia
Members-
Posts
11 -
Joined
-
Last visited
Everything posted by soft4pedia
-
Hi, Google changed the style of translation page therefore _IEFormElementSetValue stopped working to set values in the google translator page automatically, I tried my best to fix it but it's not happening. It was working perfect a month ago almost before launching of new google translation interface. Any help would be highly appreciated... I'm using a kind of function that help to set values in the form to google translator page and let it translate and then retrieve it back to save in a text file. Here is my code: #RequireAdmin #include <IE.au3> #include <String.au3> #include <Array.au3> #include <Excel.au3> #include <File.au3> ;*****************************Splitting Source Code Ended***************************** Local $oExcel = _Excel_Open() Local $oWorkbook1 = _Excel_BookOpen($oExcel, @ScriptDir & "\example.xlsx", False) ;*****************************Saving Software Links Started*************************** ;*****************************Splitting Source Code Started***************************** ;***************************************** Saving Title + .rar link + Description text file No. 1***************************** ProcessClose ( "iexplore.exe") $file = fileopen(@ScriptDir & "\source.txt", 10) $splitting = _Excel_RangeRead ($oWorkbook1, Default, "A1") $IE = _IECreate($splitting, 0, 0) $source = _IEDocReadHTML($IE) FileWrite($file, $source) $target_source5 = _StringBetween($source, '</h1>', '<i>Скачать</i>') If Not @error Then FileWrite (@ScriptDir & "\kat01.txt", $target_source5[0]) Sleep (50) ; removing of HTML codes to convert data into simple text $File1 = @ScriptDir & "\kat01.txt" $txt = FileRead($File1) $txt = StringReplace($txt, "<br>", @crlf) $txt = StringRegExpReplace($txt, '(?s)<a.*?</a>|<.*?>', "") $txt = StringStripWS ( $txt, $STR_STRIPSPACES) $txt = StringReplace($txt, "<br><", "") $txt = StringReplace($txt, "--", "") $txt = StringReplace($txt, "---", "") $txt = StringReplace($txt, " ", " ") $txt = StringReplace($txt, "_", "") $txt = StringReplace($txt, " ", "") FileWrite (@scriptdir & '\kat_saved.txt', $txt) Local $sFilePath = @ScriptDir & "\kat_saved.txt" ProcessClose ( "iexplore.exe") Example1() EndIf ;********************Example1 Function Written Started***************************** Func Example1() $Text = FileRead ($sFilePath) Local $aArray = StringSplit($Text, @CR) For $i = 1 To $aArray[0] Local $tag="* *" Local $oIE=_IECreate("https://translate.google.com/#ru/en", 1, 1) $HWND = _IEPropertyGet($oIE, "hwnd") WinSetState($HWND, "", @SW_MAXIMIZE) Sleep (500) Local $oForm=_IEFormGetCollection($oIE,0) Local $oQuery=_IEGetObjByName($oForm,"text") _IEFormElementSetValue($oQuery, $tag & @CR & $aArray[$i] & @CR & $tag) MouseMove ( 930, 275, 10) MouseClick ( "Main", 930, 275, 5, 10) Sleep(1000) MouseMove ( 930, 200, 10) MouseClick ( "Main", 930, 200, 5, 10) Sleep (10000) _IELoadWait($oIE) Local $oText=_IEGetObjById($oIE,"gt-res-data") $lines=StringSplit(_IEPropertyGet($oText,"innerText"),@CRLF,1) _IEQuit($oIE) ProcessClose ( "iexplore.exe") Sleep (1000) _ArrayDelete($lines,_ArraySearch($lines,$tag,1,0,0,1,0) & "-" & $lines[0]) _ArrayDelete($lines,"1-" & _ArraySearch($lines,$tag,1,0,0,1,1)) $lines[0]=UBound($lines)-1 $FilePath = @ScriptDir & "\Translated.txt" $arraytostring = _ArrayToString ($lines) $txt = StringReplace($arraytostring, "1|", "") $txt = StringReplace($txt, "|", "") FileWrite ($FilePath, $txt & @CRLF) Next EndFunc ;MsgBox ('', 'Done Bro', 'Done Bro')
-
- _ieformelementsetvalue
- google translation
-
(and 2 more)
Tagged with:
-
Hello, I've series of direct URL of books (Files format are pdf, epub and txt) and books are being queued in IDM for downloading but I've given instructions to idm to move file after download to a specific folder i.e "Completed Download" and IDM did the same as usual. My problem is that I want to monitor "Completed Download" folder using autoit, as the IDM will move complete downloaded file to my "Completed Download" folder my autoit script will take action on the arrival of new file and send winrar command line code to convert newly arrived file into .zip file (such as book1.pdf to compress it into book1.zip) and wait until new file will arrive in "Completed Download" folder to do the same.. Please guide how can make this possible Thanks
-
Thanks mate for suggesting me codes but these codes are relatively hard for me to understand; I tried to solve the problem on my own and design the following code; $File1 = @ScriptDir & "\kat01.txt" $txt = FileRead($File1) $txt = StringReplace($txt, @crlf, "<br>") In this way got repalced all the ending lines with <br> code and then again want to try this code but it's unable to work; $File1 = @ScriptDir & "\kat01.txt" $txt = FileRead($File1) $txt = StringRegExpReplace($txt, "<br><br>", "") $txt = StringReplace($txt, "<br><br>", "") I found that when i just removed <> from my replacement code and use br only to replace it just remove br from my data. In the same way, when i tried to use code <br> or <br><br> to replace with nothing it'll never replace anything inside my text file....Please help me what wrong with my codes? is the StringReplace or StringRegExpReplace never support replacement of brackets or text inside the brackets?
-
Hello, I'm having several type of text files but my text files are having unnecessary space because of enters (end of line or line breaks) but I want my text in continuous stream. There is no basically proper order of enter-spaces (end of line breaks) sometime there are two line breaks, sometime 3 to 8 lines breaks but I only want 1 line break at the end of end...Please help me which pattern will be suitable for me to use "StringRegExReplace" command to remove unnecessary breaks in my text files.. $File1 = @ScriptDir & "\text01.txt" $txt = FileRead($File1) ; Please recommend me which pattern will be fine to remove unnecesary end of line Enter-spaces $txt = StringRegExpReplace($txt, 'Not sure about pattern', "") FileWrite (@scriptdir & "\text02", $txt)
-
This pattern really works for me...Thanks I got another situation where the names of authors just be placed inside torrent brackets such as; Title Book 1 [Adam Smith] Title Book 1 {Pete Anderson} Title Book 1 (Anna William) Title Book 1 - Andrew Clark only these 4 situation are commonly used in titles of my books... In this situation which pattern is more suitable so i can use single pattern to replace all, please
-
Hello, I know how to use this command but my problem is that I don't know how to create pattern even i study the a lot and there are lot of ways to make pattern but those are not upto to my understanding please guide me which patter will be ok for me to replace everything from character "by" and onward.
-
Hello, I'm having several names of books those are ended with the almost same pattern (by Van Horne), (by Philip Crosby) (by Adam Smith), etc... My questions is how can i use StringReplace command once to replace all ending names of authors like I don't want ending character after "by" and onward. I try to study StringReplace function very deeply but unable to build any suitable pattern for this. Guide me please $File1 = @scriptdir & "\replace.txt" $txt = FileRead($File1) $txt = StringReplace($txt, "by Van Horne", "") $txt = StringReplace($txt, "by Johnson T", "")
-
Conditional use of "_Excel_RangeRead"
soft4pedia replied to soft4pedia's topic in AutoIt General Help and Support
Got it thanks it's working mate... -
Conditional use of "_Excel_RangeRead"
soft4pedia replied to soft4pedia's topic in AutoIt General Help and Support
Hello MuffinMan, you did awesome job, but you totally missed my point I don't have values like you used basically I've values saved in an Excel file that's why I've to use _Excel_RangeRead command combination with StringRegExpReplace command to remove my desired content while copying from a desired cell. Basically I've combination of characters to show versions of books like below some books show differently like: [12th edition] [10th edition] (13th edition) {11th edition} these 4 combinations are available through excel sheet from 11th to 14 edition only so please guide how can i use _Excel_RangeRead command with combination with StringRegExpReplace to fulfill my requirements... -
Hello, I trying to copy text from a specific cell "C1" of an Excel sheet. Script successfully copy the content from excel sheet and show it in a message box but I want to use _Excel_RangeRead command on conditional basis such as I want copy whole cell just after skipping data available in brackets like i don't want to copy edition of book and want to copy rest of data behind and after those brackets for example Value available in Cell "C1" is; Fundamentals of Financial Management [13th Edition] by Van horne & John M Wachowicz my requirements is like this: Fundamentals of Financial Management by Van horne & John M Wachowicz Please guide me how can it be possible $File = _Excel_RangeRead ($oWorkbook1, Default, "C1") ClipPut(FileRead($File)) Msgbox(0,"", $File)