Leaderboard
Popular Content
Showing content with the highest reputation on 11/13/2017 in all areas
-
NDog, Just add this line after you clear the image: ControlMove($hMain, "", $picUser, Default, Default, 100, 80) Then subsequent images adopt that size when loaded. M232 points
-
Barnsley Fractal Fern
user4157124 and one other reacted to Larnil for a topic
This script generates Barnsleys Fractal Fern using script only. ; version 2017-10-03 ; Barnsley Fractal Fern ; by larnil #include <GUIConstants.au3> Dim $x, $y, $xn, $yn, $n, $r, $dc $WinSize = 800 ; window size ;Create graphics windows AutoItSetOption("GUIOnEventMode", 1) $GUI = GUICreate("Barnsley Fractal Fern", $WinSize, $WinSize, -1, -1) $Graphic = GuiCtrlCreateGraphic(0, 0, $WinSize, $WinSize) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE,"Bye") ;Main $start = TimerInit() _Fern(800) ; hight of fern - can be larger than window MsgBox(0,"Time taken:",Round(TimerDiff($start)/1000,3) &" seconds") While 1 Sleep(100) WEnd Func Bye() Exit EndFunc Func _Fern($height) $f = $height/10.6 ; scale factor. Complete fern is within 0 <= y <= 9.9983 (with no scale) $offset_x = $height/2 - $height/40 ; Side adjustment. Fern is within −2.1820 < x < 2.6558 (with no scale) For $n = 1 To $height*200 ; Number of iterations $r = Random(0, 99, 1) Select Case $r < 85 ; 0-84 = 85% of the time $xn = 0.85 * $x + 0.04 * $y $yn = -0.04 * $x + 0.85 * $y + 1.6 Case $r > 84 AND $r < 92 ; 85-91 = 7% of the time $xn = 0.2 * $x - 0.26 * $y $yn = 0.23 * $x + 0.22 * $y + 1.6 Case $r > 91 AND $r < 99 ; 92-98 = 7% of the time $xn = -0.15 * $x + 0.28 * $y $yn = 0.26 * $x + 0.24 * $y + 0.44 Case Else ; 99-99 = 1% of the time $xn = 0 $yn = 0.16 * $y EndSelect $x = $xn $y = $yn GUICtrlSetGraphic($Graphic, $GUI_GR_PIXEL, $offset_x + $x * $f, $height - $y * $f) Next GUICtrlSetGraphic($Graphic, $GUI_GR_REFRESH) EndFunc ;==> Fern Here is another example where I have used GDI (my very first attempt at using GDI by the way). This script can generate much larger Ferns and save them to file (png). I have used this script to generate a 20000 x 20000 pixel @ 600 dpi image. Looks really good printed out in full size. #include <GDIPlus.au3> #include <GUIConstantsEx.au3> ; Param Local Const $iPxColor = 0xFF00FF00 ; Pixel color for fractal Alpha/R/G/B Local Const $iBgColor = 0xFFFFFFFF ; Background color for image Alpha/R/G/B Local Const $iSize = 1000 ; Hight of fern in pixels - image will have this hight and width too Local Const $iIter = $iSize*400 ; Number of iterations - $iSize * 200 is a good starting point ; Call function ;$start = TimerInit() _Fern($iSize,$iIter) ;MsgBox(0,"Time taken:",Round(TimerDiff($start)/1000,3) &" seconds") ; Function for generating Barnsley Fractal Fern Func _Fern($Size,$Iter) _GDIPlus_Startup() ; initialize GDI+ Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($Size, $Size) ; create an empty bitmap Local $hBmpCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) ; get the graphics context of the image _GDIPlus_GraphicsClear($hBmpCtxt, $iBgColor) ; Set the background color for empty bitmap ; Here the magic happens $x=0 ; init $y=0 ; init $f = $Size/10.6 ; scale factor. Complete fern is within 0 <= y <= 9.9983 (with no scale) $offset_x = $Size/2 - $Size/40 ; Side adjustment. Fern is within −2.1820 < x < 2.6558 (with no scale) For $n = 1 To $Iter ; Number of iterations $r = Random(0, 99, 1) Select Case $r < 85 ; 0-84 = 85% of the time $xn = 0.85 * $x + 0.04 * $y $yn = -0.04 * $x + 0.85 * $y + 1.6 Case $r > 84 AND $r < 92 ; 85-91 = 7% of the time $xn = 0.2 * $x - 0.26 * $y $yn = 0.23 * $x + 0.22 * $y + 1.6 Case $r > 91 AND $r < 99 ; 92-98 = 7% of the time $xn = -0.15 * $x + 0.28 * $y $yn = 0.26 * $x + 0.24 * $y + 0.44 Case Else ; 99-99 = 1% of the time $xn = 0 $yn = 0.16 * $y EndSelect $x = $xn $y = $yn _GDIPlus_BitmapSetPixel($hBitmap, $offset_x + $x * $f, $Size - $y * $f, $iPxColor) ; Change pixel color for calculated X,Y Next ; ==> End of magic $File = "\Fractal_Fern_"&StringRight(Hex($iPxColor),6)&"-"&StringRight(Hex($iBgColor),6)&"-"&$iSize&".png" _GDIPlus_ImageSaveToFile($hBitmap, @MyDocumentsDir & $File) ;save bitmap to disk ShellExecute(@MyDocumentsDir & $File); Show it to the world in your default image viewer ; Cleanup GDI+ resources _GDIPlus_GraphicsDispose($hBmpCtxt) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() EndFunc ;==> _Fern2 points -
StringRegExpReplace($sInput, "\w+\s+[^;]+;", "")1 point
-
VBS to AU3
colegero reacted to JLogan3o13 for a topic
@colegero welcome to the forum. On this forum we follow the "teach a man to fish" motto. We are dedicated to helping people with their scripts; it is not a place where you put in a request and someone barfs up code for you. If you will spend 10 minutes with the help file you will find that the syntax is very similar between the two. Look at sections in the help file like ObjCreate, FileWrite, etc. and you should be well on your way. If, after you try it on your own, you are having problems, feel free to post your code and we will do our best to assist1 point -
AutoIt combo box SAP manipulation
PauloRodrigues reacted to JLogan3o13 for a topic
If the Window Info Tool is not giving you what you need, have a look at the IUIAutomation thread in the examples forum. What does Simple Spy show you? Also, please use the reply button rather than quoting everything, it pads the thread unnecessarily. I know what I said, I was there when I said it1 point -
Store Word Document in Autoit Gui
argumentum reacted to Neonovaz for a topic
yup got that ! Thanks everyone for your guidance ! got it working1 point -
AutoIt combo box SAP manipulation
PauloRodrigues reacted to JLogan3o13 for a topic
@PauloRodrigues have you tried looking at the SAP UDF? It works well as long as the SAP GUI Scripting Interface is enabled.1 point -
how to retrieve data/text from GUICtrlCreateInput into a variable?
argumentum reacted to Shirdish_chakravarthi for a topic
@argumentum i was able to do it using your help "ControlGetText()" thanks1 point -
I would like to automate the calendar publishing in Outlook 2010
Earthshine reacted to peder303 for a topic
Thanks @Earthshine!!! Many thanks!1 point -
controlsend and winapi
neypro reacted to JLogan3o13 for a topic
@neypro are you using the $SEND_RAW flag on ControlSend?1 point -
This? Local $sInput = "10.0.0.12>>>local\User1;IIS2\user2" Local $sOutput = StringRegExpReplace($sInput, "(?<=>|;)[^>]*?\\", "") ConsoleWrite($sOutput & @LF)1 point
-
LynCruz, Then why did you not say so? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 100, 100, Default, Default, $WS_SYSMENU, $WS_EX_TOOLWINDOW) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd M231 point
-
Store Word Document in Autoit Gui
Neonovaz reacted to argumentum for a topic
nope, FileInstall("source", "dest" [, flag = 0]) will dump/write/copy the file to a destination. If you wanna remove it, you'll have to write a line of code to do so.1 point