Jump to content

Search the Community

Showing results for tags 'web'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

  1. Hello there, I hope this message finds you well. I am relatively new to AutoIt and have been exploring its capabilities for automating tasks on Windows. I have a specific project that I am working on, and I would greatly appreciate any guidance or advice from the experienced members of this community. I need to launch a specific web browser (preferably Chrome or Firefox) and navigate to the login page of the web application. The script should automatically fill in the username and password fields and submit the login form. The login page may include additional elements such as CAPTCHA, which could be a challenge to automate. After successfully logging in, the script should navigate through the web application to reach a specific page where the required data is displayed. What is the best approach to handle web automation with AutoIt for the aforementioned tasks? Are there any recommended libraries or tools that work well with AutoIt for web automation, particularly for handling dynamic web elements and CAPTCHA? Also, I have gone this post: https://www.autoitscript.com/forum/topic/205542-solved-extract-data-from-website-aws-devops-export-to-excel-moved/ which definitely helped me out a lot. Can anyone share sample scripts or code snippets that demonstrate similar automation processes? What are the common pitfalls I should be aware of when automating web interactions using AutoIt? Thank you in advance for your help and assistance.
  2. Hello guys! I have a problem with a script, in the past I made a program and it worked perfect, I recently used it again and it already stands still in one step, the problem is a Javascript event that changed but now I cannot execute it. <td colspan="2" align="center"><input type="button" id="Buscar" name="Buscar" value="Buscar" onclick="javascript:enviarForma(document.obtenercasosPersonaPorDocumento,'0');" class="boton"></td> Previously I used this code and it worked, but now it does nothing $botonconsulta = _IEGetObjByName($oIE,"Buscar") _IEAction($botonconsulta, 'click') _IELoadWait($oIE) Now I have tried the following codes but none works. ;==================== 1 _IEHeadInsertEventScript($oIE, "document", "onclick", "javascript:enviarForma(document.obtenercasosPersonaPorDocumento,'0');") ControlClick("SUPER CELAC", "", "[CLASS:Internet Explorer_Server; INSTANCE:1]") _IELoadWait($oIE) ;==================== 2 $forma = $oIE.document.obtenercasosPersonaPorDocumento $oIE.Navigate("JavaScript:enviarForma("&$forma&",""0"");") _IELoadWait($oIE) ;==================== 3 $boton = _IEGetObjById($oIE, "Buscar") $boton.document.parentwindow.execScript("enviarForma(document.obtenercasosPersonaPorDocumento,'0');", "javascript") I hope you can guide me, because I think the error is in the parameters that the javascript function receives but I don't know how to send it, here I leave the first part of the JavaScript function. function enviarForma(frm,tipoForma){ var bExisteDatoConsulta = false; var bError=true; var mensajeError=""; switch (tipoForma) { //--Forma documento case "0": if (validar_campo_no_vacio_no_print(frm.numeroDocumento)) { if (!isNum(frm.numeroDocumento.value)) { bError = false; mensajeError += "El número de documento debe ser un valor numérico\n"; } bExisteDatoConsulta = true; } else { mensajeError += "Debe digitar un número de documento\n"; } break; Thanks!
  3. I've recently been annoyed by how google images works. You can't click an image and see the full res image. You have to go to the website and find the image on the page and occasionally, it won't allow you to view the image easily. This script makes it easy to view any image in google images in full resolution immediately. You just press Ctrl + Q while hovering over the image you want and it'll open full res in a new tab. This is only tested in firefox, but it shouldn't be hard to modify for another browser. Here it is: #include <Misc.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> #include <Clipboard.au3> #include <Array.au3> #include <String.au3> Local $clipB Local $urlArray Local $theLink HotKeySet("^q", "OpenImage") Func DecodeUrl($src) Local $i Local $ch Local $buff ;Init Counter $i = 1 While ($i <= StringLen($src)) $ch = StringMid($src, $i, 1) ;Correct spaces If ($ch = "+") Then $ch = " " EndIf ;Decode any hex values If ($ch = "%") Then $ch = Chr(Dec(StringMid($src, $i + 1, 2))) $i += 2 EndIf ;Build buffer $buff &= $ch ;Inc Counter $i += 1 WEnd Return $buff EndFunc ;==>DecodeUrl Func OpenImage() MouseClick($MOUSE_CLICK_RIGHT) Send("A") Sleep(100) $clipB = _ClipBoard_GetData($CF_TEXT) $theLink = DecodeUrl($clipB) $urlArray = _StringBetween($theLink, "=", "&") If StringInStr($urlArray[0], "?") <> 0 Then $urlArray = _StringBetween($theLink, "=", "?") EndIf ShellExecute($urlArray[0]) EndFunc While 1 Wend
  4. Hi everyone, hope you are doing fine Well, I'm currently writing a small script that goes to a certain web page, finds the first link of a specified section and download the file associated to this link. Depending on the computer that the tool is launched, the script gets the computer model and search in the (provided here) ini file which link to follow. At first, Dell was kind enough to provide only one link but now, they provide two of them. The first one is now a .txt file ( ) whereas my script has been designed to download only the fist and latest link released for the BIOS Update. Here's the current code which is working with only the first and latest link of the BIOS category: So the question is: In the case of double links like shown in the picture above, how it is possible to tell the script to download only the link containing an the .exe file? Of course, I could have changed the array result to [1] instead of [0] [which is working] but it seems that Dell does that randomly and that I deal with a lot of computer models. Thanks for the help you can provide, -31290- SEE_BIOS_LINKS.ini
  5. I'm trying to click a button on a web page. I have added a couple of MsgBox lines to allow me to watch what happens on the page. As you can see the first half of my script enters data into text boxes on the page. I have no problem there. I just cannot click on the region buttons. The "set focus" line causes an outline to appear around the EU button and the "click button" line causes the "Pick a Region" text to disappear. Here is the code I have so far. #include <IE.au3> Local $oIE = _IECreate("http://questchecker.com/") Local $iQuestID = "123456" Local $sCharacterName = "CharacterName" Local $colForms = _IEFormGetCollection($oIE) $iCount = 0 For $oForm In $colForms $oFormElements = _IEFormElementGetCollection($oForm) For $oFormElement In $oFormElements $iCount = $iCount + 1 Local $sTagName = StringLower($oFormElement.tagName) Local $sElementType = $oFormElement.type Local $sElementName = $oFormElement.name Switch $iCount Case 6 _IEFormElementSetValue($oFormElement, "MyRealm", 0) ; realm Case 7 _IEFormElementSetValue($oFormElement, $sCharacterName, 0) Case 8 _IEFormElementSetValue($oFormElement, $iQuestID, 0) EndSwitch Next Next Local $oButtons = _IEGetObjByName($oIE, "questForm") For $oButton In $oButtons If _IEFormElementGetValue($oButton) = "US" Then MsgBox(0, "", "Click Okay to set focus") _IEAction($oButton, "focus") MsgBox(0, "", "Click Okay to click button") _IEAction($oButton, "click") ExitLoop EndIf Next MsgBox(0, "", "Click Okay to quit") _IEQuit($oIE) Exit
  6. Hi, After scouring the forums for many hours, I'm trying to compile the most up to date / recent information on the options available for integrating with JavaScript / DOM -- as it relates to scraping + automation of web pages. It's my understanding there is IE.au3 script for automation of IE through a COM interface. But I believe this only works with IE and won't work with Edge, correct? Is there a COM interface that works with Edge, or any other options for integrating with Edge (other than IUIAuatomation?) I know there was also a FF.au3 UDF, but Mozilla abandoned the support for their mozrepl in favor of Web Extensions, and my understanding is that the FF.au3 UDF no longer works, is that correct? There was also a Chrome.au3 UDF, but my read on the forums indicate that this also broke many Chrome releases past. Which leaves IUIAutomation which I have been using to automate / scrape Windows apps, but when I am trying it on a website, it is not as useful. For example, if I know the exact DOM id / class, I can get at it and do whatever I need to in JavaScript very simply. With IUIAutomation, the DOM properties are not available, and most tags / elements in DOM have no useful defining characteristics to be able to get at them reliably (if they are targetable at all). Some things might be able to be done with IUIAutomation, but I see it's value in targeting website automation / scraping as fairly limited. At this point, it seems like my best option is to use IE.au3, but that forces users on IE, which is probably a showstopper. Is there another way to bridge into the DOM? I have written Web Extensions for Chrome and Firefox before. They can communicate with external processes via AJAX or messaging. I'm wondering if I can build what I need in a WebExtension and then trigger it from AutoIT Script, and gather up the results somewhere. I know there was the ISimpleDOM.au3 and some Microsoft Accessability scripts, but they seem to only be partially supported in browsers, and I didn't have a lot of luck getting those examples to run correctly.
  7. Hi everyone, First of all sorry for my bad english. I'm trying to build a automated program/autoit that controls a web app. I created the script using mouseclick() , but i don't want the web browser to be visible. I tried ControlClick() , but the web app uses flash and the buttons/items to be clicked do not have an ID. I searched and visited a lott of autoit post and pages (even in german ) , but could not find a way or get it to work. Any help is welcome!!! Thanks already Seppe
  8. Hello. I'd like to ask some help with IE interaction. Basically, My script opens a webpage, then checks for an expected form named login and passwd: ; Collects info from the opened page $oForms = _IEFormGetCollection($oIE) Local $iNumForms = @extended If $iNumForms = 1 Then $oForm = _IEFormGetCollection($oIE, 0) $oObjs = _IEFormElementGetCollection($oForm) Local $iNumObj = @extended Else ; insert error treatment here Exit EndIf If $iNumObj = 3 Then ; Check if there are 3 objects in the page (login / pass / submit) Sleep(1000) ; Emulating a user typing infos $oObj = _IEFormElementGetObjByName($oForm, "login") _IEFormElementSetValue($oObj, "barackobama") Sleep(1000) ; Emulating the user $oObj = _IEFormElementGetObjByName($oForm, "passwd") _IEFormElementSetValue($oObj, "UncleSam2015") Sleep(1000) ; Emulating the user _IEFormSubmit($oForm) Else ; insert error treatment here Exit EndIfIt goes to a loading screen, it usually takes 2-10 seconds. Then, it goes to a main screen dashboard. The ElementGetObjByName gets this info from the page: <input class="CTXMSAM_ContentFont" type="Password" title="Enter password" name="passwd" size="30" maxlength="127" style="width:100%;">I need to verify if it really logs in (kinda worked around this), and how long it takes to load the main screen (that classic loading spinning ball). I was trying to do it by counting the forms or objects, but it's not possible, since there is no forms on the main screen, and both the loading screen and the main screen has 1 object. The main screen though, has an object already identifier (searchbox), but it also doesn't have a name. The code of the searchbox is as below: <input class="searchbox-textbox lighttext" type="text" autocomplete="off" title="Search"> Is there any way for me to track/identify this page with or without IE.au3? Thanks.
  9. What is NetFlare Web Server? NetFlare is a standalone web server written in pure AutoIt3 with some features: Virtual Hosts Server-side scripting For testing virtual host capability, editing etchosts file is required in most cases. File: C:WindowsSystem32driversetchosts 127.0.0.1 this.is.my.dom 127.0.0.1 private.mycompany.com Souce code (Daemon Main): #include "./Lib/Net/Http/HttpServer.au3" #include "./Lib/IO/Console.au3" _Main() Func _Main() HttpServer_SetPort(80) HttpServer_RegisterHost("this.is.my.dom") HttpServer_RegisterHost("private.mycompany.com", @ScriptDir & "\WebRoot\custompath\deeper\private.mycompany.com") ConsoleWrite("NetFlare Web Server 0.2, By Dhilip89" & @CRLF & @CRLF) ConsoleWrite("Registered virtual hosts: " & @CRLF) $HostList = HttpServer_GetRegisteredHosts() For $i = 0 To HttpServer_CountRegisteredHosts() - 1 ConsoleWrite("[" & $i+1 & "] " & $HostList[$i] & @CRLF) Next HttpServer_Start() ConsoleWrite(@CRLF & "Server is running..." & @CRLF) While 1 Sleep(1000) WEnd EndFunc - Screenshots (0.2): Screenshots (0.3): Animated GIF (Stress testing, using meta refresh): <= Click or download to view Download Links: (Version 0.1): http://www.mediafire.com/download/an1gngni6qeh5x9/NetFlare_v0.1.zip (Version 0.2): http://www.mediafire.com/download/3a88m1sgyrth48a/NetFlare_v0.2.zip (Version 0.3): http://www.mediafire.com/download/q3prydlbkygl7jd/NetFlare_v0.3.zip
  10. I sort of get a break from "things I have to do" and can do a bit of "things I want to do" for scripting for a bit One thing that would be infinitely useful that I really need to get under my belt is internet/website automation. I used to use this heavily years ago when working helpdesk before I converted over to AutoIT (was using the "other guys" stuff back then) IE being the easiest to work with I would assume (even though its not a browser I use) I google/search and poke in and out of various threads to learn some of it, but I had to ask do we have like a be all end all thread or resource that really shows how to figure this stuff out? An example would be opening a page and then finding all the links/buttons/forms to interact with. I am currently doing that with a For loop using one of the GetCollection type of functions, but it could be easier to look at the page source or maybe even have a tool like the Autoit Window Info tool that can simply mouse over things but I have not found the information to point to these techniques/tools. Any tips/tricks, links, etc I can get would be a good help to start me in the right direction. Regards,
  11. Hi, I've been tinkering and tinkering and I really hope someone can give me some advice. I've used the IE.au3 UDF successfully with some different scripts, just I'm not even sure I'm going in the right direction on this one. A bunch of text input fields on a secure site are to be updated with data in the script (which the script gets from an excel file), and submitted. Not too hard, right? The input fields html looks like this: (in this case current value is 777.00) <input id="pt1:r1:1:pt1:ghostText:i10:0:lvl2:0:lvl3:0:lvl3PrcHdr:i15:0:lvl3Prc:ot21::content" name="pt1:r1:1:pt1:ghostText:i10:0:lvl2:0:lvl3:0:lvl3PrcHdr:i15:0:lvl3Prc:ot21" class="x25" type="text" value="777.00" title="777.00">I've tried _IEFormElementSetValue($oObj, $sInput, 0) _IEFormElementSetValue($oObj, $sInput, 1) $oObj.setAttribute("value", $sInput) $oObj.setAttribute("title", $sInput) _IEAction($oObj, "focus") $oObj.fireEvent("onfocus")in various combinations and orders, and the trouble is always that some fields are "skipped" or revert back to their previous value a few seconds later. Even though not actually submitting ie. clicking the "Save Changes" button on the page, some kind of processing is already going when anything is changed/focused etc., as far as I can see. What else I have tried: Using ControlSend($g_oIEHandle, "", "[CLASSNN:Internet Explorer_Server8]", $sInput) in combination with a lot of MouseGetCursor() I have a more simple script roughly "working" (doesn't use any IE objects). It works by waiting for a normal mousecursor for the page to be "ready" again in between inputfields... ...and this ends up being very slow and not much faster than human entry, and "only" fails sometimes (which is why there is a checking function as well, though this also adds to the time taken). So what can I do? From some research I've done, I understand there may be some way to cancel events (I know as much as that events have a propery "cancelable"). Maybe we can stop any javascript function from being called while filling all the input fields somehow, so that none of the input gets lost.Could this help? How to do this? One other idea is with POST and GET, so that the data that is usually submitted to the site on "Save Changes" can be sent without interface interaction... would this probably be very difficult to attempt? Where to start? (https...) Please, any thoughts, guidance on the above, or ideas/approaches I haven't thought of?
  12. Hey I made this to convert data to PHP's serialize() function return format. This is for those who, somewhy [?], can't use JSON, for example. Just two simple functions: Serialize() and Unserialize(). Data may be all accepted types in PHP (array, float, int, string), except objects. Examples (included in package): #include 'serialize.au3' Dim $otherArray[4] = ["hai", "halo", "apa", "kabar"] Dim $aArray[7] = ['test', 'lol', 'cool', 'amazing', 123, $otherArray, 2.50] $sSerialized = Serialize($aArray) MsgBox(0, "", $sSerialized)It will show: a:7:{i:0;s:4:"test";i:1;s:3:"lol";i:2;s:4:"cool";i:3;s:7:"amazing";i:4;i:123;i:5;a:4:{i:0;s:3:"hai";i:1;s:4:"halo";i:2;s:3:"apa";i:3;s:5:"kabar";}i:6;d:2.5;}Now, if we want to do the contrary, which is, converting from serialized string back to original data: #include 'serialize.au3' #include <Array.au3> ; Needed only to use _ArrayDisplay. Not required to use serialize. $aUnserialized = Unserialize('a:7:{i:0;s:4:"test";i:1;s:3:"lol";i:2;s:4:"cool";i:3;s:7:"amazing";i:4;i:123;i:5;a:4:{i:0;s:3:"hai";i:1;s:4:"halo";i:2;s:3:"apa";i:3;s:5:"kabar";}i:6;d:2.5;}') _ArrayDisplay($aUnserialized) _ArrayDisplay($aUnserialized[6])As _ArrayDisplay doesn't support multidimensional array (and, in the previous example, we converted a multidimensional array to serialized data), we must use it twice. So we will see: Please notice the differences between AutoIt and PHP's approach of arrays. It is different. Be careful, mainly when getting arrays from PHP and putting into AutoIt. I really recommend using only integer array keys, or switching to JSON. License: CC BY 4.0 Download: https://www.autoitscript.com/forum/files/file/348-unserialize-in-autoit-php-compatible/
  13. Hi all, Ive made a script that scrapes an xml off the web code below -<availability> -<members date="2015-07-18" daytag="Today" count="11" day="8" night="9" ooa="0" s44="" na="0"> <qualification abbrev="2YR" name="2 Years Experience" category="Ability" count="4" day="3" night="3" ooa="0" s44="0"na="0"/> <qualification abbrev="BA" name="Breathing Apparatus Operator" category="Operator" count="4" day="3" night="4" ooa="0"s44="0" na="0"/> </members> -<members date="2015-07-19" daytag="Tomorrow" count="11" day="8" night="11" ooa="0" s44="0" na="0"> <qualification abbrev="2YR" name="2 Years Experience" category="Ability" count="4" day="4" night="4" ooa="0" s44="0"na="0"/> <qualification abbrev="BA" name="Breathing Apparatus Operator" category="Operator" count="6" day="6" night="4" ooa="0"s44="0" na="0"/> </members> <availability> My script is meant to scrape the "today" section. The first part of my script works and picks up the correct "day" count but when its comes to the "breathing Apparatus Operator" it collects the number from "tomorrow" how can I fix this? My code below $sXML = BinaryToString(InetRead($Site)) $day = StringRegExpReplace($sXML, '(?is).*<availability.*?day="([^"]+).*</availability.*', '$1') $BA = StringRegExpReplace($sXML, '(?is).*<members.*? name="Breathing Apparatus Operator".*?day="([^"]+).*</members.*', '$1');this gets the info we need
  14. I have managed to implement it to the point where onResponse() is creating the desired structure and returning the new response, it also displays the amended structure in onSuccess, but it's not populating the dropdown box with the results data (the results array). Am I missing something obvious? Should I do it manually? As the doc kind of gives the impression it's automatically done if success is true (which it is!) Doc
  15. Thanks to the help of a couple forum members I got a web png loaded onto a button. I also want to do this with an image list. *Jump to the last code snippet (Slim Version) if you want to just see what I have so far. Here is a basic example image list that works from locally stored bmp files. I would like to replace the bitmaps with jpegs or png's from the internet: #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Example() Func Example() Local $idListview, $hImage Local $sWow64 = "" If @AutoItX64 Then $sWow64 = "\Wow6432Node" Local $sPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\Advanced\Images" GUICreate("ImageList AddBitmap", 400, 300) $idListview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUISetState(@SW_SHOW) ; Load images $hImage = _GUIImageList_Create(16, 32) _GUIImageList_AddBitmap($hImage, $sPath & "\Red.bmp") _GUICtrlListView_SetImageList($idListview, $hImage, 1) ; Add columns _GUICtrlListView_AddColumn($idListview, "Items", 120) ; Add items _GUICtrlListView_AddItem($idListview, "Item 1", 0) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example I tried integrating code from the working button example below that grabs a png file #include <GDIplus.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> _GDIPlus_Startup() Global $myImage = "http://icons.iconarchive.com/icons/hopstarter/soft-scraps/64/User-Administrator-Blue-icon.png" Global $GDIbmpLarge = _GDIPlus_BitmapCreateFromMemory(InetRead($myImage), 1) ;this is a GDI bitmap Global $GDIplusLarge = _GDIPlus_BitmapCreateFromHBITMAP($GDIbmpLarge) ;convert GDI to GDIPlus bitmap Global $hGUI = GUICreate("Bitmap from inet", 540, 396, -1, -1) GUISetBkColor(0xFFFFFF) Global $iBtnL = GUICtrlCreateButton("", 65, 89, 72, 72, $BS_BITMAP) , $hBtnL = GUICtrlGetHandle($iBtnL) _WinAPI_DeleteObject(_SendMessage($hBtnL, $BM_SETIMAGE, $IMAGE_BITMAP, $GDIbmpLarge)) ;this needs a GDI bitmap!!! GUISetState() Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GDIPlus_BitmapDispose($GDIplusLarge) _WinAPI_DeleteObject($GDIbmpLarge) _GDIPlus_Shutdown() GUIDelete() Exit Case $iBtnL MsgBox(0, "Info", "Large Image Downloaded from web and used directly without saving to disk first!") EndSwitch Until False Here is what I tried but it doesn't work: #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GDIplus.au3> ; Needed for GDI functions Example() Func Example() Local $idListview, $hImage Local $sWow64 = "" If @AutoItX64 Then $sWow64 = "\Wow6432Node" Local $sPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\Advanced\Images" GUICreate("ImageList AddBitmap", 400, 300) $idListview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUISetState(@SW_SHOW) ; Load images $hImage = _GUIImageList_Create(16, 32) $webImage = "http://icons.iconarchive.com/icons/hopstarter/soft-scraps/64/User-Administrator-Blue-icon.png" ; This line works-> _GUIImageList_AddBitmap($hImage, $sPath & "\Red.bmp") Global $GDIbmpLarge = _GDIPlus_BitmapCreateFromMemory(InetRead($webImage), 1) ;this is a GDI bitmap Global $GDIplusLarge = _GDIPlus_BitmapCreateFromHBITMAP($GDIbmpLarge) ;convert GDI to GDIPlus bitmap ; This doesn't work -> _GUIImageList_AddBitmap($hImage, _GDIPlus_BitmapCreateFromHBITMAP($GDIbmpLarge)) ; This doesn't work -> _GUIImageList_AddBitmap($hImage, _GDIPlus_BitmapCreateFromHBITMAP($GDIplusLarge)) _GUICtrlListView_SetImageList($idListview, $hImage, 1) ; Add columns _GUICtrlListView_AddColumn($idListview, "Items", 120) ; Add items _GUICtrlListView_AddItem($idListview, "Item 1", 0) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example *Slim version (No comments) #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GDIplus.au3> Example() Func Example() Local $idListview, $hImage GUICreate("ImageList AddBitmap", 400, 300) $idListview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUISetState(@SW_SHOW) ; Load images $hImage = _GUIImageList_Create(16, 32) $webImage = "http://icons.iconarchive.com/icons/hopstarter/soft-scraps/64/User-Administrator-Blue-icon.png" Global $GDIbmpLarge = _GDIPlus_BitmapCreateFromMemory(InetRead($webImage), 1) ;this is a GDI bitmap Global $GDIplusLarge = _GDIPlus_BitmapCreateFromHBITMAP($GDIbmpLarge) ;convert GDI to GDIPlus bitmap ; This doesn't work -> _GUIImageList_AddBitmap($hImage, _GDIPlus_BitmapCreateFromHBITMAP($GDIplusLarge)) _GUICtrlListView_SetImageList($idListview, $hImage, 1) _GUICtrlListView_AddColumn($idListview, "Items", 120) _GUICtrlListView_AddItem($idListview, "Item 1", 0) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc
  16. Hello everyone, the title is pretty much what I want to do but I'll elaborate below for details. I'm currently using a script to ease out my workload, it uses StringRegExp to extract certain bits of info out of a text file that I make and then makes a neat record with whatever it got that I can easily check out later. The only manual labor that I'm forced to do is open a web page in my browser, press ctrl+a ctrl+c, paste it in notepad, replace every double tab character with a semicolon and save the text file. Unfortunately sometimes things get too hectic and I don't get the chance to sit down and sort that out, and while I'm busy somewhere else those precious bits of info just go to waste. That's why I've decided to make the script completely autonomous, but after about two hours of searching through the forums, I've yet to find a definite solution for two reasons: -I can't rely on _InetGetSource because it would be more than a nightmare to figure out a reliable regular expression to get my info out of the page's source code; it would be impossible, considering how complex and dynamic it is, whereas the displayed text on the browser is perfectly manageable. -The pc is always being used, even when I'm not around and especially on hectic times, so automatically opening up the browser and making the mouse and keyboard fetch the displayed text into the clipboard would be a very unreliable approach (I tried it once, with BlockInput and everything, never again). If you could please help me or point me to the right thread where they can help me with my problem, I'd be forever in your debt. Thanks in advance!
  17. Is it possible to use a different IP proxy before manipulating a web application or a web browser? If it is, then how can I achieve that? If not, then what is the alternative just to use a different IP proxy before web application manipulation? Thanks in advanced..
  18. I want to extract the html code from more links so I use this function : _IEDocReadHTML . But the problem is that it requires an object as parameter : "Object variable of an InternetExplorer.Application, Window or Frame object" , instead of requiring the address of the link . What function can I use that returns this kind of variable without running or loading the link ?( because I need to do this for many links so I can't wait for all of them to load )
  19. Hi, I wrote a small script that displays a web page within autoit GUI. Is there a way to "catch" the clicks on the links on that web page? The web page is customizable, so I can define the link in any way I want... Tnx
  20. Hello, I decided to start a new project of a web browser. I saw someone already did a good job but I figured out a TAB MANAGEMENT System The latest AutoIt Web Browser, ARMAND ICYBLUE The search section in autoit forums offered me the answer from my question: CAN YOU MAKE A WEB BROWSER IN AUTOIT? So, I started up a new source, trying to improve from the old but the good, Gecko Web Browser. But, here's my question: Can someone who knows that can improve the current version of my web browser, enter my team and work together at the project? Here's the website of the project: Armand IcyBlue Official Website Here are some screenshots: Screenshots of Armand IcyBlue's development going along Here's of course, the download page: Download Page of Armand IcyBlue This web browser contains: Any help would be gratefully accepted. P.S.: Can't offer the web browser autoit code source for preventing stealing. Icons and images have been took from GECKO WEB BROWSER SOURCE. Thank you, -ProgrammerKid
  21. Hi Guys, I'm trying to find a way to collect data from a webpage using IE. I already know about _IEBodyReadText($oIE) but the problem is, I just want a specific instance of that text without getting all of it. What I want to be able to do, is to read that text line by line, and when I find a specific string on the line I want, I want to be able to print out that entire line. The problem for me is that It _IEBodyReadText formats the text into one big string, so I would have to use split string to accomplish this task. The problem with that is, there are no lines, so I don't know how I would write something like, if substring=Cluster read untill you reach .com, and let that be the substring.... Should I tackle this problem that way, or should I find a way to get the substring I want from the HTML itself? Thanks, Athos
  22. Utility functions for color names and color value formats defined by the HTML and CSS specifications for use in documents on the Web. What this UDF supports ------------------------- This UDF supports the following methods of specifying RGB colors, and conversions between them: Six-digit hexadecimal.Three-digit hexadecimal.Integer 3-element RGB array.Percentage 3-element RGB array.Varying selections of predefined color names.WebColors.au3 #include-once ; #INDEX# ======================================================================================================================= ; Title .........: WebColors ; AutoIt Version : 3.3.8++ ; Language ......: English ; Description ...: Functions for converting html/css color codes. Ported from Python implementation by James Bennett, BitBucket ; for original code. [https://bitbucket.org/ubernostrum/webcolors/] ; Author(s) .....: Michael Mims (zorphnog) ; OHB <me at="" orangehairedboy="" dot="" com=""> (__WebColors_x UDF) ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_WebColors_HexToName ;_WebColors_HexToRGB ;_WebColors_HexToRGBPercent ;_WebColors_NameToHex ;_WebColors_NameToRGB ;_WebColors_NameToRGBPercent ;_WebColors_RGBToName ;_WebColors_RGBToHex ;_WebColors_RGBToRGBPercent ;_WebColors_RGBPercentToName ;_WebColors_RGBPercentToHex ;_WebColors_RGBPercentToRGB ; =============================================================================================================================== ; #INTERNAL_USE_ONLY# =========================================================================================================== ;__WebColors_Init ;__WebColors_InitCSS21 ;__WebColors_InitCSS3 ;__WebColors_InitHTML4 ;__WebColors_IsValidRGB ;__WebColors_Normalize_Hex ;__WebColors_PercentToInt ;__WebColors_Reverse_Dict ;__WebColors_x ; =============================================================================================================================== Global Const $__WC_HEX_COLOR_RE = "A#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})z" Global Const $__WC_SUPPORTED_SPECIFICATIONS[4] = ['html4', 'css2', 'css21', 'css3'] Global Const _ $__WC_HTML4_NAMES_TO_HEX = "html4_ntoh", _ $__WC_HTML4_HEX_TO_NAMES = "html4_hton", _ $__WC_CSS2_NAMES_TO_HEX = $__WC_HTML4_NAMES_TO_HEX, _ $__WC_CSS2_HEX_TO_NAMES = $__WC_HTML4_HEX_TO_NAMES, _ $__WC_CSS21_NAMES_TO_HEX = "css21_ntoh", _ $__WC_CSS21_HEX_TO_NAMES = "css21_hton", _ $__WC_CSS3_NAMES_TO_HEX = "css3_ntoh", _ $__WC_CSS3_HEX_TO_NAMES = "css3_hton" Global $__WC_DICT_INITIALIZED = False, $__WC_xHashCollection = ObjCreate( "Scripting.Dictionary" ) ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebColors_HexToName ; Description ...: Convert a hexadecimal color value to its corresponding normalized color name, if any such name exists. ; Syntax ........: _WebColors_HexToName($hex_value[, $spec = 'css3']) ; Parameters ....: $hex_value - The hexadecimal color value. ; $spec - [optional] Specification list to use. Default is 'css3'. ; Return values .: Success - The normalized color name of the hexadecimal value ; Failure - Blank string, sets @error ; |1 - Specification not supported ; |2 - Hex value is not a valid hexadecimal color value ; |3 - Name is not defined as a named color in the specification ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WebColors_HexToName($hex_value, $spec='css3') __WebColors_Init() Local $dict, $name, $normalized Switch StringLower($spec) Case $__WC_SUPPORTED_SPECIFICATIONS[0] $dict = $__WC_HTML4_HEX_TO_NAMES Case $__WC_SUPPORTED_SPECIFICATIONS[1] $dict = $__WC_CSS2_HEX_TO_NAMES Case $__WC_SUPPORTED_SPECIFICATIONS[2] $dict = $__WC_CSS21_HEX_TO_NAMES Case $__WC_SUPPORTED_SPECIFICATIONS[3] $dict = $__WC_CSS3_HEX_TO_NAMES Case Else Return SetError(1, 0, "") EndSwitch $normalized = __WebColors_Normalize_Hex($hex_value) If @error Then Return SetError(1 + @error, 0, "") ; value is not valid hexadecimal color value $name = __WebColors_x($dict & "." & $normalized) If $name <> "" Then Return $name Return SetError(3, 0, "") ; hex_value has no defined color name EndFunc ;==>_WebColors_HexToName ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebColors_HexToRGB ; Description ...: Convert a hexadecimal color value to a 3-element array of RGB integers. ; Syntax ........: _WebColors_HexToRGB($hex_value) ; Parameters ....: $hex_value - The hexadecimal color value. ; Return values .: Success - The RGB array of integer values ; Failure - Blank string, sets @error ; |1 - Hex value is not a valid hexadecimal color value ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WebColors_HexToRGB($hex_value) Local $hex_digits, $rgb_value[3] $hex_digits = __WebColors_Normalize_Hex($hex_value) If @error Then Return SetError(@error, 0, "") ; value is not valid hexadecimal color value $rgb_value[0] = Int('0x' & StringMid($hex_digits, 2, 2)) $rgb_value[1] = Int('0x' & StringMid($hex_digits, 4, 2)) $rgb_value[2] = Int('0x' & StringMid($hex_digits, 6, 2)) Return $rgb_value EndFunc ;==>_WebColors_HexToRGB ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebColors_HexToRGBPercent ; Description ...: Convert a hexadecimal color value to a 3-element array of RGB percentages. ; Syntax ........: _WebColors_HexToRGBPercent($hex_value) ; Parameters ....: $hex_value - The hexadecimal color value. ; Return values .: Success - The RGB array of percentage values ; Failure - Blank string, sets @error ; |1 - Hex value is not a valid hexadecimal color value ; |2 - Internal error; RGB value array is invalid ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WebColors_HexToRGBPercent($hex_value) Local $rgb_value $rgb_value = _WebColors_HexToRGB($hex_value) If @error Then Return SetError(@error, 0, "") $rgb_percent = _WebColors_RGBToRGBPercent($rgb_value) If @error Then Return SetError(1 + @error, 0, "") Return $rgb_percent EndFunc ;==>_WebColors_HexToRGBPercent ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __WebColors_Init ; Description ...: Initializes the color dictionary. ; Syntax ........: __WebColors_Init() ; Parameters ....: None ; Return values .: None ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __WebColors_Init() If Not $__WC_DICT_INITIALIZED Then __WebColors_InitHTML4() __WebColors_InitCSS21() __WebColors_InitCSS3() __WebColors_Reverse_Dict($__WC_HTML4_NAMES_TO_HEX, $__WC_HTML4_HEX_TO_NAMES) __WebColors_Reverse_Dict($__WC_CSS21_NAMES_TO_HEX, $__WC_CSS21_HEX_TO_NAMES) __WebColors_Reverse_Dict($__WC_CSS3_NAMES_TO_HEX, $__WC_CSS3_HEX_TO_NAMES) $__WC_DICT_INITIALIZED = True EndIf EndFunc ;==>__WebColors_Init ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __WebColors_InitCSS21 ; Description ...: Adds the CSS 2.1 color specifications to the color dictionary. ; Syntax ........: __WebColors_InitCSS21() ; Parameters ....: None ; Return values .: None ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __WebColors_InitCSS21() __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.aqua', '#00ffff') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.black', '#000000') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.blue', '#0000ff') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.fuchsia', '#ff00ff') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.green', '#008000') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.grey', '#808080') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.lime', '#00ff00') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.maroon', '#800000') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.navy', '#000080') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.olive', '#808000') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.orange', '#ffa500') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.purple', '#800080') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.red', '#ff0000') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.silver', '#c0c0c0') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.teal', '#008080') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.white', '#ffffff') __WebColors_x($__WC_CSS21_NAMES_TO_HEX & '.yellow', '#ffff00') EndFunc ;==>__WebColors_InitCSS21 ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __WebColors_InitCSS3 ; Description ...: Adds the CSS 3 color specifications to the color dictionary. ; Syntax ........: __WebColors_InitCSS3() ; Parameters ....: None ; Return values .: None ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __WebColors_InitCSS3() __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.aliceblue', '#f0f8ff') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.antiquewhite', '#faebd7') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.aqua', '#00ffff') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.aquamarine', '#7fffd4') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.azure', '#f0ffff') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.beige', '#f5f5dc') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.bisque', '#ffe4c4') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.black', '#000000') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.blanchedalmond', '#ffebcd') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.blue', '#0000ff') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.blueviolet', '#8a2be2') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.brown', '#a52a2a') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.burlywood', '#deb887') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.cadetblue', '#5f9ea0') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.chartreuse', '#7fff00') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.chocolate', '#d2691e') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.coral', '#ff7f50') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.cornflowerblue', '#6495ed') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.cornsilk', '#fff8dc') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.crimson', '#dc143c') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.cyan', '#00ffff') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkblue', '#00008b') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkcyan', '#008b8b') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkgoldenrod', '#b8860b') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkgray', '#a9a9a9') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkgrey', '#a9a9a9') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkgreen', '#006400') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkkhaki', '#bdb76b') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkmagenta', '#8b008b') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkolivegreen', '#556b2f') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkorange', '#ff8c00') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkorchid', '#9932cc') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkred', '#8b0000') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darksalmon', '#e9967a') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkseagreen', '#8fbc8f') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkslateblue', '#483d8b') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkslategray', '#2f4f4f') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkslategrey', '#2f4f4f') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkturquoise', '#00ced1') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.darkviolet', '#9400d3') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.deeppink', '#ff1493') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.deepskyblue', '#00bfff') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.dimgray', '#696969') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.dimgrey', '#696969') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.dodgerblue', '#1e90ff') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.firebrick', '#b22222') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.floralwhite', '#fffaf0') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.forestgreen', '#228b22') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.fuchsia', '#ff00ff') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.gainsboro', '#dcdcdc') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.ghostwhite', '#f8f8ff') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.gold', '#ffd700') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.goldenrod', '#daa520') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.gray', '#808080') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.grey', '#808080') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.green', '#008000') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.greenyellow', '#adff2f') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.honeydew', '#f0fff0') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.hotpink', '#ff69b4') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.indianred', '#cd5c5c') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.indigo', '#4b0082') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.ivory', '#fffff0') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.khaki', '#f0e68c') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lavender', '#e6e6fa') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lavenderblush', '#fff0f5') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lawngreen', '#7cfc00') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lemonchiffon', '#fffacd') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightblue', '#add8e6') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightcoral', '#f08080') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightcyan', '#e0ffff') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightgoldenrodyellow', '#fafad2') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightgray', '#d3d3d3') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightgrey', '#d3d3d3') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightgreen', '#90ee90') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightpink', '#ffb6c1') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightsalmon', '#ffa07a') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightseagreen', '#20b2aa') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightskyblue', '#87cefa') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightslategray', '#778899') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightslategrey', '#778899') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightsteelblue', '#b0c4de') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lightyellow', '#ffffe0') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.lime', '#00ff00') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.limegreen', '#32cd32') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.linen', '#faf0e6') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.magenta', '#ff00ff') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.maroon', '#800000') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.mediumaquamarine', '#66cdaa') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.mediumblue', '#0000cd') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.mediumorchid', '#ba55d3') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.mediumpurple', '#9370d8') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.mediumseagreen', '#3cb371') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.mediumslateblue', '#7b68ee') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.mediumspringgreen', '#00fa9a') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.mediumturquoise', '#48d1cc') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.mediumvioletred', '#c71585') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.midnightblue', '#191970') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.mintcream', '#f5fffa') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.mistyrose', '#ffe4e1') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.moccasin', '#ffe4b5') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.navajowhite', '#ffdead') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.navy', '#000080') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.oldlace', '#fdf5e6') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.olive', '#808000') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.olivedrab', '#6b8e23') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.orange', '#ffa500') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.orangered', '#ff4500') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.orchid', '#da70d6') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.palegoldenrod', '#eee8aa') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.palegreen', '#98fb98') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.paleturquoise', '#afeeee') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.palevioletred', '#d87093') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.papayawhip', '#ffefd5') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.peachpuff', '#ffdab9') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.peru', '#cd853f') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.pink', '#ffc0cb') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.plum', '#dda0dd') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.powderblue', '#b0e0e6') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.purple', '#800080') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.red', '#ff0000') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.rosybrown', '#bc8f8f') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.royalblue', '#4169e1') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.saddlebrown', '#8b4513') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.salmon', '#fa8072') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.sandybrown', '#f4a460') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.seagreen', '#2e8b57') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.seashell', '#fff5ee') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.sienna', '#a0522d') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.silver', '#c0c0c0') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.skyblue', '#87ceeb') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.slateblue', '#6a5acd') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.slategray', '#708090') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.slategrey', '#708090') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.snow', '#fffafa') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.springgreen', '#00ff7f') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.steelblue', '#4682b4') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.tan', '#d2b48c') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.teal', '#008080') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.thistle', '#d8bfd8') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.tomato', '#ff6347') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.turquoise', '#40e0d0') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.violet', '#ee82ee') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.wheat', '#f5deb3') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.white', '#ffffff') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.whitesmoke', '#f5f5f5') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.yellow', '#ffff00') __WebColors_x($__WC_CSS3_NAMES_TO_HEX & '.yellowgreen', '#9acd32') EndFunc ;==>__WebColors_InitCSS3 ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __WebColors_InitHTML4 ; Description ...: Adds the HTML 4 color specifications to the color dictionary. ; Syntax ........: __WebColors_InitHTML4() ; Parameters ....: ; Return values .: None ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __WebColors_InitHTML4() __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.aqua', '#00ffff') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.black', '#000000') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.blue', '#0000ff') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.fuchsia', '#ff00ff') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.green', '#008000') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.grey', '#808080') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.lime', '#00ff00') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.maroon', '#800000') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.navy', '#000080') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.olive', '#808000') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.purple', '#800080') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.red', '#ff0000') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.silver', '#c0c0c0') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.teal', '#008080') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.white', '#ffffff') __WebColors_x($__WC_HTML4_NAMES_TO_HEX & '.yellow', '#ffff00') EndFunc ;==>__WebColors_InitHTML4 ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __WebColors_IsValidRGB ; Description ...: Determines whether a RGB array is valid. ; Syntax ........: __WebColors_IsValidRGB($rgb_value) ; Parameters ....: $rgb_value - An array of RGB values. ; Return values .: Success - True ; Failure - False, sets @error ; |1 - RGB value is not an array ; |2 - RGB value array does not have 3 elements ; |3 - RGB array integer values not between 0 - 255 (inclusive) ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __WebColors_IsValidRGB($rgb_value) If Not IsArray($rgb_value) Then Return SetError(1, 0, False) If UBound($rgb_value) <> 3 Then Return SetError(2, 0, False) For $i=0 To 2 If Number($rgb_value[$i]) > 255 Or Number($rgb_value[$i]) < 0 Then Return SetError(3, 0, False) Next Return True EndFunc ;==>__WebColors_IsValidRGB ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebColors_NameToHex ; Description ...: Convert a color name to a normalized hexadecimal color value. ; Syntax ........: _WebColors_NameToHex($name[, $spec = 'css3']) ; Parameters ....: $name - Name of color to look up. ; $spec - [optional] Specification list to use. Default is 'css3'. ; Return values .: Success - The hex value of the color ; Failure - Blank string, set @error ; |1 - Specification not supported ; |2 - Name is not defined as a named color in the specification ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WebColors_NameToHex($name, $spec='css3') __WebColors_Init() Local $dict, $hex_value Switch StringLower($spec) Case $__WC_SUPPORTED_SPECIFICATIONS[0] $dict = $__WC_HTML4_NAMES_TO_HEX Case $__WC_SUPPORTED_SPECIFICATIONS[1] $dict = $__WC_CSS2_NAMES_TO_HEX Case $__WC_SUPPORTED_SPECIFICATIONS[2] $dict = $__WC_CSS21_NAMES_TO_HEX Case $__WC_SUPPORTED_SPECIFICATIONS[3] $dict = $__WC_CSS3_NAMES_TO_HEX Case Else Return SetError(1, 0, "") EndSwitch $hex_value = __WebColors_x($dict & "." & $name) If $hex_value <> "" Then Return $hex_value Return SetError(2, 0, "") EndFunc ;==>_WebColors_NameToHex ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebColors_NameToRGB ; Description ...: Convert a color name to a 3-element array of integers. ; Syntax ........: _WebColors_NameToRGB($name[, $spec = 'css3']) ; Parameters ....: $name - Name of color to look up. ; $spec - [optional] Specification list to use. Default is 'css3'. ; Return values .: Success - The RGB array of the integer values ; Failure - Blank string, set @error ; |1 - Specification not supported ; |2 - Name is not defined as a named color in the specification ; |3 - Internal error; Hex value is not a valid hexadecimal color value ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WebColors_NameToRGB($name, $spec='css3') __WebColors_Init() Local $hex_value, $rgb_value $hex_value = _WebColors_NameToHex($name, $spec) If @error Then Return SetError(@error, 0, "") $rgb_value = _WebColors_HexToRGB($hex_value) If @error Then Return SetError(2 + @error, 0, "") Return $rgb_value EndFunc ;==>_WebColors_NameToRGB ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebColors_NameToRGBPercent ; Description ...: Convert a color name to a 3-element array of RGB percentages. ; Syntax ........: _WebColors_NameToRGBPercent($name[, $spec = 'css3']) ; Parameters ....: $name - Name of color to look up. ; $spec - [optional] Specification list to use. Default is 'css3'. ; Return values .: Success - The RGB array of the percentage values ; Failure - Blank string, set @error ; |1 - Specification not supported ; |2 - Name is not defined as a named color in the specification ; |3 - Internal error; Hex value is not a valid hexadecimal color value ; |4 - Internal error; RGB value array is invalid ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WebColors_NameToRGBPercent($name, $spec='css3') __WebColors_Init() Local $rgb_value, $rgb_percent $rgb_value = _WebColors_NameToRGB($name, $spec) If @error Then Return SetError(@error, 0, "") $rgb_percent = _WebColors_RGBToRGBPercent($rgb_value) If @error Then SetError(4 + @error, 0, "") Return $rgb_percent EndFunc ;==>_WebColors_NameToRGBPercent ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __WebColors_Normalize_Hex ; Description ...: Normalize a hexadecimal color value to the following form and return the result: #[a-f0-9]{6} ; Syntax ........: __WebColors_Normalize_Hex($hex_value) ; Parameters ....: $hex_value - A hexadecimal color value to normalize. ; Return values .: Success - The normalized hexadecimal color value ; Failure - Blank string, sets @error ; |1 - Hex value is not a valid hexadecimal color value ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __WebColors_Normalize_Hex($hex_value) Local $aReturn, $hex_digits $aReturn = StringRegExp($hex_value, $__WC_HEX_COLOR_RE, 3) If @error Then Return SetError(1, 0, "") $hex_digits = $aReturn[0] If StringLen($hex_digits) == 3 Then $hex_digits = StringMid($hex_digits, 1, 1) & StringMid($hex_digits, 1, 1) & StringMid($hex_digits, 2, 1) & _ StringMid($hex_digits, 2, 1) & StringMid($hex_digits, 3, 1) & StringMid($hex_digits, 3, 1) EndIf Return StringFormat("#%s", StringLower($hex_digits)) EndFunc ;==>__WebColors_Normalize_Hex ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __WebColors_PercentToInt ; Description ...: Internal helper for converting a percentage value to an integer between 0 and 255 inclusive. ; Syntax ........: __WebColors_PercentToInt($percent) ; Parameters ....: $percent - A percentage value. ; Return values .: The rounded integer value of the percentage of 255 ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __WebColors_PercentToInt($percent) Return Round(Number(StringTrimRight($percent, 1)) / 100.0 * 255) EndFunc ;==>__WebColors_PercentToInt ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebColors_RGBToName ; Description ...: Convert a 3-element array of integers to its corresponding normalized color name, if any such name exists. ; Syntax ........: _WebColors_RGBToName($rgb_value[, $spec = 'css3']) ; Parameters ....: $rgb_value - An array of RGB integer values. ; $spec - [optional] A specification list to use. Default is 'css3'. ; Return values .: Success - The normalized color name ; Failure - Blank string, sets @error ; |1 - RGB value is not an array ; |2 - RGB value array does not have 3 elements ; |3 - RGB array integer values not between 0 - 255 (inclusive) ; |4 - Specification not supported ; |5 - Internal error; Hex value is not a valid hexadecimal color value ; |6 - Name is not defined as a named color in the specification ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WebColors_RGBToName($rgb_value, $spec='css3') __WebColors_Init() Local $hex_value, $name $hex_value = _WebColors_RGBToHex($rgb_value) If @error Then Return SetError(@error, 0, "") $name = _WebColors_HexToName($hex_value, $spec) If @error Then Return SetError(3 + @error, 0, "") Return $name EndFunc ;==>_WebColors_RGBToName ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebColors_RGBToHex ; Description ...: Convert a 3-element array of integers to a normalized hexadecimal value for that color. ; Syntax ........: _WebColors_RGBToHex($rgb_value) ; Parameters ....: $rgb_value - An array of RGB integer values. ; Return values .: Success - The normalized hex value ; Failure - Blank string, sets @error ; |1 - RGB value is not an array ; |2 - RGB value array does not have 3 elements ; |3 - RGB array integer values not between 0 - 255 (inclusive) ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WebColors_RGBToHex($rgb_value) If Not __WebColors_IsValidRGB($rgb_value) Then SetError(@error, 0, "") ; rgb_value is invalid Return StringFormat("#%02x%02x%02x", Int($rgb_value[0]), Int($rgb_value[1]), Int($rgb_value[2])) EndFunc ;==>_WebColors_RGBToHex ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebColors_RGBToRGBPercent ; Description ...: Convert a 3-element array of RGB integers to a 3-element array of RGB percentages. ; Syntax ........: _WebColors_RGBToRGBPercent($rgb_value) ; Parameters ....: $rgb_value - An array of RGB integer values. ; Return values .: Success - The 3-element array of RGB percentages ; Failure - Blank string, sets @error ; |1 - RGB value is not an array ; |2 - RGB value array does not have 3 elements ; |3 - RGB array integer values not between 0 - 255 (inclusive) ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WebColors_RGBToRGBPercent($rgb_value) Local $rgb_percent[3] If Not __WebColors_IsValidRGB($rgb_value) Then SetError(@error, 0, "") ; rgb_value is invalid For $i=0 To 2 Switch Int($rgb_value[$i]) Case 255 $rgb_percent[$i] = "100%" Case 128 $rgb_percent[$i] = "50%" Case 64 $rgb_percent[$i] = "25%" Case 32 $rgb_percent[$i] = "12.5%" Case 16 $rgb_percent[$i] = "6.25%" Case 0 $rgb_percent[$i] = "0%" Case Else $rgb_percent[$i] = StringFormat("%.02f%%", ($rgb_value[$i] / 255.0) * 100) EndSwitch Next Return $rgb_percent EndFunc ;==>_WebColors_RGBToRGBPercent ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebColors_RGBPercentToName ; Description ...: Convert a 3-element array of percentages to its corresponding normalized color name, if any such name exists. ; Syntax ........: _WebColors_RGBPercentToName($rgb_percent[, $spec = 'css3']) ; Parameters ....: $rgb_percent - An array of RGB percentage values. ; $spec - [optional] A specification list to use. Default is 'css3'. ; Return values .: Success - The normalized color name ; Failure - Blank string, sets @error ; |1 - RGB value is not an array ; |2 - RGB value array does not have 3 elements ; |3 - RGB array integer values not between 0 - 255 (inclusive) ; |4 - Specification not supported ; |5 - Internal error; Hex value is not a valid hexadecimal color value ; |6 - Name is not defined as a named color in the specification ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WebColors_RGBPercentToName($rgb_percent, $spec='css3') __WebColors_Init() Local $rgb_value, $name $rgb_value = _WebColors_RGBPercentToRGB($rgb_percent) If @error Then Return SetError(@error, 0, "") $name = _WebColors_RGBToName($rgb_value, $spec) If @error Then Return SetError(@error) Return $name EndFunc ;==>_WebColors_RGBPercentToName ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebColors_RGBPercentToHex ; Description ...: Convert a 3-element array of percentages to a normalized hexadecimal color value for that color. ; Syntax ........: _WebColors_RGBPercentToHex($rgb_percent) ; Parameters ....: $rgb_percent - An array of RGB percentage values. ; Return values .: Success - The hexadecimal color value ; Failure - Blank string, sets @error ; |1 - RGB value is not an array ; |2 - RGB value array does not have 3 elements ; |3 - RGB array integer values not between 0 - 255 (inclusive) ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WebColors_RGBPercentToHex($rgb_percent) Local $rgb_value, $hex_value $rgb_value = _WebColors_RGBPercentToRGB($rgb_percent) If @error Then Return SetError(@error, 0, "") $hex_value = _WebColors_RGBToHex($rgb_value) If @error Then Return SetError(@error, 0, "") Return $hex_value EndFunc ;==>_WebColors_RGBPercentToHex ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebColors_RGBPercentToRGB ; Description ...: Convert a 3-element array of percentages to a 3-element array of integers. ; Syntax ........: _WebColors_RGBPercentToRGB($rgb_percent) ; Parameters ....: $rgb_percent - An array of RGB percentage values. ; Return values .: Success - The 3-element array of RGB integers ; Failure - Blank string, sets @error ; |1 - RGB value is not an array ; |2 - RGB value array does not have 3 elements ; |3 - RGB array integer values not between 0 - 255 (inclusive) ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WebColors_RGBPercentToRGB($rgb_percent) Local $rgb_value[3] If Not __WebColors_IsValidRGB($rgb_percent) Then Return SetError(@error, 0, "") For $i=0 To 2 $rgb_value[$i] = __WebColors_PercentToInt($rgb_percent[$i]) Next Return $rgb_value EndFunc ;==>_WebColors_RGBPercentToRGB ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __WebColors_Reverse_Dict ; Description ...: Creates a reverse lookup dictionary. ; Syntax ........: __WebColors_Reverse_Dict($base_dict, $reverse_dict) ; Parameters ....: $base_dict - A dictionary to reverse. ; $reverse_dict - A dictionary to store the reversed dictionary. ; Return values .: Success - None ; Failure - -1, sets @error to 1 ; Author ........: Michael Mims (zorphnog) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __WebColors_Reverse_Dict($base_dict, $reverse_dict) Local $items = __WebColors_x($base_dict) If IsObj($items) Then For $i In $items __WebColors_x($reverse_dict & "." & $items.item($i), $i) Next Else Return SetError(1, 0, -1) EndIf EndFunc ;==>__WebColors_Reverse_Dict ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name...........: __WebColors_x ; Description ...: Gets or sets a value in an Associative Array ; Syntax.........: SET: __WebColors_x( $sKey , $vValue ) ; GET: __WebColors_x( $key ) ; Parameters ....: $sKey - the key to set or get. Examples: ; __WebColors_x( 'foo' ) gets value of foo ; __WebColors_x( 'foo.bar' ) gets value of bar which is a key of foo ; $bar = "baz" ; __WebColors_x( 'foo.$bar' ) gets value of baz which is a key of foo (variables are expanded) ; Return values .: Success - When setting, return the value set. When getting, returns the requested value. ; Failure - Returns a 0 ; Author ........: OHB <me at="" orangehairedboy="" dot="" com=""> ; =============================================================================================================================== Func __WebColors_x( $sKey = '' , $vValue = '' ) $func = "get" If @NumParams <> 1 Then $func = "set" If $sKey == '' Then If $func == "get" Then Return $__WC_xHashCollection Else $__WC_xHashCollection.removeAll Return '' EndIf EndIf $parts = StringSplit( $sKey , "." ) $last_key = $parts[$parts[0]] $cur = $__WC_xHashCollection For $x = 1 To $parts[0] - 1 If Not $cur.exists( $parts[$x] ) Then If $func == "get" Then Return $cur.add( $parts[$x] , ObjCreate( "Scripting.Dictionary" ) ) EndIf $cur = $cur.item( $parts[$x] ) Next If IsPtr( $vValue ) Then $vValue = String( $vValue ) If $func == "get" Then If Not $cur.exists( $last_key ) Then Return $item = $cur.item( $last_key ) Return $item ElseIf Not $cur.exists( $last_key ) Then $cur.add( $last_key , $vValue ) Else $cur.item( $last_key ) = $vValue EndIf Return $vValue EndFunc _WebColors_Test.au3 #include "WebColors.au3" #include <array.au3> Global $sLog = "" $sLog &= __GetTestResult("_WebColors_NameToHex('white')", '#ffffff') $sLog &= __GetTestResult("_WebColors_NameToHex('navy')", '#000080') $sLog &= __GetTestResult("_WebColors_NameToHex('goldenrod')", '#daa520') $sLog &= __GetTestResult("_WebColors_NameToHex('goldenrod', 'html4')", 2) ; Throws error; value not defined in html4 specifications $sLog &= __GetTestResult("_WebColors_NameToRGB('white')", '[255, 255, 255]') $sLog &= __GetTestResult("_WebColors_NameToRGB('navy')", '[0, 0, 128]') $sLog &= __GetTestResult("_WebColors_NameToRGB('goldenrod')", '[218, 165, 32]') $sLog &= __GetTestResult("_WebColors_NameToRGBPercent('white')", '[100%, 100%, 100%]') $sLog &= __GetTestResult("_WebColors_NameToRGBPercent('navy')", '[0%, 0%, 50%]') $sLog &= __GetTestResult("_WebColors_NameToRGBPercent('goldenrod')", '[85.49%, 64.71%, 12.5%]') $sLog &= __GetTestResult("_WebColors_HexToName('#ffffff')", 'white') $sLog &= __GetTestResult("_WebColors_HexToName('#fff')", 'white') $sLog &= __GetTestResult("_WebColors_HexToName('#000080')", 'navy') $sLog &= __GetTestResult("_WebColors_HexToName('#daa520')", 'goldenrod') $sLog &= __GetTestResult("_WebColors_HexToName('#daa520', 'html4')", 3) ; Throws error; value not defined in html4 specifications $sLog &= __GetTestResult("_WebColors_HexToRGB('#fff')", '[255, 255, 255]') $sLog &= __GetTestResult("_WebColors_HexToRGB('#000080')", '[0, 0, 128]') $sLog &= __GetTestResult("_WebColors_HexToRGBPercent('#ffffff')", '[100%, 100%, 100%]') $sLog &= __GetTestResult("_WebColors_HexToRGBPercent('#000080')", '[0%, 0%, 50%]') $sLog &= __GetTestResult("_WebColors_RGBToName(_ArrayCreate(255, 255, 255))", 'white') $sLog &= __GetTestResult("_WebColors_RGBToName(_ArrayCreate(0, 0, 128))", 'navy') $sLog &= __GetTestResult("_WebColors_RGBToHex(_ArrayCreate(255, 255, 255))", '#ffffff') $sLog &= __GetTestResult("_WebColors_RGBToHex(_ArrayCreate(0, 0, 128))", '#000080') $sLog &= __GetTestResult("_WebColors_RGBToRGBPercent(_ArrayCreate(255, 255, 255))", '[100%, 100%, 100%]') $sLog &= __GetTestResult("_WebColors_RGBToRGBPercent(_ArrayCreate(0, 0, 128))", '[0%, 0%, 50%]') $sLog &= __GetTestResult("_WebColors_RGBToRGBPercent(_ArrayCreate(218, 165, 32))", '[85.49%, 64.71%, 12.5%]') $sLog &= __GetTestResult("_WebColors_RGBPercentToName(_ArrayCreate('100%', '100%', '100%'))", 'white') $sLog &= __GetTestResult("_WebColors_RGBPercentToName(_ArrayCreate('0%', '0%', '50%'))", 'navy') $sLog &= __GetTestResult("_WebColors_RGBPercentToName(_ArrayCreate('85.49%', '64.71%', '12.5%'))", 'goldenrod') $sLog &= __GetTestResult("_WebColors_RGBPercentToHex(_ArrayCreate('100%', '100%', '100%'))", '#ffffff') $sLog &= __GetTestResult("_WebColors_RGBPercentToHex(_ArrayCreate('0%', '0%', '50%'))", '#000080') $sLog &= __GetTestResult("_WebColors_RGBPercentToHex(_ArrayCreate('85.49%', '64.71%', '12.5%'))", '#daa520') $sLog &= __GetTestResult("_WebColors_RGBPercentToRGB(_ArrayCreate('100%', '100%', '100%'))", '[255, 255, 255]') $sLog &= __GetTestResult("_WebColors_RGBPercentToRGB(_ArrayCreate('0%', '0%', '50%'))", '[0, 0, 128]') $sLog &= __GetTestResult("_WebColors_RGBPercentToRGB(_ArrayCreate('85.49%', '64.71%', '12.5%'))", '[218, 165, 32]') ConsoleWrite($sLog) Func __GetTestResult($sCommand, $sExpected = "") Local $sResult, $iError, $sPass $sResult = Execute($sCommand) $iError = @error $sPass = "!FAIL" Select Case $iError <> 0 If $iError == $sExpected Then $sPass = "+PASS" Return StringFormat("%s %-75s => <error: %d="">n", $sPass, $sCommand, $iError) Case IsString($sResult) If $sResult = $sExpected Then $sPass = "+PASS" Return StringFormat("%s %-75s => %sn", $sPass, $sCommand, $sResult) Case IsArray($sResult) Local $sTemp = "[" & _ArrayToString($sResult, ", ") & "]" If $sTemp = $sExpected Then $sPass = "+PASS" Return StringFormat("%s %-75s => %sn",$sPass, $sCommand, $sTemp) EndSelect EndFunc UDF + Test script: WebColors.zip
  23. Hi, Somebody can help to find solution to ignore some part of html and css code? in example.css we have this part: div#page { display: block !important; text-align: left !important; width: 960px !important; //<<-- How to ignore this code in loaded page with _IENavigate ($oIE, "http://www.example.com") margin: 0 auto !important; } also in example.com/index.html code we have this part: <td valign="top" align="center" style="padding-top: 0px; padding-left:10px;"> <iframe src="http://www.game-advertising-online.com/index.php?section=serve&id=321&output=html" name="iframe" width="170" height="620" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" allowtransparency="true"></iframe> </td> how to remove this part of code? Thank you.
  24. hello guys im just asking about how to open web page inside a form ( i want my script to be like a web browser that only open the web page that i have wrote already before )
  25. I've been working on this php script based off of tinyib to work just like 4chan, yeah.. you heard right. I came to a problem when I noticed how 4chan interprets page requests as so~ <a href="1">1</a> Now the above is obviously a request for the second page on almost any board at the place and when you click it, the url changes from ~ http://boards.4chan.org/g/ to the url http://boards.4chan.org/g/1 And if you add a trailing backslash to the url as so~ http://boards.4chan.org/g/1/ you will get an error which should mean the request is not a directory but an argument sent over the url like the typical forum values you see like ~ forum.net/forum.php?Page=1 Some one told me that moot uses mod_rewrite to interpret the request, I couldn't get the said module to work under uniserver for some reason, even though "server-info" screams at me that the module is loaded and ready to go, but when I add a rule, it gives me a server error or apache fails to run when restarted. I'm basically very close to replicating 4chans script. but I cannot figure out how to interpret the url in my script so I can deliver the right page. Heres how 4chan uses the page ref ~ <a href="1">1</a> Very simple looking but I don't know how to catch this and not get a 404 error because of the "1" which apache thinks is a directory.
×
×
  • Create New...