Leaderboard
Popular Content
Showing content with the highest reputation on 05/22/2016 in all areas
-
Jos, We no longer use "pilot error" - the new term is "human factors". Or perhaps in this case we could compromise on "keyboard-chair interface". M231 point
-
using algorithm in autoit
XtremeCoder reacted to Melba23 for a topic
XtremeCoder, Searching the forums will provide you with a lot more information in greater detail, but in brief: Your plain language script is within the compiled .exe, but in compressed form. It is not immediately viewable with a hex editor, but is by no means secure as it is expanded in memory when the .exe is run. So, compiling an AutoIt script will prevent quick snooping, but a determined, experienced hacker can relatively easily get your source - including passwords, specific filenames, etc - or the encryption routines you have used in your script to encrypt/decrypt them if they are stored in another file. TL;DR: You cannot. Thread locked. M231 point -
what's the best GUI Creator
XtremeCoder reacted to water for a topic
Then you need to define the needed functionality of a "best GUI creater" ("need to have" and "nice to have") and then check all GUI designers of the list compiled by TheSaint. If none matches all "need to have" requirements then you will have to code it yourself (either the GUI or the GUI designer)1 point -
I write mine by hand 95% of the time.1 point
-
@TheSaint One new for GUI CREATION RELATED1 point
-
Hi. You are a solar enthusiast? for my personal fun I wrote these two scripts. The first one is downloading all the JPG solar pictures, starting at a given date. the 2nd one will display them in an Autoit GUI, with an adjustable image difference for your right and left eye: "Stare through" your monitor, so that your left eye will focus the left image, your right eye the right image, then you will recognize the 3D effect. If you have difficulties to "match" the left / right image to your left / right eye, then ... decrease the GUI's size (PAGE-DN), until the "image-middle-distance" is a bit BELOW your eye's distance (depends on your monitor's size and your physiognomy) put your face very close to your monitor, then slowly fade back, until you will recognize to see virtually THREE images Wait a moment to recognize the 3D effect of the "middle image" Concentrate on this "middle image" and it's 3D effect AVOID rotating or moving your head in any direction, except forward/backward! This propably will kill down the focus, if you've had difficulties to get it in the beginning! Try to SLOWLY fade back with your face even more, until you have reached a comfortable distance. Now use PAGE-UP, do increase the GUI's (the images) size: Once you've caught the 3D "match", you can usually increase the size to values, you would have never ever been able to "match" at the first time. (The downloaded images are 1024 x 1024 pixels) #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Description=Display NASA JPG solar pics as a 3D movie #AutoIt3Wrapper_Res_Fileversion=1.0.0.7 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_Res_LegalCopyright=Rudi Thilo #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_Res_Field=phone|+49 171 685 9 685 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs autoit v3.3.12.0 author: Rudi Thilo +49 171 685 9 685 Download the solar JPG pictures of NASA from the subfolders of the URL specified as first variable declaration 1.) download the JPGs using this script 2.) Use "Solar-GUI-2.au3 to display them as a movie inside an Autoit3 GUI as a "poor-man's-3D-cinema" Both scripts have to be in the same folder. have fun! :D #ce #include <Inet.au3> #include <Date.au3> $url = "http://sdo.gsfc.nasa.gov/assets/img/browse/" $Start = "2015/01/01" $NextDate = $Start $RegExJpgName = '(.*?<a href=")([\d_]+?_1024_0193\.jpg)(">.*)' ; $2 returns the JPG file name. Size 1024x1024, Picture colouring type 0193 (whatsoever that exactly means ;-) $SolarFolder = @ScriptDir & "\SolarJPGs\" DirCreate($SolarFolder) ShellExecute($SolarFolder) HttpSetProxy(1) ; direct access While (_DateDiff("D", $NextDate, _NowCalcDate()) > -1) $NextFolder = $url & $NextDate & "/" ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $NextFolder = ' & $NextFolder & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console GetJPGs($NextFolder) $NextDate = _DateAdd("D", 1, $NextDate) WEnd Func GetJPGs($_URL) $page = _INetGetSource($_URL) $aPage = StringSplit($page, "<tr>", 1) if @error then Exit For $a = 1 To $aPage[0] If StringRegExp($aPage[$a], $RegExJpgName) Then $_JPG = StringStripWS(StringRegExpReplace($aPage[$a], $RegExJpgName, "$2"), 1 + 2) $_NextURL = $_URL & $_JPG $_NextJPG = $SolarFolder & $_JPG If FileExists($_NextJPG) Then ContinueLoop ; that file has been downloaded before ALREADY ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $_NextJPG = ' & $_NextJPG & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $result = InetGet($_NextURL, $_NextJPG, 1 + 2, 1) EndIf Next EndFunc ;==>GetJPGs #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Description=Display NASA JPG solar pics as a 3D movie #AutoIt3Wrapper_Res_Fileversion=2.0.0.17 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_Res_LegalCopyright=Rudi Thilo #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_Res_Field=phone|+49 171 685 9 685 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs autoit v3.3.12.0 display the previously downloaded solar images as a movie in one Autoit3 GUI, to get some 3D impression use ARROW-UP to increase the GUI's size use ARROW-DOWN to decrease the GUI's size use LEFT-ARROW to run the movie backward use RIGHT-ARROW to run the movie forward use PAGEUP to increase the delta between the two images (more 3D effect) use PAGEDN to decrease the delta between the two images. Negative values will give you a strange effect use ESC to close the program have fun! :D #ce #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <Misc.au3> #include <file.au3> $SolarFolder = @ScriptDir & "\SolarJPGs\" #Region Fill array with all found JPG files $aJPGs = _FileListToArray($SolarFolder, "*.jpg", 1, 1) If @error Then MsgBox(0, "Solar JPGs", "No JGP files found in path" & @CRLF & $SolarFolder) Exit EndIf _ArraySort($aJPGs, 0, 1) #EndRegion Fill array with all found JPG files $Delta = 3 $forward = True $LastDate = StringLeft($aJPGs[1], 4) & "-" & StringMid($aJPGs[1], 5, 2) & "-" & StringMid($aJPGs[1], 7, 2) Local $hDLL = DllOpen("user32.dll") AdlibRegister("ReadKeys") $h = 300 $w = $h * 2 $margin = 2 $GuiTitle = "solar movie, " & $h & " px, " $Gui = GUICreate($GuiTitle & $LastDate, $w + $margin, $h + $margin) $Left = GUICtrlCreatePic($aJPGs[1 + $Delta], $margin, $margin, $w / 2 - $margin * 2, $h - $margin * 2) $Right = GUICtrlCreatePic($aJPGs[1], $w / 2 + $margin, $margin, $w / 2 - $margin * 2, $h - $margin * 2) GUISetState() $pointer = 1 While 1 If ($pointer + $Delta) > (UBound($aJPGs) - 1) Or ($pointer > UBound($aJPGs)) Then MsgBox(0, "", "Last image reached." & @CRLF & @CRLF & "Changing direction to reverse now...", 3) $forward = False $pointer -= 1 ElseIf ($pointer < 1) Or ($pointer + $Delta) < 1 Then MsgBox(0, "", "First image reached." & @CRLF & @CRLF & "Changing direction to forward now...", 3) $forward = True $pointer += 1 EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ConsoleWrite("close erkannt" & @CRLF) #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Default Button=Second, Icon=Question, Timeout=5 ss, Miscellaneous=Top-most attribute If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(262436, "ESC recognized", "Do you want to terminate this program?", 5) Select Case $iMsgBoxAnswer = 6 ;Yes Exit Case $iMsgBoxAnswer = 7 ;No Case $iMsgBoxAnswer = -1 ;Timeout EndSelect #EndRegion --- CodeWizard generated code Start --- EndSwitch $NextName = $aJPGs[$pointer + $Delta] $NextName = StringTrimLeft($NextName, StringInStr($NextName, "\", 0, -1)) $NextDate = StringLeft($NextName, 4) & "-" & StringMid($NextName, 5, 2) & "-" & StringMid($NextName, 7, 2) If $NextDate <> $LastDate Then $LastDate = $NextDate AdjustTitle() EndIf $L = $aJPGs[$pointer + $Delta] $R = $aJPGs[$pointer] GUICtrlSetImage($Left, $L) GUICtrlSetImage($Right, $R) If $forward Then $pointer += 1 Else $pointer -= 1 EndIf WEnd Func ReadKeys() $aPos = WinGetPos($Gui) If _IsPressed("26", $hDLL) Then ; UP arrow key $h += 2 $w = $h * 2 WinMove($Gui, "", $aPos[0] - 1, $aPos[1] - 1, $w + $margin * 4, $h + $margin * 2 + 20) ; symmetrically expand one pixel in each direction AdjustTitle() GUICtrlDelete($Left) GUICtrlDelete($Right) $Left = GUICtrlCreatePic($L, $margin, $margin, $w / 2 - $margin * 2, $h - $margin * 2) $Right = GUICtrlCreatePic($R, $w / 2 + $margin, $margin, $w / 2 - $margin * 2, $h - $margin * 2) ElseIf _IsPressed("28", $hDLL) Then ; DOWN arrow key $h -= 2 $w = $h * 2 WinMove($Gui, "", $aPos[0] + 1, $aPos[1] + 1, $w + $margin * 4, $h + $margin * 2 + 20) ; symmetrically shrink one pixel in each direction AdjustTitle() GUICtrlDelete($Left) GUICtrlDelete($Right) $Left = GUICtrlCreatePic($L, $margin, $margin, $w / 2 - $margin * 2, $h - $margin * 2) $Right = GUICtrlCreatePic($R, $w / 2 + $margin, $margin, $w / 2 - $margin * 2, $h - $margin * 2) ElseIf _IsPressed("21", $hDLL) Then ; PAGE-UP key $Delta += 1 If ($pointer + $Delta) > (UBound($aJPGs) - 1) Then MsgBox(0, "", "The End") Exit EndIf AdjustTitle() ElseIf _IsPressed("22", $hDLL) Then ; PAGE-DOWN key $Delta -= 1 AdjustTitle() ElseIf _IsPressed("25", $hDLL) Then ; LEFT cursor key $forward = False ElseIf _IsPressed("27", $hDLL) Then ; RIGHT cursor key $forward = True EndIf EndFunc ;==>ReadKeys Func AdjustTitle() $GuiTitle = "solar movie, " & $h & " px, D: " & $Delta & " " & $LastDate WinSetTitle($Gui, "", $GuiTitle) EndFunc ;==>AdjustTitle Regards, Rudi.1 point
-
what's the best GUI Creator
XtremeCoder reacted to TheDcoder for a topic
I would not say its the best... but its the best in my opinion is: AutoIt Form Studio 2 (which is a plugin bundled with ISN AutoIt Studio)1 point -
Better is post #9 But the following one : Opt("MustDeclareVars", 1) #AutoIt3Wrapper_Run_AU3Check=Y #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #include <MsgBoxConstants.au3> _Example("https://www.somenotexistingurl.com") Func _Example($sURL) Local $sURL_Status = _ULRNotifier(_URL_CheckStatus($sURL)) If @error Then Return SetError(@error, @extended, $sURL_Status) MsgBox($MB_OK + $MB_ICONINFORMATION, 'SUCCESS', '$sURL_Status=' & $sURL_Status) EndFunc ;==>_Example Func _URL_CheckStatus($sURL) _URLChecker_COMErrDescripion("") Local $oErrorHandler = ObjEvent("AutoIt.Error", "_URLChecker_COMErrFunc") #forceref $oErrorHandler Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("HEAD", $sURL, False) If @error Then Return SetError(1, @error, '') $oHTTP.Send() Local $iError = @error Local $sStatus = $oHTTP.Status If @error Then Return SetError(3, @error, $sStatus) If $iError Then Return SetError(2, $iError, $sStatus) Return $sStatus EndFunc ;==>_URL_CheckStatus Func _URLChecker_COMErrFunc($oError) _URLChecker_COMErrDescripion($oError.description) Return ; you can comment/dlete this return to show full error descripition ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "$oError.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "$oError.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "$oError.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "$oError.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "$oError.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "$oError.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "$oError.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "$oError.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "$oError.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_URLChecker_COMErrFunc Func _URLChecker_COMErrDescripion($sDescription = Default) Local Static $sDescription_static = '' If $sDescription <> Default Then $sDescription_static = $sDescription Return $sDescription_static EndFunc ;==>_URLChecker_COMErrDescripion Func _ULRNotifier($vResult, $iError = @error, $iExtended = @extended) If $iError Then ConsoleWrite( _ "! @error = " & $iError & " @extended = " & $iExtended & " $vResult = " & $vResult & @CRLF & _ "! " & _URLChecker_COMErrDescripion() & @CRLF _ ) Return SetError($iError, $iExtended, $vResult) EndFunc ;==>_ULRNotifier is the best - at least for the moment when I post it1 point
-
Why you mixing Local and Global statement at the same scope level ? Global $aURL = "https://www.autoitscriptA.com/forum/topic/aloha" Local $urlStatus = _URLStatus($aURL) Here is better example: #include <MsgBoxConstants.au3> _Example("https://www.somenotexistingurl.com") Func _Example($sURL) Local $sURL_Status = _ULRNotifier(_URL_CheckStatus($sURL)) If @error Then Return SetError(@error, @extended, $sURL_Status) MsgBox($MB_OK + $MB_ICONINFORMATION, 'SUCCESS', '$sURL_Status=' & $sURL_Status) EndFunc ;==>_Example Func _URL_CheckStatus($sURL) _URLChecker_COMErrDescripion("") Local $oErrorHandler = ObjEvent("AutoIt.Error", "_URLChecker_COMErrFunc") $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("HEAD", $sURL, False) If @error Then Return SetError(1, @error, 0) $oHTTP.Send() If @error Then Return SetError(2, @error, 105) ;Error 105 (net::ERR_NAME_NOT_RESOLVED) Local $sStatus = $oHTTP.Status If @error Then Return SetError(3, @error, 118) ;Error 118 (net::ERR_CONNECTION_TIMED_OUT) Return $sStatus EndFunc ;==>_URL_CheckStatus Func _URLChecker_COMErrFunc($oError) _URLChecker_COMErrDescripion($oError.description) Return ; you can comment/dlete this return to show full error descripition ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "$oError.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "$oError.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "$oError.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "$oError.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "$oError.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "$oError.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "$oError.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "$oError.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "$oError.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_URLChecker_COMErrFunc Func _URLChecker_COMErrDescripion($sDescription = Default) Local Static $sDescription_static = '' If $sDescription <> Default Then $sDescription_static = $sDescription Return $sDescription_static EndFunc ;==>_URLChecker_COMErrDescripion Func _ULRNotifier($vResult, $iError = @error, $iExtended = @extended) If $iError Then ConsoleWrite( _ "! @error = " & $iError & " @extended = " & $iExtended & " $vResult = " & $vResult & @CRLF & _ "! " & _URLChecker_COMErrDescripion() & @CRLF _ ) Return SetError($iError, $iExtended, $vResult) EndFunc ;==>_ULRNotifier1 point
-
I'm not to be able to hold a candle to AndyG but here we go. My slower, not optimized / non MMX/SSE, ASM version. #include <GDIPlus.au3> $sFile = FileOpenDialog("Select an image", "", "Images (*.jpg;*.bmp;*.png;*.gif;*.tif)") If @error Then Exit MsgBox(0, "Information", "Nothing selected") _GDIPlus_Startup() Global Const $hBitmap = _GDIPlus_BitmapCreateFromFile($sFile) Global $fTimer = TimerInit() Global $iResult = ASM_BitmapGetAverageColorValue($hBitmap) ConsoleWrite(TimerDiff($fTimer) & " ms" & @CRLF) MsgBox(0, "Test", "Average color value: 0x" & Hex($iResult, 8) & @CRLF) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_Shutdown() Func ASM_BitmapGetAverageColorValue($hBitmap) ;coded by UEZ build 2016-02-08 Local $aDim = _GDIPlus_ImageGetDimension($hBitmap) If @error Then Return SetError(0, 0, 0) Local Const $iPixels = $aDim[0] * $aDim[1] Local $tBitmapData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aDim[0], $aDim[1], $GDIP_ILMREAD, $GDIP_PXF32ARGB) Local $pScan = $tBitmapData.Scan0 Local $iStride = $tBitmapData.Stride * 4 Local $tPixelData = DllStructCreate("dword[" & Abs($iStride * $aDim[1]) & "]", $pScan) Local $tStruct_ARGB = DllStructCreate("uint Alpha;uint Red;uint Green;uint Blue") Local $tCodeBuffer = DllStructCreate("byte ASM[75]") $tCodeBuffer.ASM = "0x8B7424048B7C24088B4C240C8B0689C381E3FF000000015F0C89C381E300FF0000C1EB08015F0889C381E30000FF00C1EB10015F0489C381E3000000FFC1EB18011F83C60483E90177C2C3" Local $aRet = DllCall("user32.dll", "none", "CallWindowProcW", "ptr", DllStructGetPtr($tCodeBuffer), _ "ptr", DllStructGetPtr($tPixelData), _ "ptr", DllStructGetPtr($tStruct_ARGB), _ "uint", $iPixels, _ "int", Null) _GDIPlus_BitmapUnlockBits($hBitmap, $tBitmapData) Local $iResult = 0x1000000 * Int($tStruct_ARGB.Alpha / $iPixels) + 0x10000 * Int($tStruct_ARGB.Red / $iPixels) + 0x100 * Int($tStruct_ARGB.Green / $iPixels) + Int($tStruct_ARGB.Blue / $iPixels) Return $iResult EndFunc For a 3000x30002 image it takes ~200 ms.1 point
-
Edit control limits
argumentum reacted to MrCreatoR for a topic
Well, it's works for me (AutoIt 3.2.8.1 and 3.2.10.0): #include <GuiConstants.au3> ;~ Global Const $EM_LIMITTEXT = 0xC5 $GUI = GUICreate("Test Script", 300, 200) $hEdit = GUICtrlCreateEdit("Please wait...", 10, 20, 280, 160, $ES_MULTILINE+$WS_VSCROLL+$ES_WANTRETURN) GUICtrlSendMsg($hEdit, $EM_LIMITTEXT, -1, 0) GUISetState(@SW_SHOW, $GUI) $sData = "" For $i = 1 To 50000 $sData &= "a" Next GUICtrlSetData($hEdit, $sData & @CRLF & @CRLF & "No Limit(?) :) , StringLen($sData): " & StringLen($sData)) ControlSend($GUI, "", $hEdit, "^{END}") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd1 point