-
Posts
1,203 -
Joined
-
Last visited
-
Days Won
40
Community Answers
-
Werty's post in AutoIt always opens on left side of screen. was marked as the answer
In SciTE go to Options and Open User Options File and add this...
## Scite start position and size position.left=50 position.top=50 position.width=2450 position.height=1250 ...and change to your likings.
You can change many things, here's how my user options file look...
# User defined key commands user.shortcuts=\ # Ctrl+Shift+V|IDM_PASTEANDDOWN|\ #Ctrl+PageUp|IDM_PREVFILE|\ #Ctrl+PageDown|IDM_NEXTFILE|\ KeypadMinus|IDM_BLOCK_COMMENT|\ Ctrl+F1|IDM_HELP_SCITE| ## Scite start position and size position.left=50 position.top=50 position.width=2450 position.height=1250 split.vertical=0 # open new tab instead of new window check.if.already.open=1 # default linewrap wrap=0 # default statusbar visibility statusbar.visible=1 # clears output window before executing clear.before.execute=1 # default output window location. 0=bottom, 1=side output.initial.hide=0 # at open, load previously open files from close save.session=1 # set default zoom level magnification=1 # set default directory to last opened script open.dialog.in.file.directory=1 # show line numbers line.margin.visible=1 style.au3.32=style.*.32=$(font.base),back:#FFFFFF font.base=font:Courier New,size:10,$(font.override) font.small=font:Courier New,size:8,$(font.override) font.monospace=font:Courier New,size,size:12 indent.size=4 indent.size.*.au3=4 use.tabs=1 caret.line.back=#FFFEBF selection.fore=#006000 selection.alpha=50 selection.back=#EA7783 style.au3.34=fore:#0000FF,back:#FFFFFF style.au3.35=fore:#009933,back:#FFFFFF style.au3.0=fore:#000000,back:#FFFFFF style.au3.1=fore:#008000,italics,back:#FFFFFF style.au3.2=fore:#669900,back:#FFFFFF style.au3.3=fore:#0000FF,back:#FFFFFF style.au3.4=fore:#000090,back:#FFFFFF style.au3.5=fore:#0000FF,back:#FFFFFF style.au3.6=fore:#FF33FF,back:#FFFFFF style.au3.7=fore:#FF0000,back:#FFFFFF style.au3.8=fore:#FF0000,back:#FFFFFF style.au3.9=fore:#AA0000,back:#FFFFFF style.au3.10=fore:#FF8800,back:#FFFFFF style.au3.11=fore:#F000FF,back:#FFFFFF style.au3.12=fore:#A00FF0,back:#FFFFFF style.au3.13=fore:#FF0000,back:#FFFFFF style.au3.14=fore:#0000FF,back:#FFFFFF style.au3.15=fore:#0080FF,back:#FFFFFF
-
Werty's post in Loop fails on 9964th iteration was marked as the answer
Now we are getting somewhere, updated version, got rid of gdiplus, no more bitmapcreatefromHbitmap or bitmaplockbits.
Though I couldnt get screencapture_capture to work with it, need to experiment some more, so made my own. (I can only guess but I think there's something wrong with screencapture_capture function, the same problem i had earlier where I had to use bitmapclone)
;Be sure $posx and $posy is pointing at the correct spot! Global $posx = 1718, $posy = 699, $result = "", $code[3] ;Lookup table to avoid searching Global $digit[115] = [1,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,6,0,0,0,3,2,0,0,0,0, _ 0,0,0,0,0,0,0,0,9,0,0,0,0,0,8,0,0,0,0,0, _ 0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,5] ;Instead of screencapture_capture() $hDDC = _WinAPI_GetDC(0) $hCDC = _WinAPI_CreateCompatibleDC($hDDC) $hBmp = _WinAPI_CreateCompatibleBitmap($hDDC, 34, 20) _WinAPI_SelectObject($hCDC, $hBmp) _WinAPI_BitBlt($hCDC, 0, 0, 34, 20, $hDDC, $posx, $posy, 0x00CC0020) _WinAPI_DeleteDC($hCDC) $result = Getnumber($result) Func Getnumber($result) Local $code[3] = [0,0,0], $value = 64, $pixels = DllStructCreate('dword[680]') DllCall('gdi32.dll', 'dword', 'GetBitmapBits', 'ptr', $hBmp, 'dword', DllStructGetSize($pixels), 'ptr', DllStructGetPtr($pixels)) For $loop = 1 To 680 Step 102 $code[0] += DllStructGetData($pixels, 1, $loop ) = 4278255360 ? $value:0 $code[1] += DllStructGetData($pixels, 1, $loop+16) = 4278255360 ? $value:0 $code[2] += DllStructGetData($pixels, 1, $loop+32) = 4278255360 ? $value:0 $value /= 2 Next Return String($digit[$code[0]]) & String($digit[$code[1]]) & String($digit[$code[2]]) EndFunc And a runable example (needs pic from the zip earlier)
#include <GDIPlus.au3> #include <WinAPI.au3> HotKeySet("{ESC}", "_exit") ;Be sure $posx and $posy is pointing at the correct spot! Global $posx = 1718, $posy = 699, $result = "", $code[3] ;Lookup table to avoid searching Global $digit[115] = [1,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,6,0,0,0,3,2,0,0,0,0, _ 0,0,0,0,0,0,0,0,9,0,0,0,0,0,8,0,0,0,0,0, _ 0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, _ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,5] ;Test section ;-------------------------------------------------------------- $gui = GUICreate("Getnumber", 640, 480, -1, -1) GUISetState() WinWaitActive($gui); <--- necessary or screencapture fails _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($gui) $image = _GDIPlus_BitmapCreateFromFile("374.png") _GDIPlus_GraphicsDrawImageRect($graphics, $image, 280, 200, 136, 31) Sleep(10); <------- necessary because drawimagerect() is too slow, script occasionally fails without ;-------------------------------------------------------------- ;/Test section $time = TimerInit() ;Instead of screencapture_capture() $hDDC = _WinAPI_GetDC(0) $hCDC = _WinAPI_CreateCompatibleDC($hDDC) $hBmp = _WinAPI_CreateCompatibleBitmap($hDDC, 34, 20) _WinAPI_SelectObject($hCDC, $capture) _WinAPI_BitBlt($hCDC, 0, 0, 34, 20, $hDDC, $posx, $posy, 0x00CC0020) _WinAPI_DeleteDC($hCDC) $result = Getnumber($result) Consolewrite("Result: " & $result & " Time: " & TimerDiff($time)/1000 & @crlf) While 1 Sleep(10) WEnd Func Getnumber($result) Local $code[3] = [0,0,0], $value = 64, $pixels = DllStructCreate('dword[680]') DllCall('gdi32.dll', 'dword', 'GetBitmapBits', 'ptr', $hBmp, 'dword', DllStructGetSize($pixels), 'ptr', DllStructGetPtr($pixels)) For $loop = 1 To 680 Step 102 $code[0] += DllStructGetData($pixels, 1, $loop ) = 4278255360 ? $value:0 $code[1] += DllStructGetData($pixels, 1, $loop+16) = 4278255360 ? $value:0 $code[2] += DllStructGetData($pixels, 1, $loop+32) = 4278255360 ? $value:0 $value /= 2 Next Return String($digit[$code[0]]) & String($digit[$code[1]]) & String($digit[$code[2]]) EndFunc Func _exit() _GDIPlus_Shutdown() Exit EndFunc I guess it should be faster now, please test and report back.
/edit
Btw, if you are loading alot of images from disk then make sure they are in uncompressed .bmp format, it takes up more space on the drive but it's faster than png, doesnt have to be decompressed as png does, Atleast 5-10% faster using bmp, especially with that many pics.
-
Werty's post in how to call a button of the same application was marked as the answer
How about...(the but_check_all)
#include <GUIConstants.au3> Local $hGUI = GUICreate ( "Test" , 300 , 250 ) Local $But_check_1 = GUICtrlCreateButton ( "Button 1" , 10 , 10 , 50 , 20 ) Local $But_check_2 = GUICtrlCreateButton ( "Button 2" , 10 , 40 , 50 , 20 ) Local $But_check_3 = GUICtrlCreateButton ( "Button 3" , 10 , 70 , 50 , 20 ) Local $But_check_4 = GUICtrlCreateButton ( "Button 4" , 10 , 100 , 50 , 20 ) Local $But_check_5 = GUICtrlCreateButton ( "Button 5" , 10 , 130 , 50 , 20 ) Local $But_check_All = GUICtrlCreateButton ( "Button All" , 10 , 170 , 50 , 20 ) GUISetState ( ) While True Switch GUIGetMsg ( ) Case $GUI_EVENT_CLOSE ExitLoop Case $But_check_1 ;Do something Case $But_check_2 ;Do something Case $But_check_3 ;Do something Case $But_check_4 ;Do something Case $But_check_5 ;Do something Case $But_check_All ControlClick($hGUI, "", "Button 1") ControlClick($hGUI, "", "Button 2") ControlClick($hGUI, "", "Button 3") ControlClick($hGUI, "", "Button 4") ControlClick($hGUI, "", "Button 5") EndSwitch WEnd Or in one line...
BitAND(ControlClick($hGUI, "", "Button 1"), ControlClick($hGUI, "", "Button 2"), ControlClick($hGUI, "", "Button 3"), ControlClick($hGUI, "", "Button 4"), ControlClick($hGUI, "", "Button 5"))
-
Werty's post in AutoIt3.exe ended.rc:-1073741819 with my Own Dll was marked as the answer
cdecl maybe?
-
Werty's post in Ternary line for GUI loop? was marked as the answer
yes, but you are aware of how many people actually reads the helpfile.
-
Werty's post in How to change the text for a tray icon was marked as the answer
TraySetToolTip("An example of a tray menu tooltip.")
-
Werty's post in Learning other languages was marked as the answer
I use TCC (Tiny C Compiler) together with autoit, it's very small and commandline no IDE, i dont know about sockets, but a quick glance at google shows there's plenty about websockets using C available.
TinyCC: https://bellard.org/tcc/
Example of usage with autoit...
-
Werty's post in post # - how to locate? was marked as the answer
The person refering to a post could rightclick the "Posted" time of the post and copy and paste the link to it. like if I rightclick jquinch's "Posted 33 minutes ago" and copy the link...
https://www.autoitscript.com/forum/topic/207407-post-how-to-locate/?do=findComment&comment=1495577
..it jumps to his post when clicked.
-
Werty's post in Comparing string to item in array was marked as the answer
ElseIf $c == "reboot" or "restart" Then That doesnt look right, should be something like...
ElseIf $c = "reboot" or $c = "restart" Then So all in all, untested obviously...
Func arun() $aFileList = _FileListToArray("C:\Users\333el\Dropbox\IFTTT", Default, Default, True) _PathSplit($aFileList[1], $a, $b, $c, $d) MsgBox($MB_SYSTEMMODAL, "Test", "Found: " & $c) If $c = "shutdown" Then FileDelete($aFileList[1]) MsgBox($MB_SYSTEMMODAL, "Test", "Shutdown") ;Shutdown(1) Exit ElseIf $c = "reboot" or $c = "restart" Then FileDelete($aFileList[1]) MsgBox($MB_SYSTEMMODAL, "Test", "Restart") ;Shutdown(2) Exit ElseIf $c = "Google" or $c = "Chrome" or $c = "Google Chrome" then FileDelete($aFileList[1]) ShellExecute("chrome.exe", "http://URL1 --new-window --start-fullscreen") Else FileDelete($aFileList[1]) aLoop() EndIf EndFunc == is for case sensitivity. use single =
-
Werty's post in ShellExecute "chrome.exe" was marked as the answer
Post a working URL without the variables, so we can see what it should look like.
-
Werty's post in New to AutoIT - Click specific button on Pulseway was marked as the answer
Pulseway can be installed silently, have you tried that?
https://forum.pulseway.com/topic/332-unattended-installation-for-msi/
-
Werty's post in Contact Sheet with AutoIt - Like Photoshop? was marked as the answer
Very easy using ImageMagick, takes as little as....
$img = ObjCreate("ImageMagickObject.MagickImage.1") $img.Montage(@ScriptDir & "\Temp\*.bmp","montage.bmp") ...that takes all bmp images in scriptdirtemp and makes a montage of it.
You can change size, crop, how many images you want in each row/column and much more.
Read up on it here...
http://www.imagemagick.org/Usage/montage/
-
Werty's post in Can ObjCreate be used with a program created in Autoit? was marked as the answer
It can be done by punching holes in the Gui like so...
#include "./Bin/au3Irrlicht2.au3" #include <Misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> $Gui = GUICreate("AutoIt Window", 800, 600, -1, -1) HotKeySet("{ESC}", "_exit") ;Embed Irrlicht RenderWindow--------------------------------------------------------------------------------------- _IrrStart($IRR_EDT_opengl, 1024, 768, $IRR_BITS_PER_PIXEL_32, $IRR_windowed, $IRR_SHADOWS, $IRR_capture_EVENTS, $IRR_VERTICAL_SYNC_Off) _IrrSetWindowCaption( "IrrLicht Window") Local $outer_rgn, $inner_rgn, $combined_rgn $outer_rgn = _WinAPI_CreateRectRgn(0, 0, 800, 600) $inner_rgn = _WinAPI_CreateRectRgn(103, 102, 200, 122) $combined_rgn = _WinAPI_CreateRectRgn(0, 0, 0, 0) _WinAPI_CombineRgn($combined_rgn, $outer_rgn, $inner_rgn, $RGN_DIFF) _WinAPI_DeleteObject($outer_rgn) _WinAPI_DeleteObject($inner_rgn) _WinAPI_SetWindowRgn(WinGetHandle("IrrLicht Window", ""), $combined_rgn) GUICtrlCreateButton("Hey", 100, 80, 100, 22) WinMove("IrrLicht Window", "", -3, -22) _WinAPI_Setparent(WinGetHandle("IrrLicht Window", ""), $Gui) WinActivate("AutoIt Window") GUISetState() ;-------------------------------------------------------------------------------------------------------------------- ;add your IrrLicht stuff here..... WHILE _IrrRunning() _IrrBeginScene(128,128,128) _IrrDrawScene() _IrrEndScene() Sleep(5) WEND Func _exit() _IrrStop() Exit EndFunc ; _exit