Search the Community
Showing results for tags 'example'.
-
There seems to be many bad forum posts and confusion on the simple action of toggling pause and play. Here is two examples of playing and pausing shortcuts. I'm sure there may be multiple ways to do this. Or there maybe more efficient ways but this was the simple way I do it Example one: Two shortcuts that toggle Pause and Play HotKeySet("{insert}","_Pause");press insert to make $pause variable = 1 and resume actions HotKeySet("{esc}","_Play");press esc to make $pause variable = 0 $pause=1; sets varriable to 1 starting actiions in loop While 1; Loop every 500 mill seconds and check varriables Sleep(500); check variable every 500 seconds if $pause=1 Then; if $pause variable = 1 then do actions ;Do actions EndIf WEnd func _Play() $pause=0 EndFunc func _Pause() $pause=1 EndFunc Example Two: One shortcut that toggle Pause and Play HotKeySet("{insert}","_Pause");press insert to make $pause press insert again to resume $pause=1; sets varriable to 1 starting actiions in loop While 1; Loop every 500 mill seconds and check varriables Sleep(500); check variable every 500 seconds if $pause=1 Then; if $pause variable = 1 then do actions ;Do actions while $pause = 1 EndIf WEnd func _Pause() if $pause=0 then $pause=1 else $pause=0 endif EndFunc
- 2 replies
-
- pause and play
- toggle
-
(and 1 more)
Tagged with:
-
This may or may not be useful and comes in play if you are not using a UDF or the built-in methods or 3rd party code for creating menus and layouts. I wrote this with the assumption the reader is new to the language and doesn't have a lot of experience yet. Possible Reasons 1: You are writing Gui elements yourself from scratch. Why? because you just desire to. 2: Need for something to work a specific way that the built-in methods do not allow for. 3: You just want a learning exercise. I was trying to figure out how to recreate the separators you see in tray menus with that same style inside a GUI using Label Controls. You know those single lines that separate menu items when you use TrayCreateItem("") ; Create a separator line. See Attached Image Either there is no single GUI control to allow for the exact styling of separator lines seen in the Tray Menu OR I haven't discovered it yet. My solution: The color codes in RGB HEX 0xD5DFE5 ;~ A light blue grey color 0xFFFFFF ;~ Color white When you insert your Label Control leave the "text" part empty and do not use any option flags. Some of the Style and Ex Style options prevent coloring and sizing the control. GUICtrlCreateLabel("", LEFT, TOP, WIDTH, HEIGHT) You need TWO controls and TWO background color settings Horizontal Separator - White Color goes on bottom GUICtrlCreateLabel("", LEFT, TOP, WIDTH, HEIGHT) ;~ Empty Label Control GUICtrlSetBKColor(-1, 0xD5DFE5) ;~ Background Color Setting for previous Label Control GUICtrlCreateLabel("", LEFT, TOP + 1, WIDTH, HEIGHT) ;~ Second Label Control needs to be distanced one away from previous Label Control GUICtrlSetBKColor(-1, 0xFFFFFF) Vertical Separator - White Color is on INSIDE or to the Right of the grey line GUICtrlCreateLabel("", LEFT, TOP, HEIGHT, WIDTH) ;~ Reverse Width and Height GUICtrlSetBKColor(-1, 0xD5DFE5) GUICtrlCreateLabel("", LEFT + 1, TOP, HEIGHT, WIDTH) ;~ Add ONE to the LEFT not the TOP GUICtrlSetBKColor(-1, 0xFFFFFF) This will MATCH the Tray Menu separators in color and look.
-
There has been many questions about using tesseract of late. Here is a very basic example which works for me, along with the exact version of standalone tesseract executable and English language data used I found it some time ago at a time I thought I needed it, I do not recall from where. $ImageToReadPath = @ScriptDir & "\image.bmp" $ResultTextPath = @ScriptDir & "\Result" $OutPutPath = $ResultTextPath & ".txt" $TesseractExePath = @ScriptDir & "\Tesseract.exe" ShellExecuteWait($TesseractExePath, '"' & $ImageToReadPath & '" "' & $ResultTextPath & '"', "", "", @SW_HIDE) If @error Then Exit MsgBox(0, "Error", @error) EndIf MsgBox(0, "Result", FileRead($OutPutPath)) FileDelete($OutPutPath)Some Answers: The files contained in the download, only support English language. From the only documentation I got with this version... Original Binaries and Source can be found here: http://code.google.com/p/tesseract-ocr/I do not know where to get other languages support. I do not know if there is a later standalone version. I do not know why it does not read your image accurately. It does not have a virus in it. You can search the forums or internet to learn how to create / cut / copy / paste, or otherwise manipulate your own images. TesseractExample.zip
-
Hi. When I click 'open this script' in AutoIt Help the example isn't opening. I tried this (FixHelpFileExamples.au3): https://www.autoitscript.com/forum/topic/68828-opening-an-example-inside-autoitchm-in-scite/?do=findComment&comment=506522 All is set. But 'open this script' not working. I tried that (batchfile): https://www.autoitscript.com/forum/topic/188272-resolved-random-failure-of-help-to-open-examples/ This isn't working too. What I wonder if my mouse is over 'Copy to clipboard' my cursor is changing to a hand, showing there is a link. If I do the same over 'Open this Script' then mouse is showing the hand for very short time and then getting back to show the arrow. So if I move slowly the cursor over this link it's 'blinking' hand and arrow. What could this be? Regards, Conrad
-
Several questions around the forum get asked repeatedly: How to avoid false-positive Anti-Virus detection? Answered by AutoIt god himself How to make AutoIt software safe from hacking? How to prevent AutoIt software being de-compiled? How to prevent exposure of native AutoIt code? The general answers all go in the direction of (a) can't be done or (b) make it an .a3x script. The Wiki contains a single entry under "compiler directives" and the Help File contains mainly compiler info, with this note Also see this thread. So I thought I would make a little demo to actually show how it works. Here are the 2 scripts. The a3x_demo.zip file contains these 2, plus the compiled .a3x file and the .EXE The body #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_type=a3x #AutoIt3Wrapper_Outfile=a3x_demo.a3x #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: Skysnake Script Function: Demonstates working of a3x Instructions Code as normal Set Compiler option to .a3x as per Help File Compile Note output is (a) .a3x file, (b) now compile wrapper to make .exe file The compiled .a3x is included inside the .exe. To demonstrate, copy .exe to any new location and run. :) #ce ---------------------------------------------------------------------------- ; Script Start #include <MsgBoxConstants.au3> MsgBox($MB_SYSTEMMODAL, "a3x demo", "This message box is called from an a3x pre-compiled script " & @CRLF & "will timeout after 10 seconds or select the OK button.", 10) ; code ends The wrapper #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=a3x_wrapper.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: Skysnake Script Function: Wrapper for .a3x demo the INCLUDE line below forces the .a3x to be included in the new .EXE other option is to use FileIsntall and then run the a3x_demo.a3x as an external file NOTE: required in order are the following steps 1. body .au3 script 2. compile body .au3 as .a3x file, include in wrapper 3. wrapper .au3 script, to become the .exe -> compile as .EXE #ce ---------------------------------------------------------------------------- ; Script Start - #include "a3x_demo.a3x" ; code ends DOWNLOAD: The ax3_demo.zip file EDIT: 2016.07.08 Fixed typos
-
Hi everyone, Perhaps, if you have a spare moment, you might like to take a look at >Wiki Examples Challenge Part 2 in the Developer Chat section, and do AutoIt and the contestants a favor, by examining the six Examples and casting a vote for one of them. That would be really appreciated. P.S. Jos, ETC, Melba23 - I hope you don't mind me posting this here and in General Help as well?
-
Hi peeps, are you able to please help me out with reducing/eliminating the flicker when the GUI is being resized? The example is attached. Reason for zip is that I'm using a couple of UDFs (namely: Ribbon bar and ModernMenuRaw so I've included them in the attached archive). Source here: #Region ### includes ### #include-once #NoTrayIcon #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=n #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Ribbonsbar.au3> #include <GuiListView.au3> #include <EditConstants.au3> #EndRegion ### includes ### Opt("GUIResizeMode", 802) Global $appname = 'Example App', $appver = '1.0', $additemsgui_W = 400, $additemsgui_H = 150 #Region ### $maingui ### $maingui = GUICreate($appname & ' ' & $appver, @DesktopWidth, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) $hBar = _RibbonsBar_Create($maingui, 0, 0, 0, 0, 'blue') $hTab_Home = _RibbonsBar_Create_Tab($hBar, 'Home') $hItem_FileOps = _RibbonsBar_Create_TabItem($hTab_Home, 'File operations' , 225 ) $hGrandButton_New = _RibbonsBar_Create_GrandButton($hItem_FileOps,'',412,'New',52, True ) _RibbonsBar_GrandButtons_Enable($hGrandButton_New, 0) $hDropDownNew = _RibbonsBar_Create_ContextMenu($hGrandButton_New) $hDropDownNew_1 = _GUICtrlCreateODMenuItem("Standard ...", $hDropDownNew, "smallIcons.dll", 261) $hDropDownNew_2 = _GUICtrlCreateODMenuItem("Manual ...", $hDropDownNew, "smallIcons.dll", 382) $hGrandButton_Open = _RibbonsBar_Create_GrandButton($hItem_FileOps,'',453,'Open',52, False ) _RibbonsBar_GrandButtons_Enable($hGrandButton_Open, 0) $hGrandButton_Save = _RibbonsBar_Create_GrandButton($hItem_FileOps,'',514,'Save',52, True ) _RibbonsBar_GrandButtons_Enable($hGrandButton_Save, 0) $hDropDownSave = _RibbonsBar_Create_ContextMenu($hGrandButton_Save) $hDropDownSave_1 = _GUICtrlCreateODMenuItem("Save", $hDropDownSave, "smallIcons.dll", 287) $hDropDownSave_2 = _GUICtrlCreateODMenuItem("Save As ...", $hDropDownSave, "smallIcons.dll", 286) $hGrandButton_Export = _RibbonsBar_Create_GrandButton($hItem_FileOps,'',337,'Export',62, True ) _RibbonsBar_GrandButtons_Enable($hGrandButton_Export, 0) $hDropDownExport = _RibbonsBar_Create_ContextMenu($hGrandButton_Export) $hDropDownExport_1 = _GUICtrlCreateODMenuItem("To Excel", $hDropDownExport, "smallIcons.dll", 1243) $hItem_ItemOps = _RibbonsBar_Create_TabItem ( $hTab_Home, 'Item operations' , 393 ) $hGrandButton_AddItems = _RibbonsBar_Create_GrandButton($hItem_ItemOps,'',301,'Add item(s)',72, True ) $hDropDownAddItems = _RibbonsBar_Create_ContextMenu($hGrandButton_AddItems) _RibbonsBar_GrandButtons_Enable($hGrandButton_AddItems, 0) $hDropDownAddItems_1 = _GUICtrlCreateODMenuItem("From Catalogue", $hDropDownAddItems, "smallIcons.dll", 173) $hDropDownAddItems_2 = _GUICtrlCreateODMenuItem("From Quote", $hDropDownAddItems, "smallIcons.dll", 143) $hDropDownAddItems_3 = _GUICtrlCreateODMenuItem("Paste", $hDropDownAddItems, "smallIcons.dll", 9) $hGrandButton_DelItems = _RibbonsBar_Create_GrandButton($hItem_ItemOps,'',615,'Delete item(s)',82, False ) _RibbonsBar_GrandButtons_Enable($hGrandButton_DelItems, 0) $SmallButton_Undo = _RibbonsBar_Create_SmallButton($hItem_ItemOps,'',728,1,'Undo (Test: click to enable grand buttons)',230) $SmallButton_Redo = _RibbonsBar_Create_SmallButton($hItem_ItemOps,'',194,2,'Redo (Test: click to disable grand buttons)',230) _RibbonsBar_SmallButtons_Enable($SmallButton_Redo, 0) $hTab_Help = _RibbonsBar_Create_Tab( $hBar, 'Help' ) $hItem_Information = _RibbonsBar_Create_TabItem ( $hTab_Help, 'Information' , 120 ) $hGrandButton_About = _RibbonsBar_Create_GrandButton($hItem_Information,'',631,'Help','',False) $hGrandButton_About = _RibbonsBar_Create_GrandButton($hItem_Information,'',644,'About','',False) _RibbonsBar_Tab_SetState($hTab_Home) GUISwitch($maingui) WinMove($maingui, "", Default, Default, 800, Default) $wPos = WinGetPos($maingui) WinMove($maingui, "", @DesktopWidth/2 - $wPos[2]/2, @DesktopHeight/2 - $wPos[3]/2, Default, Default) $wPos = WinGetPos($maingui) $mainlistview = GUICtrlCreateListView('Col 1|Col 2|Col 3|Col 4|Col 5|Col 6', -2, 120, _ $wPos[2], $wPos[3], Default) _GUICtrlListView_SetExtendedListViewStyle($mainlistview, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES, $LVS_EX_SUBITEMIMAGES, $LVS_EX_FLATSB)) _GUICtrlListView_SetColumnWidth($mainlistview, 0, 120) _GUICtrlListView_SetColumnWidth($mainlistview, 1, 250) _GUICtrlListView_SetColumnWidth($mainlistview, 2, 50) _GUICtrlListView_SetColumnWidth($mainlistview, 3, 100) _GUICtrlListView_SetColumnWidth($mainlistview, 4, 100) _GUICtrlListView_SetColumnWidth($mainlistview, 5, 50) #EndRegion ### $additemsgui ### #Region ### $additemsgui ### $additemsgui = GUICreate('Add item(s) from Catalogue', $additemsgui_W, $additemsgui_H, 0, 0, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX), $WS_EX_MDICHILD, $maingui) GUISetBkColor(0xf2f8ff) GUISetFont(10, 400) $additems_addlabel = GUICtrlCreateLabel('Start typing below to add item(s) from catalogue (min 2 chars):', 10, 15, $additemsgui_W - 20, 21) $additemsinput = GUICtrlCreateInput('', 10, 45, $additemsgui_W - 20, Default) GUICtrlSendMsg(-1, $EM_SETCUEBANNER, False, 'Enter an item number here') $additemsbn_add = GUICtrlCreateButton('Add', 10, 85, 110, 40) #EndRegion ### $additemsgui ### GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") ; Register WM_GETMINMAXINFO GUISetState(@SW_SHOW, $maingui) GUICtrlSetResizing($mainlistview, BitOR($GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKTOP)) While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $maingui Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $hDropDownAddItems_1 GUISetState(@SW_DISABLE, $maingui) $mPos = WinGetPos($maingui) WinMove($additemsgui, '', $mPos[0] + (($mPos[2]/2) - ($additemsgui_W/2)), $mPos[1] + (($mPos[3]/2) - ($additemsgui_H/2))) GUICtrlSetData($additemsinput, '') GUISetState(@SW_SHOW, $additemsgui) _WinAPI_SetFocus(ControlGetHandle('', '', $additems_addlabel)) Case $hDropDownNew_1 ConsoleWrite('Clicked "New" menu item 1'&@CRLF) Case $hDropDownNew_2 ConsoleWrite('Clicked "New" menu item 2'&@CRLF) EndSwitch Case $additemsgui Switch $msg[0] Case $GUI_EVENT_CLOSE GUISetState(@SW_ENABLE, $maingui) GUISetState(@SW_HIDE, $additemsgui) EndSwitch EndSwitch Switch _RibbonsBar_GetMsg() Case $hGrandButton_Open ConsoleWrite('open...'&@CRLF) Case $SmallButton_Undo _RibbonsBar_GrandButtons_Enable($hGrandButton_New, 1) _RibbonsBar_GrandButtons_Enable($hGrandButton_Save, 1) _RibbonsBar_GrandButtons_Enable($hGrandButton_Export, 1) _RibbonsBar_GrandButtons_Enable($hGrandButton_AddItems, 1) _RibbonsBar_GrandButtons_Enable($hGrandButton_DelItems, 1) _RibbonsBar_GrandButtons_Enable($hGrandButton_Open, 1) If _RibbonsBar_SmallButtons_GetState($SmallButton_Undo) = 1 Then ConsoleWrite('undo...'&@CRLF) EndIf Case $SmallButton_Redo _RibbonsBar_GrandButtons_Enable($hGrandButton_New, 0) _RibbonsBar_GrandButtons_Enable($hGrandButton_Save, 0) _RibbonsBar_GrandButtons_Enable($hGrandButton_Export, 0) _RibbonsBar_GrandButtons_Enable($hGrandButton_AddItems, 0) _RibbonsBar_GrandButtons_Enable($hGrandButton_DelItems, 0) _RibbonsBar_GrandButtons_Enable($hGrandButton_Open, 0) If _RibbonsBar_SmallButtons_GetState($SmallButton_Redo) = 1 Then ConsoleWrite('redo...'&@CRLF) EndIf Case $hTab_Home _RibbonsBar_Tab_SetState($hTab_Home) Case $hGrandButton_Export _RibbonsBar_ContextMenu_SetState($hDropDownExport) Case $hGrandButton_Save _RibbonsBar_ContextMenu_SetState($hDropDownSave) Case $hGrandButton_AddItems _RibbonsBar_ContextMenu_SetState($hDropDownAddItems) Case $hGrandButton_New _RibbonsBar_ContextMenu_SetState($hDropDownNew) Case $hTab_Help _RibbonsBar_Tab_SetState($hTab_Help) EndSwitch WEnd Func WM_GETMINMAXINFO($hwnd, $Msg, $wParam, $lParam) If $hWnd = $maingui Then $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($tagMaxinfo, 7, 800) ; W (min size) DllStructSetData($tagMaxinfo, 8, 600) ; H (min size) Return 0 EndIf EndFunc ;==>WM_GETMINMAXINFO Thanks heaps in advance! example.zip
-
AutoIt is very useful and easy to use even for non-programmers (like me). Most of the examples in the Example section of the forum are somewhat advanced and not suitable for non-programmers who want to learn how to do simple things with AutoIt. I've attached a few simple scripts with lots of comments to help beginners. For more help on any function, press F1 when your curser is on the desired function name. Example01_MouseSwitchButtons.au3 Example02_HelloWorld.au3 Example03_CopyPasteNotepadToWord.au3 Example04_CopyPasteNotepadToWord_2.au3 Example05_OpenLinkInIE.au3 Additional simple AutoIt examples can be downloaded from here: '?do=embed' frameborder='0' data-embedContent>> P.S. Can somebody pin this topic?