Leaderboard
Popular Content
Showing content with the highest reputation on 07/20/2023 in all areas
-
Basically, it is a function that allows you to reformat a string based on a given pattern. I used it because, at least for me, it is much easier to read and maintain than writing: "(>.*?)\Q" & $sSearchText & "\E([^=][^<]*)" Using StringFormat for simple strings (like the one above) may be a little overkill, but for more complex strings it makes building the string much easier. I could have used it for the replacement text also but I did it using regular concatenation. If you want to test the regular expressions on regex101.com, then you need to do the string replacement that the script is doing. So for "Style", the pattern would be: "(>.*?)\QStyle\E([^=][^<]*)" See here: https://regex101.com/r/pvrWi1/12 points
-
How about something like this: #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 -w 5 -w 6 -d Const $HTML = '<div><p style="text-align:left;">Style: <span style="float:right;">Casual</span></p></div><div><p style="text-align:left;">Color: <span style="float:right;">Navy Blue</span></p></div><div><p style="text-align:left;">Pattern Type: <span style="float:right;">Plain</span></p></div><div><p style="text-align:left;">Neckline: <span style="float:right;">Round Neck</span></p></div><div><p style="text-align:left;">Length: <span style="float:right;">Long</span></p></div><div><p style="text-align:left;">Type: <span style="float:right;">A Line</span></p></div><div><p style="text-align:left;">Details: <span style="float:right;">Pearls</span></p></div><div><p style="text-align:left;">Details: <span style="float:right;">Frill</span></p></div><div><p style="text-align:left;">Details: <span style="float:right;">Beaded</span></p></div><div><p style="text-align:left;">Details: <span style="float:right;">Pocket</span></p></div><div><p style="text-align:left;">Sleeve Length: <span style="float:right;">Half Sleeve</span></p></div><div><p style="text-align:left;">Season: <span style="float:right;">Spring/Fall</span></p></div><div><p style="text-align:left;">Composition: <span style="float:right;">75% Cotton</span></p></div><div><p style="text-align:left;">Composition: <span style="float:right;">Denim</span></p></div><div><p style="text-align:left;">Composition: <span style="float:right;">25% Polyester</span></p></div><div><p style="text-align:left;">Fabric: <span style="float:right;">Non-Stretch</span></p></div><div><p style="text-align:left;">Waist Line: <span style="float:right;">Natural</span></p></div><br /><table border="1"><thead><tr><th>size</th><th>Shoulder </th><th>Bust </th><th>Waist Size </th><th>Hip Size </th><th>Sleeve Length </th><th>Length </th><th>Bicep Length </th><th>Cuff </th></tr></thead><tbody><tr><td>XS</td><td> 38 cm</td><td> 91 cm</td><td> 90 cm</td><td> 101 cm</td><td> 39 cm</td><td> 139 cm</td><td> 30 cm</td><td> 25 cm</td></tr><tr><td>S</td><td> 39 cm</td><td> 95 cm</td><td> 94 cm</td><td> 105 cm</td><td> 40 cm</td><td> 140 cm</td><td> 31 cm</td><td> 26 cm</td></tr><tr><td>M</td><td> 40 cm</td><td> 99 cm</td><td> 98 cm</td><td> 109 cm</td><td> 41 cm</td><td> 141 cm</td><td> 32 cm</td><td> 27 cm</td></tr><tr><td>L</td><td> 41 cm</td><td> 103 cm</td><td> 102 cm</td><td> 113 cm</td><td> 42 cm</td><td> 142 cm</td><td> 33 cm</td><td> 28 cm</td></tr></tbody></table>' example() Func example() Local $sUpdatedHtml = $HTML $sUpdatedHtml = _HTML_ReplaceAllText($sUpdatedHtml, "Style" , "MODIFIED_STYLE") $sUpdatedHtml = _HTML_ReplaceAllText($sUpdatedHtml, "style" , "MODIFIED_STYLE") ;Shows that attributes are not modified $sUpdatedHtml = _HTML_ReplaceAllText($sUpdatedHtml, "Casual" , "MODIFIED_CASUAL") $sUpdatedHtml = _HTML_ReplaceAllText($sUpdatedHtml, "Color" , "MODIFIED_COLOR") $sUpdatedHtml = _HTML_ReplaceAllText($sUpdatedHtml, "Sleeve Length" , "MODIFIED_SLEEVE_LENGTH") ConsoleWrite($sUpdatedHtml & @CRLF) EndFunc ;============================================================================== ; Note: The regular expression assumes that the search text is case sensitive. ;============================================================================== Func _HTML_ReplaceAllText($sSource, $sSearchText, $sReplaceText) Return StringRegExpReplace( _ $sSource, _ StringFormat("(>.*?)\\Q%s\\E([^=][^<]*)", $sSearchText), _ "$1" & $sReplaceText & "$2" _ ) EndFunc Output: <div><p style="text-align:left;">MODIFIED_STYLE: <span style="float:right;">MODIFIED_CASUAL</span></p></div><div><p style="text-align:left;">MODIFIED_COLOR: <span style="float:right;">Navy Blue</span></p></div><div><p style="text-align:left;">Pattern Type: <span style="float:right;">Plain</span></p></div><div><p style="text-align:left;">Neckline: <span style="float:right;">Round Neck</span></p></div><div><p style="text-align:left;">Length: <span style="float:right;">Long</span></p></div><div><p style="text-align:left;">Type: <span style="float:right;">A Line</span></p></div><div><p style="text-align:left;">Details: <span style="float:right;">Pearls</span></p></div><div><p style="text-align:left;">Details: <span style="float:right;">Frill</span></p></div><div><p style="text-align:left;">Details: <span style="float:right;">Beaded</span></p></div><div><p style="text-align:left;">Details: <span style="float:right;">Pocket</span></p></div><div><p style="text-align:left;">MODIFIED_SLEEVE_LENGTH: <span style="float:right;">Half Sleeve</span></p></div><div><p style="text-align:left;">Season: <span style="float:right;">Spring/Fall</span></p></div><div><p style="text-align:left;">Composition: <span style="float:right;">75% Cotton</span></p></div><div><p style="text-align:left;">Composition: <span style="float:right;">Denim</span></p></div><div><p style="text-align:left;">Composition: <span style="float:right;">25% Polyester</span></p></div><div><p style="text-align:left;">Fabric: <span style="float:right;">Non-Stretch</span></p></div><div><p style="text-align:left;">Waist Line: <span style="float:right;">Natural</span></p></div><br /><table border="1"><thead><tr><th>size</th><th>Shoulder </th><th>Bust </th><th>Waist Size </th><th>Hip Size </th><th>MODIFIED_SLEEVE_LENGTH </th><th>Length </th><th>Bicep Length </th><th>Cuff </th></tr></thead><tbody><tr><td>XS</td><td> 38 cm</td><td> 91 cm</td><td> 90 cm</td><td> 101 cm</td><td> 39 cm</td><td> 139 cm</td><td> 30 cm</td><td> 25 cm</td></tr><tr><td>S</td><td> 39 cm</td><td> 95 cm</td><td> 94 cm</td><td> 105 cm</td><td> 40 cm</td><td> 140 cm</td><td> 31 cm</td><td> 26 cm</td></tr><tr><td>M</td><td> 40 cm</td><td> 99 cm</td><td> 98 cm</td><td> 109 cm</td><td> 41 cm</td><td> 141 cm</td><td> 32 cm</td><td> 27 cm</td></tr><tr><td>L</td><td> 41 cm</td><td> 103 cm</td><td> 102 cm</td><td> 113 cm</td><td> 42 cm</td><td> 142 cm</td><td> 33 cm</td><td> 28 cm</td></tr></tbody></table>2 points
-
Use StringRegExpReplace instead. This will return an updated string based on a regular expressions.2 points
-
BAO - A tool to repair computers for professionals
Stormgrade and one other reacted to PaysanBarbare for a topic
Hello, I've just translate in english the tool I create to repair computers (since 2019). You can find documentation here https://boiteaoutils.xyz/ (sorry for google translation, but I think it's better than PaysanBarbare translation) It's not perfect, but it can help technicians in little shop to gain time. Here is a list of the features : Hard disk SMART status check remote office Automated software installation Downloading ISO files and migrating to Windows 10 or Windows 11 Customizable virus cleanup Creation of intervention report Technician-customizable troubleshooting tools download and run Backup of user documents, passwords and product key Installing device drivers RAM tests Automatic login (Autologon) Disabling standby Log recording Viewing System Information List of installed and uninstalled software Online monitoring of interventions for customers Creation of an SFX archive to easily install BAO on a client workstation Check alignment of partitions on SSD Sleep state control File association settings Calculation of the performance index Device Manager Check History of interventions Environment variables Copy to external media Compatibility with proaxive Customer and Intervention Management Battery life measurement network scanner Supervision of computers being repaired Script management (bat, powershell, reg) Silent software uninstallation You can if you want help me to correct my bad english (I'm french) and report errors/bugs. 7z file includes AutoIt3.exe and AutoIt3_x64.exe because I compile in a3x format. Antivirus are less agressive with my soft. If you have some solutions to not be detect by them, please write me. Thank you for your help. BAO-EN.7z2 points -
Try if search replace with case sensitivity is enough to filter the Style. if StringInStr($DescFile[$i], "Style", $STR_CASESENSE) then $DescFile[$i] = StringReplace($DescFile[$i],"Style",$DictFile[$n][1], 0, $STR_CASESENSE) Endif An other probably more reliable approach is to search those Style NOT followed by an = character. In pseudo-code replace "style=" by placeholder replace remaining "Style" by your replacement replace placeholder by "style="1 point
-
I'm not quite clear yet what exactly you want to replace with what (probably due to the heat that is currently boiling my brain ). Could you describe your goal a bit more precisely. Also, please post the HTML snippet as text (e.g. as code < >), not as a picture. That way others could test the process without having to type the data from the image.1 point
-
Why not just loop through the array to get the values you want and return them with whatever type suits you?1 point
-
Condition question
somdcomputerguy reacted to Jos for a topic
Quick search of the site gives you the number of times this was asked already and answered https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fwww.autoitscript.com+faster+switch+or+if&rlz=1C1WHAR_nlNL1056NL1056&oq=site%3Ahttps%3A%2F%2Fwww.autoitscript.com+faster+switch+or+if+&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIGCAEQRRg60gEJMzYzMTZqMGo3qAIAsAIA&sourceid=chrome&ie=UTF-81 point -
How to execute another .au3 script properly?
quangthanhngo22 reacted to kaotkbliss for a topic
you can Run() any file, as long as you include the program the file runs with. Run("Notepad.exe C:\AutoIt\AutoItlog.txt") that will open the AutoItlog.txt file in notepad. The same can be done with Au3 scripts. Run("C:\Program Files\AutoIt3\AutoIt3.exe D:\path to script\script.au3")1 point