Leaderboard
Popular Content
Showing content with the highest reputation on 09/04/2023 in all areas
-
Version 1.6.3.0
17,277 downloads
Extensive library to control and manipulate Microsoft Active Directory. Threads: Development - General Help & Support - Example Scripts - Wiki Previous downloads: 30467 Known Bugs: (last changed: 2020-10-05) None Things to come: (last changed: 2020-07-21) None BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort1 point -
LAST VERSION - 1.0 07-Mar-10 This is my very simple and small UDF. Allows you to restart the script from any location with full restoration of the original command line parameters. I use this library in several of my programs, and I was not disappointed. I hope this UDF will be useful for many as for me. I will be glad to any feedback and suggestions. Restart UDF Library v1.0 Previous downloads: 943 Restart.au3 Example #NoTrayIcon #Include <Misc.au3> #Include <Restart.au3> _Singleton('MyProgram') If MsgBox(36, 'Restarting...', 'Press OK to restart this script.') = 6 Then _ScriptRestart() EndIf1 point
-
Why is this in AutoIt Example Scripts forum? AFAIK backstage views are not in Windows Ribbon Framework but you can have Application Menu & Recent Items.1 point
-
Champak, mistersquirrle kindly pointed at my UDF - here it is in action: #include <Array.au3> #include "ArrayMultiColSort.au3" ; Set required sort list $sList = "3-6M,3-9M,12M,12-18M,2,2T,3,3T,12,3 US,4 US,12 US" ; Get an array $aList = StringSplit($sList, ",", 2) ; Shuffle it _ArrayShuffle($aList) ; Make 2D (min required) _ArrayColInsert ($aList, 1) ; And here is the result _ArrayDisplay($aList, "Shuffled", Default, 8) ; Set list in correct format for the UDF Global $aSortData[][] = [[0, $sList]] ; Sort the array using the required sort date _ArrayMultiColSort($aList, $aSortData) ; And here it is _ArrayDisplay($aList, "Sorted", Default, 8) Good enough? M231 point
-
_LCID_Language_GetInfo() Func _LCID_Language_GetInfo($iType=-1, $iLCID=-1) $iType=Number($iType) $iLCID=Number($iLCID) If ($iLCID<1 Or $iLCID==Default) Then Local $aCall = DllCall('kernel32.dll', 'dword', 'GetUserDefaultLCID') If @error Then Return SetError(@error, @extended, 0) $iLCID=$aCall[0] EndIf If ($iType < 0 Or $iType==Default) Then $iType=0 If $iType<1 Then Return $iLCID Local $aCall = DllCall('kernel32.dll', 'int', 'GetLocaleInfoW', 'dword', $iLCID, 'dword', $iType, 'wstr', '', 'int', 2048) If @error Or Not $aCall[0] Then Return SetError(@error + 10, @extended, '') Return $aCall[3] EndFunc ; -- BEGIN eg ConsoleWrite('_LCID_Language_GetInfo Type 2: => ' & _LCID_Language_GetInfo() & @CRLF) ConsoleWrite('_LCID_Language_GetInfo LCID 1033: => ' & _LCID_Language_GetInfo(2,1033)& @CRLF) For $i=0 to 129 ConsoleWrite('_LCID_Language_GetInfo Type '&$i&': => ' & _LCID_Language_GetInfo($i) & @CRLF) Next ; --- ENG EG Output Eg: _LCID_Language_GetInfo Type 2 UserDefaultLCID: => 1066 _LCID_Language_GetInfo LCID 1033: => English (United States) _LCID_Language_GetInfo Type 0: => 1066 _LCID_Language_GetInfo Type 1: => 042a _LCID_Language_GetInfo Type 2: => Vietnamese (Vietnam) _LCID_Language_GetInfo Type 3: => VIT _LCID_Language_GetInfo Type 4: => Tiếng Việt _LCID_Language_GetInfo Type 5: => 84 _LCID_Language_GetInfo Type 6: => Vietnam _LCID_Language_GetInfo Type 7: => VNM _LCID_Language_GetInfo Type 8: => Việt Nam _LCID_Language_GetInfo Type 9: => 042a _LCID_Language_GetInfo Type 10: => 84 _LCID_Language_GetInfo Type 11: => 1258 _LCID_Language_GetInfo Type 12: => , _LCID_Language_GetInfo Type 13: => 0 _LCID_Language_GetInfo Type 14: => , _LCID_Language_GetInfo Type 15: => . _LCID_Language_GetInfo Type 16: => 3;0 _LCID_Language_GetInfo Type 17: => 2 _LCID_Language_GetInfo Type 18: => 1 _LCID_Language_GetInfo Type 19: => 0123456789 _LCID_Language_GetInfo Type 20: => ₫ _LCID_Language_GetInfo Type 21: => VND _LCID_Language_GetInfo Type 22: => , _LCID_Language_GetInfo Type 23: => . _LCID_Language_GetInfo Type 24: => 3;0 _LCID_Language_GetInfo Type 25: => 2 _LCID_Language_GetInfo Type 26: => 2 _LCID_Language_GetInfo Type 27: => 3 _LCID_Language_GetInfo Type 28: => 8 _LCID_Language_GetInfo Type 29: => / _LCID_Language_GetInfo Type 30: => : _LCID_Language_GetInfo Type 31: => dd/MM/yyyy _LCID_Language_GetInfo Type 32: => dd MMMM yyyy _LCID_Language_GetInfo Type 33: => 1 _LCID_Language_GetInfo Type 34: => 1 _LCID_Language_GetInfo Type 35: => 0 _LCID_Language_GetInfo Type 36: => 1 _LCID_Language_GetInfo Type 37: => 0 _LCID_Language_GetInfo Type 38: => 1 _LCID_Language_GetInfo Type 39: => 1 _LCID_Language_GetInfo Type 40: => SA _LCID_Language_GetInfo Type 41: => CH _LCID_Language_GetInfo Type 42: => Thứ Hai _LCID_Language_GetInfo Type 43: => Thứ Ba _LCID_Language_GetInfo Type 44: => Thứ Tư _LCID_Language_GetInfo Type 45: => Thứ Năm _LCID_Language_GetInfo Type 46: => Thứ Sáu _LCID_Language_GetInfo Type 47: => Thứ Bảy _LCID_Language_GetInfo Type 48: => Chủ Nhật _LCID_Language_GetInfo Type 49: => T2 _LCID_Language_GetInfo Type 50: => T3 _LCID_Language_GetInfo Type 51: => T4 _LCID_Language_GetInfo Type 52: => T5 _LCID_Language_GetInfo Type 53: => T6 _LCID_Language_GetInfo Type 54: => T7 _LCID_Language_GetInfo Type 55: => CN _LCID_Language_GetInfo Type 56: => Tháng Giêng _LCID_Language_GetInfo Type 57: => Tháng Hai _LCID_Language_GetInfo Type 58: => Tháng Ba _LCID_Language_GetInfo Type 59: => Tháng Tư _LCID_Language_GetInfo Type 60: => Tháng Năm _LCID_Language_GetInfo Type 61: => Tháng Sáu _LCID_Language_GetInfo Type 62: => Tháng Bảy _LCID_Language_GetInfo Type 63: => Tháng Tám _LCID_Language_GetInfo Type 64: => Tháng Chín _LCID_Language_GetInfo Type 65: => Tháng Mười _LCID_Language_GetInfo Type 66: => Tháng Mười Một _LCID_Language_GetInfo Type 67: => Tháng Mười Hai _LCID_Language_GetInfo Type 68: => Thg1 _LCID_Language_GetInfo Type 69: => Thg2 _LCID_Language_GetInfo Type 70: => Thg3 _LCID_Language_GetInfo Type 71: => Thg4 _LCID_Language_GetInfo Type 72: => Thg5 _LCID_Language_GetInfo Type 73: => Thg6 _LCID_Language_GetInfo Type 74: => Thg7 _LCID_Language_GetInfo Type 75: => Thg8 _LCID_Language_GetInfo Type 76: => Thg9 _LCID_Language_GetInfo Type 77: => Thg10 _LCID_Language_GetInfo Type 78: => Thg11 _LCID_Language_GetInfo Type 79: => Thg12 _LCID_Language_GetInfo Type 80: => _LCID_Language_GetInfo Type 81: => - _LCID_Language_GetInfo Type 82: => 1 _LCID_Language_GetInfo Type 83: => 1 _LCID_Language_GetInfo Type 84: => 0 _LCID_Language_GetInfo Type 85: => 1 _LCID_Language_GetInfo Type 86: => 0 _LCID_Language_GetInfo Type 87: => 1 _LCID_Language_GetInfo Type 88: => � _LCID_Language_GetInfo Type 89: => vi _LCID_Language_GetInfo Type 90: => VN _LCID_Language_GetInfo Type 91: => 251 _LCID_Language_GetInfo Type 92: => vi-VN _LCID_Language_GetInfo Type 93: => h:mm:ss _LCID_Language_GetInfo Type 94: => 042a:{C2CB2CF0-AF47-413E-9780-8BC3A3C16068}{5FB02EC5-0A77-4684-B4FA-DEF8A2195628};042a:{C2CB2CF0-AF47-413E-9780-8BC3A3C16068}{591AE943-56BE-48F6-8966-06B43915CC5A};042a:0000042a;0409:00000409 _LCID_Language_GetInfo Type 95: => _LCID_Language_GetInfo Type 96: => H _LCID_Language_GetInfo Type 97: => B _LCID_Language_GetInfo Type 98: => T _LCID_Language_GetInfo Type 99: => N _LCID_Language_GetInfo Type 100: => S _LCID_Language_GetInfo Type 101: => B _LCID_Language_GetInfo Type 102: => C _LCID_Language_GetInfo Type 103: => vie _LCID_Language_GetInfo Type 104: => VNM _LCID_Language_GetInfo Type 105: => NaN _LCID_Language_GetInfo Type 106: => ∞ _LCID_Language_GetInfo Type 107: => -∞ _LCID_Language_GetInfo Type 108: => Latn; _LCID_Language_GetInfo Type 109: => vi _LCID_Language_GetInfo Type 110: => en _LCID_Language_GetInfo Type 111: => Vietnamese _LCID_Language_GetInfo Type 112: => 0 _LCID_Language_GetInfo Type 113: => 0 _LCID_Language_GetInfo Type 114: => Vietnamese (Vietnam) _LCID_Language_GetInfo Type 115: => Tiếng Việt (Việt Nam) _LCID_Language_GetInfo Type 116: => 1 _LCID_Language_GetInfo Type 117: => 1 _LCID_Language_GetInfo Type 118: => % _LCID_Language_GetInfo Type 119: => ‰ _LCID_Language_GetInfo Type 120: => dd MMMM _LCID_Language_GetInfo Type 121: => h:mm tt _LCID_Language_GetInfo Type 122: => VIT _LCID_Language_GetInfo Type 123: => vi-VN _LCID_Language_GetInfo Type 124: => dddd, dd MMMM _LCID_Language_GetInfo Type 125: => 0 _LCID_Language_GetInfo Type 126: => s _LCID_Language_GetInfo Type 127: => c _LCID_Language_GetInfo Type 128: => 8 _LCID_Language_GetInfo Type 129: => k0-windows-vietnam;k0-windows-vietnam-telex;k0-windows-vietnam-vni1 point
-
This will delete the contents of the "Brave Data" folder leaving the path untouched. Modified from the helpfile example. #include <APIShellExConstants.au3> #include <WinAPIFiles.au3> #include <WinAPIShellEx.au3> Local $s_Dir = "E:\Internet Browser Data\Brave Data\*.*" ; Delete to Recycle Bin If FileExists($s_Dir) Then _WinAPI_ShellFileOperation($s_Dir, '', $FO_DELETE, BitOR($FOF_ALLOWUNDO, $FOF_NO_UI)) If @error Then MsgBox(0, 'Error: ' & @error, 'Extended: ' & @extended) EndIf1 point
-
Try this $sFilePath = "E:\Internet Browser Data\Brave Data\*.*" FileRecycle ($sFilePath)1 point
-
1/ open AutoIt help about StringRegex: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm 2/ read it 3/ read it really 4/ read it again 5/ try your regexes on RegExp 6/ rinse, sleep and goto 1/ When proficient with all this, go read https://www.pcre.org/original/doc/html/pcrepattern.html in full detail.1 point
-
For those of us on the forum that simply don't have the ability or the time to thoroughly learn programming processes required to implement the current solutions such as selenium, webdriver or the old chrome.au3 (no longer functional), I invite you to try the Automa Extension. It is a free and open-source project on GitHub. https://github.com/AutomaApp/automa With the use of this extension and Autoit, I've managed to do things I could only imagine of doing in the past. I wanted to share this incredible find with the Autoit community especially those who have been frustrated and have failed in their attempts to automate their browser activities.1 point
-
Version 1.7.0.1
10,046 downloads
Extensive library to control and manipulate Microsoft Outlook. This UDF holds the functions to automate items (folders, mails, contacts ...) in the background. Can be seen like an API. There are other UDFs available to automate Outlook: OutlookEX_GUI: This UDF holds the functions to automate the Outlook GUI. OutlookTools: Allows to import/export contacts and events to VCF/ICS files and much more. Threads: Development - General Help & Support - Example Scripts - Wiki BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort KNOWN BUGS (last changed: 2020-02-09) None1 point -
1 point
-
Hi, I think, you all know this: You look at a script containing color values. You have a rough idea of the colors, but would like to know how it looks like. I have created a Lua script that displays the color of the value in SciTE as Calltip. Set the cursor in the Hex-value, press the hotkey. Above the value a Call tip appears. The background color corresponds to the hex value. Read the function header to obtain installation instructions. So it looks. EDIT: I think it's better to bind the function not only of AutoIt. If it can be called in all files, also the color settings in the * .properties can view. For this purpose remove the file attachment from the call. Use: command.13.*= instead of: command.13.*.au3= EDIT 20.07.2015: Now I've made some changes - You can switch to show colors as RGB or BGR - added new function: PreviewBackForeColor To have a preview for back and fore color: - Write in one line first the back color, than the fore color (i. e. as comment: "; 0xDEDEDE 0x000080") OR have this values inside a function call: "_AnyFunction($param1, $param2, 0xDEDEDE, $param3 0x000080)". If the order inside the call is reverse (first hex value is fore color), you can call the function with Flag "_fFore1st=true" - No other color value may be included in this line. If any - the first and second color will used. - Set the cursor in this line and hit the Hotkey. - A Calltip appears with the back color and the text "FORE-COLOR" with color of the fore value. - If only one color value was find in this line, this value will used as back color or, if Flag is "true", as fore color. In this cases the fore color is set to black and with Flag the back color is the default GUI back color "0xF0F0F0" Because you've different functions in one script, you need another way to install and call it. Read the instructions inside the script. First color used as back color, second as fore color. Function called with flag - first color is now the fore color. EDIT 2018-01-16: Added: Now be also recognized in au3 scripts, variables/constants which have an color assignment inside the script or inside an include file from this script. But it can only be one assignment per line. If the assignment is inside a comment line or -block, it will ignored. The assignment can also be build by using function(s) [from script or include files]. example: "Local $COLOR = '0x' & Hex(Mod(@SEC, 2) ? Random(0,0x000FFF, 1) : Random(0x001000, 0xFFF000, 1), 8)" But the functions must NOT CONTAIN any VARIABLES! This would require a recursive assignment search. Impossible if variables get values only at runtime. You can disable the search inside include files with an entry in SciTEUser.properties: #~ "ShowHexColorFromCursor.lua", Dis/Enable search in Includes (0/1 NO/YES) Get.Color.Assignment.Includes=0 The default value (without settings) is '1', enabled. Includes in comments will ignored. current version v0.8 EDIT 2018-02-22: Changed: Read assignment from function call got any problems - removed. Fixed: Unexpected behavior if caret doesn't touch any hex value while calling the function. Added: Recognition of hex values from length 1 hex character. Added: Instead of default behavior for hiding the calltip, [line 75] local bCALLTIP_END_ANYKEY = true can be used to immediately fade out the tip every time you press a key or move a mouse. current version v0.10 -- TIME_STAMP 2018-02-22 10:26:36 v 0.10 --[[------------- I N S T A L L A T I O N A N D U S I N G I N S T R U C T I O N -------------- Save the file. At first, make an entry in your SciTEStartup.lua LoadLuaFile("ShowHexColorFromCursor.lua", "C:\\Your Path\\with Backslash\\") Select free command-numbers from your SciTEUser.properties. Customize the following settings with this numbers. # 13 Show HexColor RGB command.name.13.*=Show RGB-Color From Cursor command.13.*=dostring ShowHexColorFromCursor() command.mode.13.*=subsystem:lua,savebefore:yes command.shortcut.13.*=Ctrl+Shift+F11 # 14 Show HexColor BGR command.name.14.*=Show BGR-Color From Cursor command.14.*=dostring ShowHexColorFromCursor(true) command.mode.14.*=subsystem:lua,savebefore:yes command.shortcut.14.*=Ctrl+Alt+F11 Set the cursor in the Hex-value, press the hotkey to show the color as RGB or as BGR. Above the value a Call tip appears. The background color corresponds to the hex value. A possible alpha component is ignored. [NEW] Now be also recognized in au3 scripts, variables/constants which have an color assignment inside the script or inside an include file from this script. PLEASE NOTE: Each line may only contain one assignment! If the assignment is inside a comment line or -block, it will ignored. You can disable the search inside include files with an entry in SciTEUser.properties: #~ "ShowHexColorFromCursor.lua", Dis/Enable search in Includes (0/1 NO/YES) Get.Color.Assignment.Includes=0 The default value (without settings) is '1', enabled. Includes in comments will ignored. Be recognized AutoIt hex color code "0x12AB34" and also HTML hex color code "#12AB34" with length from 1 to 6 hex characters. Possible alpha information will ignored. PREVIEW FOR BACK AND FORE COLOR: - Write in one line first the back color, than the fore color (i. e. as comment: "; 0xDEDEDE 0x000080") OR have this values inside a function call: "_AnyFunction($param1, $param2, 0xDEDEDE, $param3 0x000080)". If the order inside the call is reverse (first hex value is fore color), you can call the function with Flag "_fFore1st=true" - No other color value may be included in this line. If any - the first and second color will used. - Set the cursor in this line and hit the Hotkey. - A Calltip appears with the back color and the text "FORE-COLOR" with color of the fore value. - If only one color value was find in this line, this value will used as back color or, if Flag is "true", as fore color. In this cases the fore color is set to black and with Flag the back color is the default GUI back color "0xF0F0F0" For use with AutoIt color values only. To have both calls (w/wo flag) make two commands: # 11 Preview Back and Fore Color / first color value is back color command.name.11.*.au3=Preview Back and Fore Color command.11.*.au3=dostring PreviewBackForeColor() command.mode.11.*.au3=subsystem:lua,savebefore:yes command.shortcut.11.*.au3=Ctrl+Shift+F12 # 16 Preview Fore and Back Color / first color value is fore color command.name.16.*.au3=Preview Fore and Back Color command.16.*.au3=dostring PreviewBackForeColor(true) command.mode.16.*.au3=subsystem:lua,savebefore:yes command.shortcut.16.*.au3=Ctrl+Alt+F12 --------------------------------------------------------------------------------------------------]] local bDEBUG = false -- set "true" to get debug output local bCALLTIP_END_ANYKEY = false -- set "true" to cancel the calltip with any key or mouse move ------------------------------------------------------------ list object to manipulate simple tables local objList = { list = {}, delall = function(self) self.list = {} return self end, addonce = function(self, _val, _casesense) -- return true, if added local exists = function(_val, _casesense) for k in pairs(self.list) do if _casesense then if self.list[k] == _val then return true end else if tostring(self.list[k]):upper() == tostring(_val):upper() then return true end end end return false end if not exists(_val, _casesense) then table.insert(self.list, _val) return true end return nil end, new = function(self, _obj) _obj = _obj or {} setmetatable(_obj, self) self.__index = self return _obj end } --------------------------------------------------------------------------------------- /object list --------------------------------------------------------------------------------------- object color local objColor = { --------------------------------------------- variable will un/set if color-calltip is not/shown colortip_show = false, --------------------------------- user can disable search inside include files, default: enabled search_in_includes = true, ------------------------------------------------------------------- the default calltip position calltips_pos_def = false, ------------------------------------------------------------ the default calltip highlight color calltips_colorhlt_def = 0x0000FF, -- BGR (red) ---------------------------------------------------------- list with include storage directories lInclPathes = objList:new(), -------------------------------------------------- list/string with includes from current buffer lIncl = objList:new(), sIncl = '', ---------------------------------------------------------------------------------------- pattern pattHex = '()0x([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])', pattHex2 = '[0-9a-fA-F][0-9a-fA-F]', pattHexN = '0-[x#]([0-9a-fA-F]+)', pattHexEnd = '0x[0-9a-fA-F]+()', pattCS1 = '^#[Cc][Oo][Mm][Mm][Ee][Nn][Tt][Ss]%-[Ss][Tt][Aa][Rr][Tt]', pattCE1 = '^#[Cc][Oo][Mm][Mm][Ee][Nn][Tt][Ss]%-[Ee][Nn][Dd]', pattCS2 = '^#[Cc][Ss]', pattCE2 = '^#[Cc][Ee]', pattComment = '^%s*;', ----------------------------------------------------------------------------------------- pathes sPathGetColorAU3, sFileResult, TEMPDIR = props['SciteUserHome']..'\\..\\..\\Temp', sAU3exe = props['SciteDefaultHome']..'\\..\\AutoIt3.exe', ------------------------------------------------------------------------------------------------ ------------------------------------------------------------ set calltip values back to defaults SetCalltipsDefault = function(self) self.colortip_show = false scite.SendEditor(SCI_CALLTIPSETBACK, 0xFFFFFF) scite.SendEditor(SCI_CALLTIPSETFOREHLT, self.calltips_colorhlt_def) scite.SendEditor(SCI_CALLTIPSETPOSITION, self.calltips_pos_def) if bDEBUG then output:AppendText('> DEBUG: Calltips set to defaults') end end, ---------------------------------------------------------------------------- /SetCalltipsDefault ------------------------------------------------------------------------------ initialize values Startup = function(self) if props['Get.Color.Assignment.Includes'] == '0' then self.search_in_includes = false end if tonumber(props['calltips.set.above']) == 1 then self.calltips_pos_def = true end if props['calltips.color.highlight'] ~= '' then local colorhlt_user = myCallTips:BGR2Decimal(props['calltips.color.highlight']) if colorhlt_user ~= nil then self.calltips_colorhlt_def = colorhlt_user end end local sProp = props['openpath.$(au3)'] for w in sProp:gmatch('([^;]+)') do self.lInclPathes:addonce(w) end self.sPathGetColorAU3 = self.TEMPDIR..'\\ExecLineGetColor.au3' self.sFileResult = self.TEMPDIR..'\\ExecLineColor.txt' end, --------------------------------------------------------------------------------------- /Startup -------- check for comment line/block. Return "true/false, 0/1/-1" (0=comment line/1=#cs/-1=#ce) -- returned number for de/increase comment counter CheckComment = function(self, _s) local iMatch = _s:find(self.pattComment) if iMatch ~= nil then return true, 0 end iMatch = _s:find(self.pattCS1) or _s:find(self.pattCS2) if iMatch ~= nil then return true, 1 end iMatch = _s:find(self.pattCE1) or _s:find(self.pattCE2) if iMatch ~= nil then return true, -1 end return false, 0 end, ------------------------------------------------------------------------------------------------ --------------------------------------------------------- read include files from current buffer IncludesFromBuffer = function(self) local sText, boolCmnt, countCmnt, n, incl = editor:GetText(), false, 0 self.lIncl:delall() self.sIncl = '' for line in sText:gmatch('([^\r\n]+)') do boolCmnt, n = self:CheckComment(line) if boolCmnt then countCmnt = countCmnt + (n) end if not boolCmnt and countCmnt == 0 then -- none comment line or block -- #include <abc.au3> incl = line:match("#[iI][nN][cC][lL][uU][dD][eE]%s-<([%w%s_.]+)>") if incl ~= nil then if self.lIncl:addonce(incl) then self.sIncl = self.sIncl..'#include <'..incl..'>\n' if bDEBUG then output:AppendText('> DEBUG: IncludesFromBuffer.Add "#include <'..incl..'>"\n') end end else -- #include 'abc.au3' or #include "abc.au3" _, incl = line:match("#[iI][nN][cC][lL][uU][dD][eE]%s-([\"'])([%w%s_.:\\]+)%1") if incl ~= nil then if incl:sub(1,1) == '\\' then incl = incl:sub(2,-1) end if self.lIncl:addonce(incl) then if incl:sub(2,2) == ':' then self.sIncl = self.sIncl..'#include "'..incl..'"\n' if bDEBUG then output:AppendText('> DEBUG: IncludesFromBuffer.Add "#include '.."'"..incl.."'"..'"\n') end else self.sIncl = self.sIncl..'#include "'..props['FileDir']..'\\'..incl..'"\n' if bDEBUG then output:AppendText('> DEBUG: IncludesFromBuffer.Add "#include '.."'"..props['FileDir']..'\\'..incl.."'"..'"\n') end end end end end end end end, ---------------------------------------------------------------------------- /IncludesFromBuffer ------------------------------------------ create the au3 file for executing the assignment line CreateAU3 = function(self, _sLineAssignment) local sTextAU3 = self.sIncl.. 'Global $sFileExport = @TempDir & "\\ExecLineColor.txt"\n'.. 'FileDelete($sFileExport)\n'.. 'Global $sLine = "'.._sLineAssignment..'" ; line: $Variable = assignment\n'.. 'If $sLine = "NONE" Then Exit\n'.. 'Global $sExec = StringTrimLeft($sLine, StringInStr($sLine, "="))\n'.. 'Global $sColor = "0x" & Hex(Execute($sExec), 6)\n'.. 'If Not StringRegExp($sColor, "^0x[0-9A-F]{6}$") Then Exit\n'.. 'FileWrite($sFileExport, $sColor)\n' local fH = io.open(self.sPathGetColorAU3, 'w+') fH:write(sTextAU3) fH:close() end, ------------------------------------------------------------------------------------- /CreateAU3 --------------------------------- check, if file containing the assignment for selected variable FindAssignment = function(self, _path, _sSelection) local fH = io.open(_path) if fH ~= nil then local sRead, boolCmnt, countCmnt, n = fH:read('*all'), false, 0 fH:close() for line in sRead:gmatch('([^\r\n]+)') do boolCmnt, n = self:CheckComment(line) if boolCmnt then countCmnt = countCmnt + (n) end if not boolCmnt and countCmnt == 0 then -- none comment line or block if line:find(_sSelection..'%s*=') then if bDEBUG then output:AppendText('> DEBUG: Assignment line "'..line..'"\n') end return line end end end end return nil end, -------------------------------------------------------------------------------- /FindAssignment -------------------------------------------------------------------- detects color from variable GetColorValueFromVariable = function(self, _sSelection, _iCursor, _var_beginPos, _var_endPos, _fBGR) local sLine = self:FindAssignment(props['FilePath'], _sSelection) if sLine == nil then -- search inside include files -- do it not, if the user has disabled: "Get.Color.Assignment.Includes=0" (default = 1 - enabled) if self.search_in_includes then self:IncludesFromBuffer() -- get include files if #self.lIncl.list ~= 0 then -- open each include file, search line with assignment "_sSelection =" for i=1, #self.lIncl.list do if self.lIncl.list[i]:sub(2,2) == ':' then -- include has full path, search only in this file sLine = self:FindAssignment(self.lIncl.list[i], _sSelection) if bDEBUG then output:AppendText('> DEBUG: Search "'.._sSelection..'" in "'..self.lIncl.list[i]..'" --> '..tostring(sLine ~= nil)..'\n') end end if sLine == nil and self.lIncl.list[i]:find('\\') then -- include has partial path, check first if exist in @ScriptDir sLine = self:FindAssignment(props['FileDir']..'\\'..self.lIncl.list[i], _sSelection) if bDEBUG then output:AppendText('> DEBUG: Search "'.._sSelection..'" in "'..props['FileDir']..'\\'..self.lIncl.list[i]..'" --> '..tostring(sLine ~= nil)..'\n') end end if sLine == nil then -- include has filename only (or partial path), -- .. concanate all directories with this for searching for j=1, #self.lInclPathes.list do sLine = self:FindAssignment(self.lInclPathes.list[j]..'\\'..self.lIncl.list[i], _sSelection) if bDEBUG then output:AppendText('> DEBUG: Search "'.._sSelection..'" in "'..self.lInclPathes.list[j]..'\\'..self.lIncl.list[i]..'" --> '..tostring(sLine ~= nil)..'\n') end if sLine == nil then sLine = self:FindAssignment(props['FileDir']..'\\'..self.lIncl.list[i], _sSelection) if bDEBUG then output:AppendText('> DEBUG: Search "'.._sSelection..'" in "'..props['FileDir']..'\\'..self.lIncl.list[i]..'" --> '..tostring(sLine ~= nil)..'\n') end end if sLine ~= nil then break end end end end end end end if sLine == nil then sLine = 'NONE' else -- trim characters right from assignment sLine = sLine:sub(1,sLine:match(self.pattHexEnd)) end if bDEBUG then output:AppendText('> DEBUG: Search "'.._sSelection..'" \n> DEBUG: Result "'..sLine..'"\n') end -- create the au3-file for executing the assignment line, with 'NONE' - the last result file will delete self:CreateAU3(sLine) -- run the au3-file local sCmd = '"'..self.sAU3exe..'" /AutoIt3ExecuteScript "'..self.sPathGetColorAU3..'"'..' "'..sLine..'"' if shell then shell.exec(sCmd, nil, true, true) else os.execute('start "" '..sCmd) end -- check for result local fH = io.open(self.sFileResult) if fH == nil then scite.SendEditor(SCI_CALLTIPSHOW, _var_beginPos +1, (' NONE COLOR ASSIGNED! ')) scite.SendEditor(SCI_CALLTIPSETHLT, 0, 22) scite.SendEditor(SCI_CALLTIPSETBACK, 0x33FFFF) scite.SendEditor(SCI_CALLTIPSETFOREHLT, 0x0000FF) scite.SendEditor(SCI_CALLTIPSETPOSITION, true) if bDEBUG then output:AppendText('> DEBUG: Set Calltip "'.._sSelection..'" --> "NONE COLOR ASSIGNED!"\n') end else local sValue = fH:read() fH:close() local R,G,B = sValue:match('('..self.pattHex2..')('..self.pattHex2..')('..self.pattHex2..')$') local iLen = _var_endPos - _var_beginPos -1 scite.SendEditor(SCI_CALLTIPSHOW, _var_beginPos +1, (' '):rep(iLen)) scite.SendEditor(SCI_CALLTIPSETHLT, 0, iLen) scite.SendEditor(SCI_CALLTIPSETPOSITION, true) if _fBGR == true then scite.SendEditor(SCI_CALLTIPSETBACK, tonumber(string.format('0x%s%s%s', R,G,B))) if bDEBUG then output:AppendText('> DEBUG: Set Calltip BGR "'.._sSelection..'" --> "'..string.format('0x%s%s%s', R,G,B)..'"\n') end else scite.SendEditor(SCI_CALLTIPSETBACK, tonumber(string.format('0x%s%s%s', B,G,R))) if bDEBUG then output:AppendText('> DEBUG: Set Calltip RGB "'.._sSelection..'" --> "'..string.format('0x%s%s%s', B,G,R)..'"\n') end end end self.colortip_show = true editor:SetSelection(_iCursor, _iCursor) end, --------------------------------------------------------------------- /GetColorValueFromVariable ----------------------------------------- grabs the color value or variable from cursor position FromCursor = function(self, _fBGR) local function isHexChar(_asc) local sChar = string.char(_asc) if sChar:find('[#x0-9a-fA-F]') then return true else return false end end local cursor = editor.CurrentPos -- check if cursor is possible inside a variable local var_beginPos, var_endPos = cursor if string.char(editor.CharAt[cursor]) ~= '$' then -- cursor is inside or behind the variable (if its a variable) editor:WordLeft() -- skip to the left end var_beginPos = editor.CurrentPos -- is it a variable? if string.char(editor.CharAt[var_beginPos]) == '$' then -- now the cursor is in front of variable editor:WordRight() var_endPos = editor.CurrentPos editor:SetSelection(var_beginPos, var_endPos) local sSelection = editor:GetSelText() local iLenSel = sSelection:len() -- trim spaces on right site, if any sSelection = sSelection:gsub('%s+$','') var_endPos = var_endPos - (iLenSel - sSelection:len()) if bDEBUG then output:AppendText('> DEBUG: Cursor on variable "'..sSelection..'"\n') end return self:GetColorValueFromVariable(sSelection, cursor, var_beginPos, var_endPos, _fBGR) end -- cursor inside hex value? local beginPos, endPos = cursor, cursor while isHexChar(editor.CharAt[beginPos-1]) do beginPos = beginPos - 1 end while isHexChar(editor.CharAt[endPos]) do endPos = endPos + 1 end if beginPos ~= endPos then if beginPos > endPos then editor:SetSelection(endPos, beginPos) else editor:SetSelection(beginPos, endPos) end local sMatch = tostring(editor:GetSelText()):match(self.pattHexN) if sMatch == nil then return editor:SetSelection(cursor, cursor) end local sHex6 = '0x'..('0'):rep(6-sMatch:len())..sMatch local iLen = sMatch:len() +2 local R,G,B = tostring(sHex6):match('('..self.pattHex2..')('..self.pattHex2..')('..self.pattHex2..')$') if bDEBUG then output:AppendText('> DEBUG: Cursor on hex value\n') end editor:SetSelection(cursor, cursor) scite.SendEditor(SCI_CALLTIPSHOW, beginPos+1, (' '):rep(iLen-1)) scite.SendEditor(SCI_CALLTIPSETHLT, 0, iLen-1) scite.SendEditor(SCI_CALLTIPSETPOSITION, true) if _fBGR == true then scite.SendEditor(SCI_CALLTIPSETBACK, tonumber(string.format('0x%s%s%s', R,G,B))) if bDEBUG then output:AppendText('> DEBUG: Set Calltip BGR hex value --> "'..string.format('0x%s%s%s', R,G,B)..'"\n') end else scite.SendEditor(SCI_CALLTIPSETBACK, tonumber(string.format('0x%s%s%s', B,G,R))) if bDEBUG then output:AppendText('> DEBUG: Set Calltip RGB hex value --> "'..string.format('0x%s%s%s', B,G,R)..'"\n') end end self.colortip_show = true else editor:SetSelection(cursor, cursor) end end, ------------------------------------------------------------------------------------ /FromCursor ----------------------------------------------------------------------- show back and fore color PreviewBackForeColor = function(self, _fFore1st) local iBackCol, iForeCol = 0xF0F0F0, 0x000000 local cursor = editor.CurrentPos local sLine, iColumn = editor:GetCurLine() local iLineStartPos = cursor - iColumn local tMatch, beginPos = {}, nil for s, r, g, b in sLine:gmatch(self.pattHex) do if beginPos == nil then beginPos = s end local t = {} t['R']=r t['G']=g t['B']=b table.insert(tMatch, t) end if #tMatch == 0 then if bDEBUG then output:AppendText('> DEBUG: Search back/fore color --> "FAILED"\n') end return elseif #tMatch == 1 then if _fFore1st == true then iForeCol = tonumber(string.format('0x%s%s%s', tMatch[1].B, tMatch[1].G, tMatch[1].R)) if bDEBUG then output:AppendText('> DEBUG: Search back/fore color "ForeColor" --> "'..string.format('0x%s%s%s', tMatch[1].B, tMatch[1].G, tMatch[1].R)..'"\n') end else iBackCol = tonumber(string.format('0x%s%s%s', tMatch[1].B, tMatch[1].G, tMatch[1].R)) if bDEBUG then output:AppendText('> DEBUG: Search back/fore color "BackColor" --> "'..string.format('0x%s%s%s', tMatch[1].B, tMatch[1].G, tMatch[1].R)..'"\n') end end else if _fFore1st == true then iForeCol = tonumber(string.format('0x%s%s%s', tMatch[1].B, tMatch[1].G, tMatch[1].R)) iBackCol = tonumber(string.format('0x%s%s%s', tMatch[2].B, tMatch[2].G, tMatch[2].R)) if bDEBUG then output:AppendText('> DEBUG: Search back/fore color "ForeColor" --> "'..string.format('0x%s%s%s', tMatch[1].B, tMatch[1].G, tMatch[1].R)..'"\n') end if bDEBUG then output:AppendText('> DEBUG: Search back/fore color "BackColor" --> "'..string.format('0x%s%s%s', tMatch[2].B, tMatch[2].G, tMatch[2].R)..'"\n') end else iForeCol = tonumber(string.format('0x%s%s%s', tMatch[2].B, tMatch[2].G, tMatch[2].R)) iBackCol = tonumber(string.format('0x%s%s%s', tMatch[1].B, tMatch[1].G, tMatch[1].R)) if bDEBUG then output:AppendText('> DEBUG: Search back/fore color "ForeColor" --> "'..string.format('0x%s%s%s', tMatch[2].B, tMatch[2].G, tMatch[2].R)..'"\n') end if bDEBUG then output:AppendText('> DEBUG: Search back/fore color "BackColor" --> "'..string.format('0x%s%s%s', tMatch[1].B, tMatch[1].G, tMatch[1].R)..'"\n') end end end if bDEBUG then output:AppendText('> DEBUG: Set calltip back/fore color\n') end scite.SendEditor(SCI_CALLTIPSHOW, iLineStartPos + beginPos, ' FORE-COLOR ') scite.SendEditor(SCI_CALLTIPSETHLT, 0, 12) scite.SendEditor(SCI_CALLTIPSETBACK, iBackCol) scite.SendEditor(SCI_CALLTIPSETFOREHLT, iForeCol) self.colortip_show = true end -------------------------------------------------------------------------- /PreviewBackForeColor } -------------------------------------------------------------------------------------- /object color ---------------------------------------------------------------------------------- region EventClass ShowColorEvt = EventClass:new(Common) function ShowColorEvt:OnKey() if objColor.colortip_show then if bCALLTIP_END_ANYKEY then scite.SendEditor(SCI_CALLTIPCANCEL) end objColor:SetCalltipsDefault() end end function ShowColorEvt:OnDwellStart() if objColor.colortip_show then if bCALLTIP_END_ANYKEY then scite.SendEditor(SCI_CALLTIPCANCEL) end objColor:SetCalltipsDefault() end end --------------------------------------------------------------------------------- /region EventClass -------------------------------------------------------------------------- function call redirection function ShowHexColorFromCursor(_fBGR) objColor:FromCursor(_fBGR) end --> ShowHexColorFromCursor function PreviewBackForeColor(_fFore1st) objColor:PreviewBackForeColor(_fFore1st) end --> PreviewBackForeColor ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------- run startup objColor:Startup() ---------------------------------------------------------------------------------------------------- ShowHexColorFromCursor[0.10].lua1 point
-
An alternative way without using IE. #include <Array.au3> #include <String.au3> Global Const $HTTP_STATUS_OK = 200 Local $sKeyWord = "house" Local $sURL = "http://www.google.com/search?q=" & $sKeyWord & "&tbm=isch" Local $sData = HttpGet($sURL) ;~ ConsoleWrite($sData & @CRLF) Local $aMetas = _StringBetween($sData, '"rg_meta">', '</div>') ;~ _ArrayDisplay($aMetas) Local $sUrlImage = "" Local $sImageName = "" Local $sExtension = "" If IsArray($aMetas) Then If UBound($aMetas) >= 5 Then For $i = 0 To 4 ConsoleWrite(">Image Number: " & $i + 1 & @CRLF) $sUrlImage = _GetImageUrl($aMetas[$i]) $sImageName = _GetImageName($aMetas[$i]) ;maybe you want to get the name from image url instead of metadata $sExtension = _GetImageExtension($aMetas[$i]) ConsoleWrite($sUrlImage & @CRLF) ConsoleWrite($sImageName & @CRLF) ConsoleWrite($sExtension & @CRLF) ConsoleWrite(@CRLF) Next EndIf EndIf Func _GetImageName($sData) Local $aData = _StringBetween($sData, '"s":"', '"') If IsArray($aData) Then Return $aData[0] EndFunc ;==>_GetImageName Func _GetImageUrl($sData) Local $aData = _StringBetween($sData, '"ou":"', '"') If IsArray($aData) Then Return $aData[0] EndFunc ;==>_GetImageUrl Func _GetImageExtension($sData) Local $aData = _StringBetween($sData, '"ity":"', '"') If IsArray($aData) Then Return $aData[0] EndFunc ;==>_GetImageExtension Func HttpGet($sURL) Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("GET", $sURL, False) $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:48.0) Gecko/20100101 Firefox/48.0") $oHTTP.SetRequestHeader("Content-Type", "text/plain; charset=utf-8") If (@error) Then Return SetError(1, 0, 0) $oHTTP.Send() If (@error) Then Return SetError(2, 0, 0) If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0) Return SetError(0, 0, $oHTTP.ResponseText) EndFunc ;==>HttpGet Make sure to clean up the file name. Saludos1 point
-
AutoIT Editor Dark Theme
TheOne23 reacted to InunoTaishou for a topic
1 point -
Is it possible to hide "Found Call() statement using unsolvable Func" messages generated bu Au3Stripper? I use Au3Stripper to strip unused variables and functions. I have been ignoring the above mentioned messages in the console when compiling, because I know they wont break my script. But I have on occasion missed valid error messages because the console has several of these "unresolvable Func" messages and I missed the new message. The error messages are typically generated when Call() & DllCallbackRegister() are encountered. I can stop the messages by placing "#Au3Stripper_Off" & "#Au3Stripper_On" before and after each offending function call, This is fine for my own code, but several UDFs I use (eg SQLite.au3, Timers.au3, AutoitObject.au3) would need to be modified and I don't really want to do that. #Au3Stripper_Off Call($funcname) #Au3Stripper_On Is there an alternate solution that avoids editing the UDFs? Thanks1 point