Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/05/2014 in all areas

  1. MrCreatoR

    MouseOnEvent UDF!

    This UDF allows to set an events handler for Mouse device. The beginning... I searched for a way to disable the Mouse Primary click, and be able to call some function when the click event is received... Big thanks to amel27 for this one, i only organized the whole stuff to UDF style. Example: #include <GUIConstantsEx.au3> #include "MouseOnEvent.au3" HotKeySet("{ESC}", "_Quit") _Example_Intro() _Example_Limit_Window() Func _Example_Intro() MsgBox(64, "Attention!", "Let's set event function for mouse wheel *scrolling* up and down", 5) ;Set event function for mouse wheel *scrolling* up/down and primary button *down* action (call our function when the events recieved) _MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT, "_MouseWheel_Events") _MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT, "_MouseWheel_Events") _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MousePrimaryDown_Event") Sleep(3000) ;UnSet the events _MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT) _MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT) _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) ToolTip("") MsgBox(64, "Attention!", "Now let's disable Secondary mouse button up action, and call our event function.", 5) _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "_MouseSecondaryUp_Event", 0, 1) Sleep(5000) _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT) ToolTip("") EndFunc Func _Example_Limit_Window() Local $hGUI = GUICreate("MouseOnEvent UDF Example - Restrict events on specific window") GUICtrlCreateLabel("Try to click on that specific GUI window", 40, 40, 300, 30) GUICtrlSetFont(-1, 12, 800) GUICtrlCreateLabel("Press <ESC> to exit", 10, 10) GUISetState() _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MousePrimaryDown_Event", $hGUI) ;A little(?) bugie when you mix different events :( ;_MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "_MouseSecondaryUp_Event", $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN MsgBox(0, "", "Should not be shown ;)") EndSwitch WEnd _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) ;_MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT) EndFunc Func _MouseWheel_Events($iEvent) Switch $iEvent Case $MOUSE_WHEELSCROLLDOWN_EVENT ToolTip("Wheel Mouse Button (scrolling) DOWN Blocked") Case $MOUSE_WHEELSCROLLUP_EVENT ToolTip("Wheel Mouse Button (scrolling) UP Blocked") EndSwitch Return $MOE_BLOCKDEFPROC ;Block EndFunc Func _MousePrimaryDown_Event() ToolTip("Primary Mouse Button Down Blocked") Return $MOE_BLOCKDEFPROC ;Block EndFunc Func _MouseSecondaryUp_Event() ToolTip("Secondary Mouse Button Up Blocked") EndFunc Func _Quit() Exit EndFunc Available Events Constants: ------------------------------------------ CHANGELOG: Download: Attached: MouseOnEvent_2.4.zip Old version: MouseOnEvent.zip - v2.3 MouseOnEvent_2.1.zip MouseOnEvent_2.0.zip MouseOnEvent_UDF_1.9.zip MouseSetOnEvent_UDF_1.8.zip MouseSetOnEvent_UDF_1.7.zip MouseSetOnEvent_UDF_1.6.zip MouseSetOnEvent_UDF_1.5.zip MouseSetOnEvent_UDF_1.4.zip MouseSetOnEvent_UDF_1.3.zip Previous downloads: 146 + 200 + 804 MouseOnEvent.zip MouseOnEvent.zip
    1 point
  2. WinHttp.au3: #include-once Global Const $HTTP_STATUS_OK = 200 Func HttpPost($sURL, $sData = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("POST", $sURL, False) If (@error) Then Return SetError(1, 0, 0) $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.Send($sData) 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 Func HttpGet($sURL, $sData = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("GET", $sURL & "?" & $sData, False) 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 Example 1: #include "WinHttp.au3" Global $MD5 = HttpPost("http://www.afk-manager.ir/test/post.php", "password=WeWantThisAsMd5") MsgBox(64, "MD5", $MD5) Example 2: #include "WinHttp.au3" Global $sGet = HttpGet("http://www.google.com/") FileWrite("Google.txt", $sGet) Speed compare: [WinHttp.WinHttpRequest.5.1 GET] 1 = 422.961162765649 2 = 455.738280639636 3 = 441.821516504421 4 = 390.538648365335 Total = 1711.059608275041 Average = 427.7649020687603 [WinHttp.WinHttpRequest.5.1 POST] 1 = 826.436200956633 2 = 872.366642546045 3 = 871.266802895081 4 = 875.792832686324 Total = 3445.862479084083 Average = 861.4656197710208 [HTTP UDF GET] 1 = 984.282912132673 2 = 813.896511915435 3 = 781.158836566862 4 = 791.901235916364 Total = 3371.239496531334 Average = 842.8098741328335 [HTTP UDF POST] 1 = 788.734835486743 2 = 975.688234142967 3 = 785.810779035388 4 = 847.537193542955 Total = 3397.771042208053 Average = 849.4427605520133 [InetRead GET] 1 = 672.120733570292 2 = 595.221462195098 3 = 561.122261209642 4 = 738.180516302658 Total = 2566.64497327769 Average = 641.6612433194225 Tests result: Server 2003 32bit OK Server 2003 64bit Not Tested Server 2008 32bit Not Tested Server 2008 64bit OK XP 32bit OK XP 64bit Not Tested Vista 32bit Not Tested Vista 64bit Not Tested 7 32bit OK 7 64bit OK 8 32bit OK 8 64bit OK Are you interested? Check this out: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384106(v=vs.85).aspx
    1 point
  3. This UDF allows to create formatted label using pseudo element RichLabel (RichEdit actually). Formating is set by using special modificator similar to <font> tag in Html. Notes: This UDF is a transformation-continuation of related UDF Example: Download: GUIRichLabel_1.2.zip Small syntax related fix: GUIRichLabel_1.1.zip GUIRichLabel_1.1.zip History version:
    1 point
  4. Hi! Today I want to show you my current AutoIt project: The ISN AutoIt Studio. The ISN AutoIt Studio is a complete IDE made with AutoIt, for AutoIt! It includes a GUI designer, a code editor (with syntax highlighting, auto complete & intelisense), a file viewer, a backup system, trophies and a lot more features!! Here are some screenshots: Here some higlights: -> easy to create/manage/public your AutoIt-projects! ->integrated GUI-Editor (ISN Form Studio 2) ->integrated - file & projectmanager ->auto backupfunction for your Projects ->extendable with plugins! ->available in several languages ->trophies ->Syntax highlighting /Autocomplete / Intelisense ->Dynamic Script ->detailed overview of the project (total working hours, total size...) And much more!!! -> -> Click here to download ISN AutoIt Studio <- <- Here is the link to the german autoit forum where I posted ISN AutoIt Studio the first time: http://autoit.de/index.php?page=Thread&threadID=29742&pageNo=1 For more information visit my Homepage: https://www.isnetwork.at So….have fun with ISN AutoIt Studio! PS: Sorry for my bad English! ^^
    1 point
  5. BuckMaster

    Form Builder beta

    Update v1.0.6 Major script overhaul, I literally started over from scratch only adding parts of code from the old script that were solid. I don’t have a help file made as of now so I am going to explain all of the functionality in this post - Form Builder is no longer bi-directional, you now toggle between script mode and GUI mode using a button in the top right or F4 - The script no longer recompiles on every change but instead inserts changes into the script - Form Builder no longer cares about Event mode or GuiGetMsg mode - No more .gui files, you now edit .au3 scripts directly - Script edit is now a SciLexer control, includes syntax highlighting, folding, call tips, keywords, and inline error annotations. - Script output console is now at the bottom in script mode - Main GUI menu redone, most functions from SciTe have been added along with their hotkeys - All restrictions to editing the script have been removed - GDI+ and Graphic editors removed - Cleanup of script, stability greatly increased - Hotkeys no longer use _IsPressed they now use GUIAccelerator keys (with exception to a few) - Multiple scripts can be open - Form Builder buffers the open scripts and adds an asterisk * to scripts that have been modified - Rich Edit, GUIScrollbars, Dummy, and Updown are disabled for now until I can add them - GUI Menu controls cannot be created as of now but will be rendered in the editor - Undo and Redo actions in script mode and GUI mode added, the GUI undo and redo buffer is cleared switching between modes - The Undo and Redo buffers do not have a limit but are cleared when switching between modes or scripts - Undo and Redo actions do not work for controls that have no control handle - The Treeview now works as a Go to function for controls and functions in script mode - Form Builder now tries to preserve as much of the original content as possible, it will save whitespace in-between parameters and comments on controls - Treeview context menu reworked, much more responsive - Unicode support added File -> Encoding -> UTF-8 - Language support added, I added a couple of language files and used Google translate just so I could size my GUI's for different languages, I do not support what those language files say - Selecting a GUI in the Treeview in GUI mode will allow you to change the GUI's Handle, Position, Background Color, State, Cursor, Font, Font Size and Font Attributes - Auto Declare is no longer hiding in the settings, it is now on the top right and is a toggle between Off, Global and Local - Help File Lookup added (Ctrl + H), allows you to search selected text in the help file, Any variable will be searched and the first result will be displayed, any string will be searched as a keyword in the index - Added current script line, column, and selection length in the bottom left - Standard undeclared style constants are checked before script execution and the script will prompt if an undefined style constant is found - You can now toggle script whitespace, EOL characters, line numbers, margins and output in the View menu - View -> Toggle All Folds works as it does in SciTe, only base level folds are changed and the first fold found determines whether to expand or contract - Form Builder Settings redone - Bugs with submitting data and control selection have been fixed - Fixed problems with frequently called repetitive functions causing issues with large scripts - Fixed bugs with B, I, U and S font attribute buttons getting stuck and called when enter was pressed Update v1.0.7 - Help File Look-up hotkey changed to Ctrl+B - Replace hotkey changed to Ctrl+H - Changes to $SCN_MODIFIED so only text events are notified - Bookmarks added, Ctrl+M to add or delete a Bookmark from the current line - Edit -> Bookmarks -> Set Bookmark changes the currently selected Bookmark - Edit -> Clear Current Bookmarks deletes only the currently selected Bookmark - Allows you to change foreground and background colors of Bookmarks - Added F2 hotkey for Next Bookmark - Added Shift+F2 hotkey for Previous Bookmark - Fixed a bug that made it so script annotation did not show up for some people - Script errors and warnings now add a Bookmark on each line - Ctrl+E hotkey added to clear all Bookmarks and Annotations - Minor GUI tweaks - Fixed a bug with the GUI Style undo action - Undo and Redo actions for GUI windows will now update the window properties if the GUI is selected - F4 Hotkey no longer switches modes, switching modes is now F10 - F4 is to toggle next error or warning message, works like it does in SciTe, bookmarks the line and highlights the error in the console - Shift+F4 Hotkey added to toggle previous error or warning message - Shift+F5 Hotkey added to clear script output - Ctrl+F5 Hotkey added as SyntaxCheck Prod - Form Builder now performs a SyntaxCheck before entering GUI Mode and prompts on Error or Warning - Language Select Menu Added Settings -> Lanugage - Icons added to main menu - Languages added to all new menu items and msgbox's - Language Files updated for new data - Language Support added for Arabic, Chinese, Dutch, French, German, Hebrew, Japanese, Swedish, Thai, and Vietnamese [ Google Translate ] - Fixed bug with updating a language that made it look like ANSI and UTF-8 were both selected - Added redo button next to undo button - Font attribute buttons Bold, Italic, Underline and Strike-Out changed to labels Update v1.0.8 - Somehow a main function got deleted causing the script to crash on some changes - Fixed some issues with updating Languages Hotkeys Ctrl + N - New Blank Script Ctrl + G - New GUI Script Ctrl + O - Open Script Ctrl + Shift + S - Save As Ctrl + S - Save Esc - Close Open Script Alt + F4 - Exit Ctrl + Z - Undo Ctrl + Y - Redo Ctrl + X - Cut Ctrl + C - Copy Ctrl + V - Paste Ctrl + A - Select All Ctrl + W - Clear inline script annotation Ctrl + E - Clear inline script annotation and bookmarks Ctrl + F - Find Ctrl + F3 - Find Next Shift + F3 - Find Previous (doesn’t work yet) Ctrl + B - Help File Lookup F5 - Go Alt + F5 - Beta Run F7 - Build Ctrl + F7 - Compile F11 - Full screen F8 - Toggle Show/Hide Script Output Ctrl + I - Open Include Ctrl + H - Replace F1 - AutoIt Help File Ctrl + D - Duplicate Control Delete - Delete Control Ctrl + Shift + 8 - Toggle Show/Hide Script Whitespace Ctrl + Shift + 9 - Toggle Show/Hide Script EOL characters Ctrl - GUI Mode multicontrol selection F10 - Switch Modes F4 - Next Message Shift+F4 - Previous Message Shift+F5 - Clear Output Ctrl+M - Add Bookmark F2 - Next Bookmark Shift+F2 - Previous Bookmark Basic GUI Mode How To Create a Control - click a control on the left - click in the GUI you wish to add the control Left Click: Click and drag to auto resize the control Right Click: Creates the control at a standard size Select a Control - click inside the control or select it in the treeview Change a controls Data - First select the control - modify the controls data on the right, press enter to submit changes state, cursor, font and resizing update when you change the data - when modifying the data parameter the script recognizes if there is a variable in the data and will add quotes accordingly ex. data parameter = $data, End result in script: GUICtrlCreateButton($data, 50, 50, 100, 20) ex. data parameter = data, End result in script: GUICtrlCreateButton("data", 50, 50, 100, 20) ex. data parameter = "data"&$data, End result in script: GUICtrlCreateButton("data"&$data, 50, 50, 100, 20) Applying an Image to a control - select a control - control styles must be applied to some controls before adding an image - click the ... button next to the Image input in the Control Properties area in the bottom right - select the image you want to display, allows jpg, bmp, gif, ico and dll files - selecting a dll will open another prompt to choose which resource to display Control Grouping - multiple controls must be selected - press the group controls button - control grouping allows you to resize and move multiple controls at the same time, as of now groups are deleted when leaving GUI mode I only have a couple odds and ends to finish up before everything should be complete, I need to add Undo and Redo actions for copying and duplicating controls and a couple other minor things, eventually I want to try to add all of the UDF controls as well. If people are willing to translate the language file I would be very grateful, the ones I have right now are from Google translate, I only used them for testing and have no idea what they say. I want to thank Kip, Prog@ndy, Isi360 and all of the other contributors on this forum, without you guys i don't think i could have written this script. Please post any comments, problems or suggestions, BuckMaster * I only used one "magic number" on my main close case statement, only for faster locating, and i don't care. Form Builder Source.zip Form Builder.zip
    1 point
  6. To me it seems simple alternative to use $oXmlHttp = ObjCreate("Microsoft.XMLHTTP") $oXmlHttp.Open($type, $url, False) $oXmlHttp.Send() Return $oXmlHttp.ResponseText as seen in my example: '?do=embed' frameborder='0' data-embedContent>>
    1 point
  7. Can you try this (GDI+ version only): AutoIt version 3.3.10.0 or higher needed! #include <Array.au3> #include <GDIPlus.au3> #include <MsgBoxConstants.au3> _GDIPlus_Startup() Global $hImage1, $hImage2 Global $sImages = FileOpenDialog("Select 2 images", "", "Image (*.bmp;*.jpg;*.png;*.gif)", $FD_MULTISELECT) If @error Then _Exit("Nothing selected") Global $aFiles = StringSplit($sImages, "|", 2) If (UBound($aFiles) < 3) Then _Exit("Select at least 2 images") $hImage1 = _GDIPlus_ImageLoadFromFile($aFiles[1]) If @error Then _Exit("Unable to load " & $aFiles[1]) $hImage2 = _GDIPlus_ImageLoadFromFile($aFiles[2]) If @error Then _Exit("Unable to load " & $aFiles[2]) If (_GDIPlus_ImageGetWidth($hImage1) <> _GDIPlus_ImageGetWidth($hImage2)) Then _Exit("Width of both images are different") If (_GDIPlus_ImageGetHeight($hImage1) <> _GDIPlus_ImageGetHeight($hImage2)) Then _Exit("Height of both images are different") Global $bFastCmp = True Global $aDiff = _GDIPlus_ImageCompare($hImage1, $hImage2, $bFastCmp) If $bFastCmp Then Exit MsgBox($MB_SYSTEMMODAL, "Compared", "Equal: " & $aDiff & " / " & @extended & " ms") Global $iChk = MsgBox(BitOR($MB_SYSTEMMODAL, $MB_YESNO), "Information", "Found " & Round((UBound($aDiff) - 1) / ($aDiff[0][1] * $aDiff[0][2]) * 100, 2) & " % differences in " & Round($aDiff[0][0], 2) & " ms." & _ @CRLF & @CRLF & _ "Display the array with information") If ($iChk = 6) Then _ArrayDisplay($aDiff, "Differences", Default, Default, Default, "Runtime / Coordinate (x,y)|Image1 Color|Image2 Color") Func _GDIPlus_ImageCompare($hImage1, $hImage2, $bFastCmp = True) Local Const $iW = _GDIPlus_ImageGetWidth($hImage1), $iH = _GDIPlus_ImageGetHeight($hImage1) If ($iW <> _GDIPlus_ImageGetWidth($hImage2)) Then Return SetError(1, 0, 0) If ($iH <> _GDIPlus_ImageGetHeight($hImage2)) Then Return SetError(2, 0, 0) Local $t = TimerInit() Local $tBitmapData1 = _GDIPlus_BitmapLockBits($hImage1, 0, 0, $iW, $iH, $GDIP_ILMREAD, $GDIP_PXF32ARGB) Local $tBitmapData2 = _GDIPlus_BitmapLockBits($hImage2, 0, 0, $iW, $iH, $GDIP_ILMREAD, $GDIP_PXF32ARGB) Local $pScan1 = DllStructGetData($tBitmapData1, "Scan0") Local $tPixel1 = DllStructCreate("uint[" & $iW * $iH & "];", $pScan1) Local $iStride = Abs(DllStructGetData($tBitmapData1, "Stride")) Local $pScan2 = DllStructGetData($tBitmapData2, "Scan0") Local $tPixel2 = DllStructCreate("uint[" & $iW * $iH & "];", $pScan2) If $bFastCmp Then $iResult = DllCall("msvcrt.dll", "int:cdecl", "memcmp", "ptr", $pScan1, "ptr", $pScan2, "uint", DllStructGetSize($tPixel1))[0] Else If ($iW * $iH + 1) * 3 > 16 * 1024^2 Then Return SetError(3, 0, 0) Local $iX, $iY, $iRowOffset, $iPixel1, $iPixel2, $c = 1, $aDiff[$iW * $iH + 1][3] For $iY = 0 To $iH - 1 $iRowOffset = $iY * $iW + 1 For $iX = 0 To $iW - 1 $iPixel1 = DllStructGetData($tPixel1, 1, $iRowOffset + $iX) ;get pixel color $iPixel2 = DllStructGetData($tPixel2, 1, $iRowOffset + $iX) ;get pixel color If $iPixel1 <> $iPixel2 Then $aDiff[$c][0] = $iX & ", " & $iY $aDiff[$c][1] = "0x" & Hex($iPixel1, 8) $aDiff[$c][2] = "0x" & Hex($iPixel2, 8) $c += 1 EndIf Next Next $aDiff[0][0] = TimerDiff($t) $aDiff[0][1] = $iW $aDiff[0][2] = $iH EndIf _GDIPlus_BitmapUnlockBits($hImage1, $tBitmapData1) _GDIPlus_BitmapUnlockBits($hImage2, $tBitmapData2) If $bFastCmp Then Return SetError(0, Int(TimerDiff($t)), $iResult = 0) ReDim $aDiff[$c][3] Return $aDiff EndFunc Func _Exit($sError = "") If $sError <> "" Then MsgBox($MB_ICONERROR, "ERROR", $sError) If ($hImage1 <> 0) Then _GDIPlus_ImageDispose($hImage1) If ($hImage2 <> 0) Then _GDIPlus_ImageDispose($hImage2) _GDIPlus_Shutdown() Exit EndFunc Br, UEZ
    1 point
  8. Jon

    AutoIt v3.3.11.2 Beta

    File Name: AutoIt v3.3.11.2 Beta File Submitter: Jon File Submitted: 05 Jan 2014 File Category: Beta 3.3.11.2 (5th January, 2014) (Beta) AutoIt: - Fixed #2316: PowerPoint COM event handler initialization error. - Fixed: FileSelectFolder() uses the parent parameter. - Fixed #2512: ObjName() crash. UDFs: - Added: Example for _WinAPI_SystemParametersInfo(). - Fixed: UBound() default was regarded as $UBOUND_DIMENSIONS (0) and not $UBOUND_ROWS (1). - Fixed: _FileListToArrayRec() array concatenation bug. AutoIt3Help: - Changed: Version number to 1.0.0.6. - Added: Windows activation when already open. Others: - Changed: Help file syntax variable names to a standard naming convention for easier understanding and consitency in the calltip syntax files. Click here to download this file
    1 point
  9. Here's a demonstration of how to pass a function the name of another function in the current release version of AutoIt. $Function = Function2 ; $Function is now equal to Function2() Function1(Function2) ; Pass Function1 the function to call directly Function1($Function) ; Pass Function1 the function to call using the variable Func Function1($incoming) $incoming("Calling function2") EndFunc Func Function2($Title) MsgBox(0, $Title, "Function2") EndFunc
    1 point
  10. From my understanding of being in the game for sometime, people feel reluctant to post bug reports on beta releases as they believe the issue will be fixed once the product is declared stable. Though this isn't always the case, if no one reports the issue then how is Jon (a Dev) or such-like supposed to fix said issue. Another problem is getting people to beta test during the beta stage, as they see "beta" and instantly decide I will wait till the product is "stable". If the reason is they feel the product is a lot more stable once a product is out of beta, then without beta testers it's unlikely to be the case. It's quite logical really. Note: This is a general comment about software development.
    1 point
  11. jchd

    AutoIt Snippets

    A different approach: Func _RegExpStringBetween(Const $test, $start_pattern, Const $end_pattern) $start_pattern = StringRegExpReplace($start_pattern, "((?:\\\\)*)(\\Q.*?\\E)", "\1") StringRegExpReplace($start_pattern, "(?x) (?:\\\\)* \K (?<!\\) ( \( (?= \?< | \?' | \?P< ) | \( (?! \* | \? [-:\|>#\w=!+&(] | \? <= | \? <! | \? P= | \? P> ) )", "") Local $group = @extended Local $string_between = StringRegExp($test, $start_pattern & '(.*?)' & $end_pattern, 1) If @error Then Return SetError(1, 0, False) Else Return $string_between[$group] EndIf EndFunc
    1 point
  12. Melba23

    Injecting A DLL

    kalans, Please read the Forum rules (there is also a link at bottom right of each page) - they have changed since this thread was last used and now state: "Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects: [...] Running or injecting any code (in any form) intended to alter the original functionality of another process." So this subject is no longer legal and the thread will now be locked. M23
    1 point
  13. AutoIt Version : V3.3.0.0 Two older scripts ... they are not longer supported from me, but if anyone can use it ... _Au3Optim.au3: Optimizes au3-source-code + simple PreProzessor (#define-macros) The steps inside the function: ; merging lines ; merging strings ; caching all strings ; replacing #define directives ; replacing "inline" functions e.G. Func test($a,$b) Return $a*$b EndFunc ; replacing GLOBAL constants ; replace StringFormat ; replace StringLower/Upper/Left/Right/Mid/Len/StripWS/StripCR/TrimLeft|TrimRight|Replace ; replace Math-functions ; replace BitAnd/BitOr ; replace simple calculations ; merging one-line If-block ; removing redunant ElseIf ... Example 1 Input: #define msg(txt) MsgBox(0,"Test",txt) #define msg2(txt,title) MsgBox(0,title,txt) #define $bla "blubber" msg("Hallo") msg('Hallo 2') msg2("Hallo", "Titel") $text = $bla Example 2 Output: MsgBox(0,"Test","Hallo") MsgBox(0,"Test",'Hallo 2') MsgBox(0,"Titel","Hallo") $text = "blubber" Example 2 Input: ; Test.au3 fuer _Au3Optim #define @InetGetActive InetGetInfo() Global const $test=2 ; Test 1 global Const $test2 =4 global const $test3= 8 Global Const $test4 = "das ist ein Test" ; Test 4 global Const $test5 = 'das ist ein anderer Test' $bla1 = $test+ $test2 + $test3 $bla2 = $test4 $bla3 = $test5 DllStructCreate( _ "dword dwsize;" & _ "dword cntUsage;" & _ "dword th32ProcessID;" & _ "uint th32DefaultHeapID;" & _ "dword th32ModuleID;" & _ "dword cntThreads;" & _ "dword th32ParentProcessID;" & _ "long pcPriClassBase;" & _ "dword dwFlags;" & _ "char szExeFile[260]" _ ) $s = @InetGetActive $a7j = _k_() $ms = $s34 *1000*60*$min $t = (3 + 32) * 45 $ms = "1000*60*34" $ms = '1000*60*34' If _Bla() = 0 And $t = 0 or($t = 0) Then $bla = True If $a[0] = False Then $bla = True If @error = 0 Then If $a = 1 Or $t6575 = True Then $bla = True If $a = True Then $bla = True If @error = 1 Then $variable = $variable + 1 $i = $i *10 $s = StringFormat("%s %.2f %s", "test", 4.56345345 , "test") $s = StringFormat("%s %.2f", "test", 4.56345345 * $test2) $s = StringFormat("%s %.2f %s", "Das ist eine Zahl", 4.56345345 , $test20) Msg("Hallo Welt") $c = _F2C($F, 2) $c = _F2C(128, 2) $b1 = _Test0(1, 2) $b2 = _Test0(3, 4) $b3 = Abs(_Test0(5, 6) + 100) $a = 1 _Test1($a, 2) _Test2("Hallo ", "das ist ein ", "Test") ; Test 2 $b = _Test3("text") $c = _Test4(5) ; EndFunc ; ============================================================================== Func _fg($t = 0, $2 = 1) Local $t Return EndFunc Func _k_() Return(@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC) EndFunc Func _1_() Return "test" EndFunc Func _F2C($F, $iP) Return Round(($F - 32) * 5 / 9, $iP) EndFunc ;==>_F2C Func _Test0($a, $z) Return $z * 3 * $a + 100 EndFunc ;==>_Test0 Func _Test1(ByRef $a, $b) Return ConsoleWrite($a + $b) EndFunc ;==>_Test1 Func _Test2($a, $b, $c) Return ConsoleWrite($a & $b & $c & @CRLF) EndFunc ;==>_Test2 Func _Test3($u) Return $u EndFunc ;==>_Test3 Func _Test4($s) Local $r = $s * 2 Return $r EndFunc ;==>_Test4 Func Msg($s) Return MsgBox(0, "Message:", $s) EndFunc ;==>Msg Example 2 Output: ; Test.au3 fuer _Au3Optim $bla1 = 14 $bla2 = "das ist ein Test" $bla3 = 'das ist ein anderer Test' DllStructCreate( "dword dwsize;dword cntUsage;dword th32ProcessID;uint th32DefaultHeapID;dword th32ModuleID;dword cntThreads;dword th32ParentProcessID;long pcPriClassBase;dword dwFlags;char szExeFile[260]" ) $s = InetGetInfo() $a7j = (@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC) $ms = $s34 *60000*$min $t = (35) * 45 $ms = "2040000" $ms = '2040000' If Not _Bla() And Not $t or($t = 0) Then $bla = True If Not $a[0] Then $bla = True If Not @error Then If $a Or $t6575 Then $bla = True If $a Then $bla = True If @error Then $variable += 1 $i *= 10 $s = "test 4.56 test" $s = "test 18.25" $s = StringFormat("%s %.2f %s", "Das ist eine Zahl", 4.56345345 , $test20) MsgBox(0, "Message:", "Hallo Welt") $c = Round(($F - 32) * 0.555555555555556, 2) $c = 53.33 $b1 = 106 $b2 = 136 $b3 = Abs(290) $a = 1 ConsoleWrite($a + 2) ConsoleWrite("Hallo das ist ein Test" & @CRLF) ; Test 2 $b = "text" $c = _Test4(5) ; EndFunc ; ============================================================================== Func _fg($t = 0, $2 = 1) Local $t Return EndFunc Func _Test4($s) Local $r = $s * 2 Return $r EndFunc ;==>_Test4 Download: _Au3Optim.au3 _Patch.au3 Some compatibily patches for older scripts (3.3.0.0 => 3.3.2.0) (inlcuded from _Au3Optim if it in the same directory) #region Patches from 3.3.0.0 => 3.3.2.0 #OnAutoItStartRegister "OnAutoItStart" OnAutoItExitRegister("OnAutoItExit") #define @InetGetBytesRead InetGetInfo(Default, 0) #define @InetGetActive (Not InetGetInfo(Default, 2)) ; InetGet("abort") = InetClose($h) ;=============================================================================== Func _SQLite_SaveMode($fSaveModeState) Local $r = _SQLite_SafeMode($fSaveModeState) Return SetError(@error,@extended,$r) EndFunc ;==> ;=============================================================================== Func URLDownloadToFile($sURL, $sFilename, $iReload, $iBackground) ; ??? Return InetGet($sURL, $sFilename, $iReload, $iBackground) EndFunc ;==>URLDownloadToFile ;=============================================================================== Func AdlibEnable($sFunc, $iTime = 250) Return AdlibRegister($sFunc, $sTime) EndFunc ;==>AdlibEnable ;=============================================================================== Func AdlibDisable() Return AdlibUnRegister() EndFunc ;==>AdlibDisable ;=============================================================================== ; #FUNCTION# =================================================================== ; Name...........: _WinAPI_MakeDWord ; Description ...: Returns a DWord value from two int values ; Syntax.........: _WinAPI_MakeDWord($HiWord, $LoWord) ; Parameters ....: $HiWord - Hi word ; $LoWord - Low word ; Return values .: Success - DWord value ; Author ........: Gary Frost (gafrost) ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; ============================================================================== Func _WinAPI_MakeDWord($HiWord, $LoWord) Return BitOR($LoWord * 0x10000, BitAND($HiWord, 0xFFFF)) EndFunc ;==>_WinAPI_MakeDWord ; #FUNCTION# =================================================================== ; Name...........: _StringAddThousandsSep ; Description ...: Returns the original numbered string with the Thousands delimiter inserted. ; Syntax.........: _StringAddThousandsSep($sString[, $sThousands = -1[, $sDecimal = -1]]) ; Parameters ....: $sString - The string to be converted. ; $sThousands - Optional: The Thousands delimiter ; $sDecimal - Optional: The decimal delimiter ; Return values .: Success - The string with Thousands delimiter added. ; Author ........: SmOke_N (orignal _StringAddComma ; Modified.......: Valik (complete re-write, new function name) ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; ============================================================================== Func _StringAddThousandsSep($sString, $sThousands = -1, $sDecimal = -1) Local $sResult = "" ; Force string Local $rKey = "HKCU\Control Panel\International" If $sDecimal = -1 Then $sDecimal = RegRead($rKey, "sDecimal") If $sThousands = -1 Then $sThousands = RegRead($rKey, "sThousand") ;~ Local $aNumber = StringRegExp($sString, "(\d+)\D?(\d*)", 1) Local $aNumber = StringRegExp($sString, "(\D?\d+)\D?(\d*)", 1) ; This one works for negatives. If UBound($aNumber) = 2 Then Local $sLeft = $aNumber[0] While StringLen($sLeft) $sResult = $sThousands & StringRight($sLeft, 3) & $sResult $sLeft = StringTrimRight($sLeft, 3) WEnd ;~ $sResult = StringTrimLeft($sResult, 1) ; Strip leading thousands separator $sResult = StringTrimLeft($sResult, StringLen($sThousands)) ; Strip leading thousands separator If $aNumber[1] <> "" Then $sResult &= $sDecimal & $aNumber[1] EndIf Return $sResult EndFunc ;==>_StringAddThousandsSep #endregion Patches from 3.3.0.0 => 3.3.2.0
    1 point
  14. Try going to (Downloads ->AutoIt Team) http://www.autoitscript.com/forum/files/category/2-autoit-team/ and click the "Follow this category" button. If you have email notifications setup then you may get an email when a new item is posted.
    1 point
  15. Zedna

    Odorik.cz API

    Odorik is Czech VOIP provider http://www.odorik.cz/?jazyk=en with very good prices and they provide API for using some services through HTTP protocol. Specification of API (in Czech) is here http://www.odorik.cz/w/api I created Autoit's UDF for using it: For better readability I removed all error checking. Script was tested and all works fine, name/password/telephone/link are changed to illustrative ones. Names of some variables and texts translated from Czech to English. $name = '123456' $passw = 'password' $output = OdorikHttpCommand('GET', '/balance', '', $name, $passw) ConsoleWrite('balance: ' & $output & @CRLF) $output = OdorikHttpCommand('GET', '/lines', '', $name, $passw) ConsoleWrite('lines: ' & $output & @CRLF) $output = OdorikHttpCommand('GET', '/sms/allowed_sender', '', $name, $passw) ConsoleWrite('sms-allowed_sender: ' & $output & @CRLF) $output = OdorikHttpCommand('POST', '/callback', 'caller=602123456&recipient=602123456&line=123456', $name, $passw) ConsoleWrite('callback: ' & $output & @CRLF) $text = StringReplace('Testing SMS message through Odorik.cz API', ' ', '%20') $output = OdorikHttpCommand('POST', '/sms', 'sender=00420602123456&recipient=00420602123456&message=' & $text, $name, $passw) ConsoleWrite('sms: ' & $output & @CRLF) If Not StringInStr($output, 'successfully') Then ConsoleWrite("SMS message couldn't be sent. Reason: " & $output & @CRLF) Func OdorikHttpCommand($type, $command, $param = '', $name = '', $passw = '') $url = 'https://www.odorik.cz/api/v1/' & $command $url &= "?user=" & $name & "&password=" & $passw & "&user_agent=Autoit" If $param <> '' Then $url &= '&' & $param $oXmlHttp = ObjCreate("Microsoft.XMLHTTP") $oXmlHttp.Open($type, $url, False) $oXmlHttp.Send() Return $oXmlHttp.ResponseText EndFunc Here is link to topic on Odorik forum where I posted this: http://forum.odorik.cz/viewtopic.php?f=7&t=608&p=2967#p2967
    1 point
×
×
  • Create New...