JustinMeyer
Active Members-
Posts
67 -
Joined
-
Last visited
Profile Information
-
Location
Houston Texas
JustinMeyer's Achievements
Wayfarer (2/7)
0
Reputation
-
I am planning on building a "How To - AutoIT & Phidgets" and am looking for direction on how to document it. Phidgets are "Products for USB Sensing and Control" that can be utilized with AutoIT. They allow physical interface, functions and events / input and output through COM in the case of AutoIT. Check out the Phidgets page for more information, and go to Trossen Robotics if you are going to buy (Cheaper and Faster). The image is a link to the video right after I was able to get AutoIT and the 1063 Bipolar stepper controllers talking. I am building a 3-Axis CNC mill. I Know AutoIT and Phidgets are not the ideal way to go when building a mill... its a learning experience. Quick piece together of code used in video above. #include <GUIConstantsEx.au3> GUICreate("PhidgetStepper Control Test",500,400)$Add_2C_B = GUICtrlCreateButton("Add to Current Position (+10000 1/16)", 5, 5, 490, 30) $Sub_FC_B = GUICtrlCreateButton("Subtract from Current Position (-10000 1/16)", 5, 40, 490, 30) $Output_E = GUICtrlCreateEdit("", 5, 335, 490, 60)GUISetState(@SW_SHOW) ;create the phidget object $oPhidget = ObjCreate("phidget21COM.PhidgetStepper");open the Phidget system $oPhidget.Open(130664) $oPhidget.WaitForAttachment(3000) If NOT $oPhidget.IsAttached Then MsgBox(0, "Error", "Phidget Device not attached") Exit EndIf ;register Phidget events $oPhidEvents = ObjEvent($oPhidget, "phid1_");Power Stepper Motor, index motor 0 $oPhidget.Engaged(0) = 1 ;set Stepper control values $oPhidget.CurrentLimit(0) = 00.70 $oPhidget.VelocityLimit(0) = 7000.00 $oPhidget.Acceleration(0) = 18100.00;set the current position $oPhidget.CurrentPosition(0) = 0 ;read current position to variable $Current_P = $oPhidget.CurrentPosition(0)GUICtrlSetData($Output_E, $Current_P) While 1 $msg = GUIGetMsg()Select Case $msg = $GUI_EVENT_CLOSE MsgBox(0,"Application Alert", "Application Closing") ExitLoopCase $msg = $Add_2C_B $Current_P = $oPhidget.CurrentPosition(0) $oPhidget.TargetPosition(0) = $Current_P +10000 GUICtrlSetData($Output_E, $Current_P) Case $msg = $Sub_FC_B $Current_P = $oPhidget.CurrentPosition(0) $oPhidget.TargetPosition(0) = $Current_P -10000 GUICtrlSetData($Output_E, $Current_P) EndSelect WEnd;power off stepper at index 0 $oPhidget.Engaged(0) = 0 ;close $oPhidget.Close();Phidget Event Handlers Func phid1_OnDetach($Index, $IRValue) MsgBox(0,"Error", "Phidget detached") Exit EndFunc Sorry its one blob, it keeps coming out like that. So where should I start a thread or threads, examples or questions, as it will be both and more. I have a few different Phidgets and will be progressing the capabilities and limitations with the help of the forum.
-
- AutoIT
- Automation
- (and 4 more)
-
Thanks for the example PsaltyDS! I have been wondering in the back of my head for sometime about how I could dynamically create controls, from lets say a data base and be able to "use" them without a handle. Thanks again!
-
Object - Converting C# to AU3
JustinMeyer replied to JustinMeyer's topic in AutoIt General Help and Support
I have been trying ways of getting this to work with no solution. I have been testing with different types of objects and have come to the conclusion that I am able to request information form the (Tekla) model and or have the user perform an action that returns information. I can not send any data to the model (Tekla Object) though. I would love to solve this. I am open to any suggestions or known issues. Thanks -
Object - Converting C# to AU3
JustinMeyer replied to JustinMeyer's topic in AutoIt General Help and Support
Thank you for clearing that up Manadar, and you are correct that $IntPnt.X, $IntPnt.Y and $IntPnt.Z are each double. -
Object - Converting C# to AU3
JustinMeyer replied to JustinMeyer's topic in AutoIt General Help and Support
I have, however by not defining the RGB it defaults to black. And that is not a problem. I am having problems passing the point ($IntPnt) XYZ back to tekla. I have no experience with C#, and this is the first for me with objects. I am thinking that autoit may handle the ?array? $IntPnt differently than Tekla expects. It is (sort of) an array, I think. $IntPnt.X $IntPnt.Y and $IntPnt.Z all hold vallues. -
Object - Converting C# to AU3
JustinMeyer replied to JustinMeyer's topic in AutoIt General Help and Support
Thanks, fixed. -
Thanks for looking, any insight or suggestions are greatly appreciated! I have been trying to find the solution for 3 days and can not get it... so now I ask the proffessionals. I am new to objects but have been using Tekla Structures (3D Structural modeling software) for years. With the code below I am able to connect to the process fine, and in other scripts can pull or return information from the model. The problem comes when I try to send information to Tekla. I will explain some of the results after the code. #Region $TSMm = ObjCreate("Tekla.Structures.Model.Model") $TSMgeoP = ObjCreate("Tekla.Structures.Geometry3d.Point") $TSMgeoP2 = ObjCreate("Tekla.Structures.Geometry3d.Point") $TSMuiGD = ObjCreate("Tekla.Structures.Model.UI.GraphicsDrawer") $TSMuiP = ObjCreate("Tekla.Structures.Model.UI.Picker") $TSMuiColor = ObjCreate("Tekla.Structures.Model.UI.Color") #EndRegion ;$oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ;The following line requests that you pick a point in the model ;The variable returns X ($IntPnt.X) Y and Z $IntPnt = $TSMuiP.PickPoint() $String = "X = " & $IntPnt.X & " " & "Y = " & $IntPnt.Y & " " & "Z = " & $IntPnt.Z $Color = $TSMuiColor();black ;This line should draw $String to the active model view at the picked point $TSMuiGD.DrawText($IntPnt, $String, $Color) Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription & @CRLF & _ "Source is: " & $oMyError.source & @CRLF & _ "Description is: " & $oMyError.description & @CRLF & _ "Helpfile is: " & $oMyError.helpfile & @CRLF & _ "Helpcontext is: " & $oMyError.helpcontext & @CRLF & _ "Lastdllerror is: " & $oMyError.lastdllerror & @CRLF & _ "Scriptline is: " & $oMyError.scriptline) $g_eventerror = 1 Endfunc I know the code is a big mess but I am just trying to get it working before I create anyhting I will share. When I have the object error handler commented out, I get this output in scite: Connecting to Tekla Structures process... Connection succeeded C:\Documents and Settings\jmeyer\Desktop\Tekla\Tekla Obj DrawText.au3 (18) : ==> The requested action with this object has failed.: $TSMuiGD.DrawText($IntPnt, $String, $Color) $TSMuiGD.DrawText($IntPnt, $String, $Color)^ ERROR >Exit code: 1 Time: 3.485 With the error handler on it returns 80070057 as the number and "The parameter is incorrect." for the Windescription This is the code in the tekla help file: public bool DrawText( Point Location, String Text, Color Color ); And an example of usage: drawer.DrawText(new Point(0.0, 1000.0, 1000.0), "TEXT SAMPLE", new Color(1.0, 0.5, 0.0)) The example below was done by someone that uses C#, and it works. IntPnt is the variable that returns from pick point. TSM.UI.Color Color = new TSM.UI.Color(); TSM.UI.GraphicsDrawer Drawer = new Tekla.Structures.Model.UI.GraphicsDrawer(); Drawer.DrawText(IntPnt, "Text Sample", Color); If you need more specific information to help me out just ask. Thanks again!
-
First things first.... you took a great piece of code and hacked it to death with one thing after another. We all have to learn sometime but, when doing so make one change at a time until you get the results you want. I do not have the patience or time to clean up your code, but I think I got the results you were looking for. Replace your code with this: ; Special thanks to GaryFrost for updating this to work with AutoIt v3.2.12.0! #NoTrayIcon #include <GDIPlus.au3>; this is where the magic happens, people #Include <WinAPI.au3> #include <GuiComboBox.au3> #include <File.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <ButtonConstants.au3> Opt("MustDeclareVars", 0) Global Const $AC_SRC_ALPHA = 1 ;~ Global Const $ULW_ALPHA = 2 Global $old_string = "", $runthis = "" Global $launchDir = @DesktopDir ; Load PNG file as GDI bitmap _GDIPlus_Startup() $pngSrc = @ScriptDir & "\LaunchySkin.png" $hImage = _GDIPlus_ImageLoadFromFile($pngSrc) $WIFIpngSrc = @ScriptDir & "\wifi.png" $WIFI_Image = _GDIPlus_ImageLoadFromFile($WIFIpngSrc) ; Extract image width and height from PNG $width = _GDIPlus_ImageGetWidth($hImage) $height = _GDIPlus_ImageGetHeight($hImage) ; Create layered window $GUI = GUICreate("lod3n launcher", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED) SetBitmap($GUI, $hImage, 255) ; Register notification messages GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() WinSetOnTop($GUI, "", 1) ; create child MDI gui window to hold controls ; this part could use some work - there is some flicker sometimes... $controlGui = GUICreate("ControlGUI", $width, $height, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($controlGui) ; child window transparency is required to accomplish the full effect, so $WS_EX_LAYERED above, and ; I think the way this works is the transparent window color is based on the image you set here: GUICtrlCreatePic(@ScriptDir & "\grey.gif", 0, 0, $width, $height) GUICtrlSetState(-1, $GUI_DISABLE) ; just a text label ;GUICtrlCreateLabel("Type the name of a file on your desktop and press Enter", 100, 186, 140, 50) $combo = GUICtrlCreateCombo("-> Choisir une clé USB", 100,10, 200,20) ;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ;GUICtrlSetColor(-1, 0xFFFFFF) ;---------------------------------------- HERE IS MY PROBLEM --------------------------------------------------------------- ;$hPic = GUICtrlCreatePic("", 10,10 , 256, 256) ;_GUICtrlStatic_SetPicture("wifi.png", $hPic) GUISetState() _GDIPlus_GraphicsDrawImageRectRect ($hGraphic, $WIFI_Image, 0,0,30,30,35,5,30,30) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete($controlGui) ; Release resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($WIFI_Image) _GDIPlus_Shutdown() ; ==================================================================================================== ; Handle the WM_NCHITTEST for the layered window so it can be dragged by clicking anywhere on the image. ; ==================================================================================================== Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION EndFunc ;==>WM_NCHITTEST ; ==================================================================================================== ; SetBitMap ; ==================================================================================================== Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap ; I don't like AutoIt's built in ShellExec. I'd rather do the DLL call myself. Func _ShellExecute($sCmd, $sArg = "", $sFolder = "", $rState = @SW_SHOWNORMAL) $aRet = DllCall("shell32.dll", "long", "ShellExecute", _ "hwnd", 0, _ "string", "", _ "string", $sCmd, _ "string", $sArg, _ "string", $sFolder, _ "int", $rState) If @error Then Return 0 $RetVal = $aRet[0] If $RetVal > 32 Then Return 1 Else Return 0 EndIf EndFunc ;==>_ShellExecute Func _GUICtrlStatic_SetPicture($File, $CtrlId) $hImage = _GDIPlus_ImageLoadFromFile($File) $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) GUICtrlSetImage($CtrlId, "") _SetBitmapToCtrl($CtrlId, $hBitmap2) EndFUnc Func _SetBitmapToCtrl($CtrlId, $hBitmap) Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local Const $SS_BITMAP = 0xE Local Const $GWL_STYLE = -16 Local $hWnd = GUICtrlGetHandle($CtrlId) If $hWnd = 0 Then Return SetError(1, 0, 0) ; set SS_BITMAP style to control Local $oldStyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE) If @error Then Return SetError(2, 0, 0) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "long", BitOR($oldStyle[0], $SS_BITMAP)) If @error Then Return SetError(3, 0, 0) Local $oldBmp = DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hWnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap) If @error Then Return SetError(4, 0, 0) If $oldBmp[0] <> 0 Then _WinAPI_DeleteObject($oldBmp[0]) Return 1 EndFunc And replace the "wifi.png" with the one below. EDIT: I removed any semi transparent channel from the png. It is either full opacity or completely transparent.
-
ClamWin also reported worm. fx-imagedemo.exe
-
I know this is supposed to be a place to post your "cool" scripts but I just found this on my flash drive and while it is not that cool, I would like to share it. It was one of my first scripts real (sorta) scripts that I shared with anyone to use. It is not finished, and I don't think I will finish it because, well it works for what I have needed it. Maybe if you brilliant people out there have any suggestions I will be inspired to finish it. You need to download the zip file because it contains all the graphics and a specific file hierarchy. ;JMEYER ;CLEAN UP CODE ;ADD SETTINGS #include <GuiConstants.au3> #include <GuiConstantsEX.au3> #Include <File.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> Global $COPIES = @ScriptDir & "\COPIES" ;Global $SPLASH_PIC = @ScriptDir & "\FILES\SPLASH(1).jpg" Global $COPY_ICO = @ScriptDir & "\FILES\COPY.ico" Global $COPY_FROM_ICO = @ScriptDir & "\FILES\CPY_FROM.ico" Global $COPY_TO_ICO = @ScriptDir & "\FILES\CPY_TO.ico" Global $COPY_ALERT_ICO = @ScriptDir & "\FILES\CPY_ALERT.ico" Global $COPY_SET_ICO = @ScriptDir & "\FILES\CPY_SET.ico" Global $CPY_SPL_1 = @ScriptDir & "\FILES\CPY_SPL_1.ico" Global $CPY_SPL_2 = @ScriptDir & "\FILES\CPY_SPL_2.ico" Global $SETTINGS = @ScriptDir & "\FILES\SETTINGS.INI" HotKeySet("{F1}", "Help") HotKeySet("{F2}", "Settings") $SPLASH_GUI = GUICreate("COPY v1.0", 320, 345, 25, 25) GUISetIcon ($COPY_ICO,"",$SPLASH_GUI) $SPLASH_CHECK = IniRead($SETTINGS,"SPLASH","IMAGE","1") If $SPLASH_CHECK = 1 Then $SPLASH_PIC = @ScriptDir & "\FILES\SPLASH(2).jpg" Else $SPLASH_PIC = @ScriptDir & "\FILES\SPLASH(1).jpg" EndIf GUICtrlCreatePic($SPLASH_PIC,0,0,320,345) GUICtrlSetState(-1,$GUI_DISABLE) GUISetState(@SW_SHOW,$SPLASH_GUI) $CPY_SETTINGS_GUI = GUICreate("COPY SETTINGS", 320, 345, 25, 25) GUISetIcon ($COPY_SET_ICO,"",$CPY_SETTINGS_GUI) GUISetState(@SW_HIDE,$CPY_SETTINGS_GUI) GUICtrlCreateLabel("SPLASH",2,2,50,20) GuiCtrlCreateGroup("IMAGE", 25, 20,260,40) ;START GROUP GUICtrlCreateIcon($CPY_SPL_1, "", 50, 35, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $SET_SPLASH_DARK = GUICtrlCreateRadio("DARK",70,35,50,20) GUICtrlSetState (-1,1) ;GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateIcon($CPY_SPL_2, "", 190, 35, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $SET_SPLASH_LIGHT = GUICtrlCreateRadio("LIGHT",210,35,70,20) ;GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group $SET_SPLASH_DEL = GUICtrlCreateCombo ("3", 30,80,30,20) ; create first item GUICtrlSetData(-1,"4|5|6|7|8|9","3") ; add other item snd set a new default GUICtrlCreateLabel("SECOND DELAY",70,83,90,20) $SET_SPLASH_OFF = GUICtrlCreateCheckbox("SPLASH OFF",190,80,100,20) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("COPY",2,115,50,20) GuiCtrlCreateGroup("COLOR", 25, 130,260,105) ;START GROUP $SET_COLOR_RGB = GUICtrlCreateRadio("RGB",60,150,50,20) GUICtrlSetState (-1,1) GUICtrlSetState(-1, $GUI_DISABLE) $SET_COLOR_R = GUICtrlCreateInput("0",130,150,30,20) GUICtrlSetLimit($SET_COLOR_R,2,2) GUICtrlSetState(-1, $GUI_DISABLE) $SET_COLOR_G = GUICtrlCreateInput("0",170,150,30,20) GUICtrlSetLimit($SET_COLOR_G,2,2) GUICtrlSetState(-1, $GUI_DISABLE) $SET_COLOR_B = GUICtrlCreateInput("0",210,150,30,20) GUICtrlSetLimit($SET_COLOR_B,2,2) GUICtrlSetState(-1, $GUI_DISABLE) $SET_COLOR_BLACK = GUICtrlCreateRadio("BLACK",60,180,55,20) GUICtrlSetState(-1, $GUI_DISABLE) $SET_COLOR_WHITE = GUICtrlCreateRadio("WHITE",130,180,55,20) GUICtrlSetState(-1, $GUI_DISABLE) $SET_COLOR_RED = GUICtrlCreateRadio("RED",200,180,50,20) GUICtrlSetState(-1, $GUI_DISABLE) $SET_COLOR_BLUE = GUICtrlCreateRadio("BLUE",60,200,55,20) GUICtrlSetState(-1, $GUI_DISABLE) $SET_COLOR_GREEN = GUICtrlCreateRadio("GREEN",130,200,55,20) GUICtrlSetState(-1, $GUI_DISABLE) $SET_COLOR_YELLOW = GUICtrlCreateRadio("YELLOW",200,200,65,20) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group GuiCtrlCreateGroup("WRITE MODE", 25, 240,260,40) $SET_WRITE_DEF = GUICtrlCreateRadio("DEFAULT",65,255,65,20) GUICtrlSetState(-1, $GUI_DISABLE) $SET_WRITE_RAW = GUICtrlCreateRadio("RAW",180,255,65,20) GUICtrlSetState (-1,1) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group $SET_APPLY = GUICtrlCreateButton("APPLY",75,320,60,20) $SET_SAVE = GUICtrlCreateButton("SAVE",140,320,60,20) $SET_SAVE_APPLY = GUICtrlCreateButton("SAVE - APPLY",205,320,100,20) ;$710 = GUICtrlRead($SET_WRITE_DEF) ;$711 = GUICtrlRead($SET_WRITE_RAW) ;MsgBox(1,"RADIO CHECK", "DEF = " & $710 & " RAW = " & $711) $RGB_R = IniRead($SETTINGS,"RGB","R","00") $RGB_G = IniRead($SETTINGS,"RGB","G","00") $RGB_B = IniRead($SETTINGS,"RGB","B","00") $CPY_GUI = GUICreate("COPY", 320, 345, 25, 25) GUISetBkColor(0x & $RGB_R & $RGB_G & $RGB_B,$CPY_GUI) GUISetIcon ($COPY_ICO,"",$CPY_GUI) GUISetState(@SW_HIDE,$CPY_GUI) $IN1_ICON = GUICtrlCreateIcon($COPY_FROM_ICO, "", 6, 6, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $IN_1 = GUICtrlCreateButton("",5,5,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $TXT_1 = GUICtrlCreateInput("",40,5,235,20) $OUT1_ICON = GUICtrlCreateIcon($COPY_TO_ICO, "", 296, 6, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $OUT_1 = GUICtrlCreateButton("",295,5,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $IN2_ICON = GUICtrlCreateIcon($COPY_FROM_ICO, "", 6, 36, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $IN_2 = GUICtrlCreateButton("",5,35,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $TXT_2 = GUICtrlCreateInput("",40,35,235,20) $OUT2_ICON = GUICtrlCreateIcon($COPY_TO_ICO, "", 296, 36, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $OUT_2 = GUICtrlCreateButton("",295,35,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $IN3_ICON = GUICtrlCreateIcon($COPY_FROM_ICO, "", 6, 66, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $IN_3 = GUICtrlCreateButton("",5,65,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $TXT_3 = GUICtrlCreateInput("",40,65,235,20) $OUT3_ICON = GUICtrlCreateIcon($COPY_TO_ICO, "", 296, 66, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $OUT_3 = GUICtrlCreateButton("",295,65,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $IN4_ICON = GUICtrlCreateIcon($COPY_FROM_ICO, "", 6, 96, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $IN_4 = GUICtrlCreateButton("",5,95,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $TXT_4 = GUICtrlCreateInput("",40,95,235,20) $OUT4_ICON = GUICtrlCreateIcon($COPY_TO_ICO, "", 296, 96, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $OUT_4 = GUICtrlCreateButton("",295,95,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $IN5_ICON = GUICtrlCreateIcon($COPY_FROM_ICO, "", 6, 126, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $IN_5 = GUICtrlCreateButton("",5,125,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $TXT_5 = GUICtrlCreateInput("",40,125,235,20) $OUT5_ICON = GUICtrlCreateIcon($COPY_TO_ICO, "", 296, 126, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $OUT_5 = GUICtrlCreateButton("",295,125,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $IN6_ICON = GUICtrlCreateIcon($COPY_FROM_ICO, "", 6, 156, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $IN_6 = GUICtrlCreateButton("",5,155,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $TXT_6 = GUICtrlCreateInput("",40,155,235,20) $OUT6_ICON = GUICtrlCreateIcon($COPY_TO_ICO, "", 296, 156, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $OUT_6 = GUICtrlCreateButton("",295,155,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $IN7_ICON = GUICtrlCreateIcon($COPY_FROM_ICO, "", 6, 186, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $IN_7 = GUICtrlCreateButton("",5,185,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $TXT_7 = GUICtrlCreateInput("",40,185,235,20) $OUT7_ICON = GUICtrlCreateIcon($COPY_TO_ICO, "", 296, 186, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $OUT_7 = GUICtrlCreateButton("",295,185,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $IN8_ICON = GUICtrlCreateIcon($COPY_FROM_ICO, "", 6, 216, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $IN_8 = GUICtrlCreateButton("",5,215,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $TXT_8 = GUICtrlCreateInput("",40,215,235,20) $OUT8_ICON = GUICtrlCreateIcon($COPY_TO_ICO, "", 296, 216, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $OUT_8 = GUICtrlCreateButton("",295,215,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $IN9_ICON = GUICtrlCreateIcon($COPY_FROM_ICO, "", 6, 246, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $IN_9 = GUICtrlCreateButton("",5,245,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $TXT_9 = GUICtrlCreateInput("",40,245,235,20) $OUT9_ICON = GUICtrlCreateIcon($COPY_TO_ICO, "", 296, 246, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $OUT_9 = GUICtrlCreateButton("",295,245,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $IN10_ICON = GUICtrlCreateIcon($COPY_FROM_ICO, "", 6, 276, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $IN_10 = GUICtrlCreateButton("",5,275,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $TXT_10 = GUICtrlCreateInput("",40,275,235,20) $OUT10_ICON = GUICtrlCreateIcon($COPY_TO_ICO, "", 296, 276, 16, 16) GUICtrlSetState(-1, $GUI_DISABLE) $OUT_10 = GUICtrlCreateButton("",295,275,20,20, BitOr($WS_CLIPSIBLINGS, $BS_BOTTOM, $BS_MULTILINE)) $LOAD = GUICtrlCreateButton("LOAD",42,310,80,20) $SAVE = GUICtrlCreateButton("SAVE",197,310,80,20) ;$HELP_LABEL = GUICtrlCreateLabel("Press F1 For Help", 120,325,110,20) $CPY_LOAD_GUI = GUICreate("LOAD", 320, 40, -1, -1) GUISetIcon ($COPY_ICO,"",$CPY_LOAD_GUI) $Combo = GuiCtrlCreateCombo("", 2, 5,250,20);COMBO SEARCH INPUT GUISetState(@SW_HIDE,$CPY_LOAD_GUI) $LOAD_F = GUICtrlCreateButton("LOAD FILE",254,5,65,20) $CPY_SAVE_GUI = GUICreate("SAVE", 320, 50, -1, -1) GUISetIcon ($COPY_ICO,"",$CPY_SAVE_GUI) $SAVE_AS = GUICtrlCreateInput("",2,5,250,20) ;GUICtrlSetFont(-1,8) $SAVE_F = GUICtrlCreateButton("SAVE FILE",254,5,65,20) $OVER_WRITE = GUICtrlCreateCheckbox("OVERWRITE",2,27,100,20) GUICtrlSetState($OVER_WRITE,$GUI_DISABLE) GUISetState(@SW_HIDE,$CPY_SAVE_GUI) $DELAY = IniRead($SETTINGS,"SPLASH","DELAY","3000") If $DELAY <= "3000" Then Sleep(3000) Else Sleep($DELAY) EndIf GUISetState(@SW_HIDE,$SPLASH_GUI) GUISetState(@SW_SHOW,$CPY_GUI) GUISwitch($CPY_GUI) While 1 $msg = GUIGetMsg(1) $1_O = GUICtrlRead($TXT_1) $2_O = GUICtrlRead($TXT_2) $3_O = GUICtrlRead($TXT_3) $4_O = GUICtrlRead($TXT_4) $5_O = GUICtrlRead($TXT_5) $6_O = GUICtrlRead($TXT_6) $7_O = GUICtrlRead($TXT_7) $8_O = GUICtrlRead($TXT_8) $9_O = GUICtrlRead($TXT_9) $10_O = GUICtrlRead($TXT_10) Select Case $msg[0] = $GUI_EVENT_CLOSE If $msg[1] = $CPY_GUI Then $CHECK_LINES = "0" If $1_O <> "" Then $CHECK_LINES = "1" ElseIf $2_O <> "" Then $CHECK_LINES = "1" ElseIf $3_O <> "" Then $CHECK_LINES = "1" ElseIf $4_O <> "" Then $CHECK_LINES = "1" ElseIf $5_O <> "" Then $CHECK_LINES = "1" ElseIf $6_O <> "" Then $CHECK_LINES = "1" ElseIf $7_O <> "" Then $CHECK_LINES = "1" ElseIf $8_O <> "" Then $CHECK_LINES = "1" ElseIf $9_O <> "" Then $CHECK_LINES = "1" ElseIf $10_O <> "" Then $CHECK_LINES = "1" EndIf If $CHECK_LINES = "0" Then Exit Else $EXIT = MsgBox(3,"NOTICE","DO YOU WANT TO SAVE BEFORE EXITING?") ;GUISetIcon ($COPY_ALERT_ICO,"",$EXIT) IF $EXIT = "6" Then GUISetState(@SW_SHOW,$CPY_SAVE_GUI) ;ADD FUNCTION TO EXIT AFTER SAVE ;Exit ElseIf $EXIT = "7" Then Exit Else ; EndIf EndIf ElseIf $msg[1] = $CPY_LOAD_GUI Then GUISetState(@SW_HIDE,$CPY_LOAD_GUI) WinActivate("COPY") ElseIf $msg[1] = $CPY_SAVE_GUI Then GUISetState(@SW_HIDE,$CPY_SAVE_GUI) WinActivate("COPY") ElseIf $msg[1] = $CPY_SETTINGS_GUI Then GUISetState(@SW_HIDE,$CPY_SETTINGS_GUI) WinActivate("COPY") EndIf Case $msg[0] = $LOAD GUICtrlSetData($Combo,"") $aFileList=_FileListToArray($COPIES) _ArraySort($aFileList,0,1) $FileList = _ArrayToString ( $aFileList, "|", 1) GUICtrlSetData($Combo,$FileList) GUISetState(@SW_SHOW,$CPY_LOAD_GUI) Case $msg[0] = $LOAD_F $READ_FILE = GUICtrlRead($COMBO) If $READ_FILE <> "" Then If FileExists($COPIES & "\" & $READ_FILE) Then $READ_L_1 = FileReadLine($COPIES & "\" & $READ_FILE,1) $READ_L_2 = FileReadLine($COPIES & "\" & $READ_FILE,2) $READ_L_3 = FileReadLine($COPIES & "\" & $READ_FILE,3) $READ_L_4 = FileReadLine($COPIES & "\" & $READ_FILE,4) $READ_L_5 = FileReadLine($COPIES & "\" & $READ_FILE,5) $READ_L_6 = FileReadLine($COPIES & "\" & $READ_FILE,6) $READ_L_7 = FileReadLine($COPIES & "\" & $READ_FILE,7) $READ_L_8 = FileReadLine($COPIES & "\" & $READ_FILE,8) $READ_L_9 = FileReadLine($COPIES & "\" & $READ_FILE,9) $READ_L_10 = FileReadLine($COPIES & "\" & $READ_FILE,10) GUICtrlSetData($TXT_1,$READ_L_1) GUICtrlSetData($TXT_2,$READ_L_2) GUICtrlSetData($TXT_3,$READ_L_3) GUICtrlSetData($TXT_4,$READ_L_4) GUICtrlSetData($TXT_5,$READ_L_5) GUICtrlSetData($TXT_6,$READ_L_6) GUICtrlSetData($TXT_7,$READ_L_7) GUICtrlSetData($TXT_8,$READ_L_8) GUICtrlSetData($TXT_9,$READ_L_9) GUICtrlSetData($TXT_10,$READ_L_10) GUISetState(@SW_HIDE,$CPY_LOAD_GUI) Else MsgBox(1,"ERROR","FILE DOES NOT EXIST") ;GUISetIcon ($COPY_ALERT_ICO,"",-1) EndIf Else MsgBox(1,"ERROR","YOU MUST SELECT OR ENTER A FILE") ;GUISetIcon ($COPY_ALERT_ICO,"",-1) EndIf Case $msg[0] = $SAVE $CHECK_LINES = "0" If $1_O <> "" Then $CHECK_LINES = "1" ElseIf $2_O <> "" Then $CHECK_LINES = "1" ElseIf $3_O <> "" Then $CHECK_LINES = "1" ElseIf $4_O <> "" Then $CHECK_LINES = "1" ElseIf $5_O <> "" Then $CHECK_LINES = "1" ElseIf $6_O <> "" Then $CHECK_LINES = "1" ElseIf $7_O <> "" Then $CHECK_LINES = "1" ElseIf $8_O <> "" Then $CHECK_LINES = "1" ElseIf $9_O <> "" Then $CHECK_LINES = "1" ElseIf $10_O <> "" Then $CHECK_LINES = "1" EndIf If $CHECK_LINES = "0" Then MsgBox(1,"ERROR", "THERE IS NO INFORMATION TO SAVE TO FILE") ;GUISetIcon ($COPY_ALERT_ICO,"",-1) Else GUISetState(@SW_SHOW,$CPY_SAVE_GUI) EndIf Case $msg[0] = $SAVE_F $SAVE_AS_F = GUICtrlRead($SAVE_AS) If FileExists($COPIES & "\" & $SAVE_AS_F) Then MsgBox(1,"ERROR", "FILE ALREADY EXISTS") ;GUISetIcon ($COPY_ALERT_ICO,"",-1) Else If $SAVE_AS_F <> "" Then FileCopy("FILES\0000","TEMP0") FileMove("TEMP0\0000",$COPIES & "\" & $SAVE_AS_F) $WRITE_FILE = FileOpen($COPIES & "\" & $SAVE_AS_F, 1) FileWriteLine($WRITE_FILE, $1_O) FileWriteLine($WRITE_FILE, $2_O) FileWriteLine($WRITE_FILE, $3_O) FileWriteLine($WRITE_FILE, $4_O) FileWriteLine($WRITE_FILE, $5_O) FileWriteLine($WRITE_FILE, $6_O) FileWriteLine($WRITE_FILE, $7_O) FileWriteLine($WRITE_FILE, $8_O) FileWriteLine($WRITE_FILE, $9_O) FileWriteLine($WRITE_FILE, $10_O) FileClose($WRITE_FILE) GUISetState(@SW_HIDE,$CPY_SAVE_GUI) Else MsgBox(1,"ERROR", "YOU MUST NAME THE NEW FILE") ;GUISetIcon ($COPY_ALERT_ICO,"",-1) EndIf EndIf Case $msg[0] = $IN_1 $CLIP = ClipGet() GUICtrlSetData($TXT_1,$CLIP) Case $msg[0] = $IN_2 $CLIP = ClipGet() GUICtrlSetData($TXT_2,$CLIP) Case $msg[0] = $IN_3 $CLIP = ClipGet() GUICtrlSetData($TXT_3,$CLIP) Case $msg[0] = $IN_4 $CLIP = ClipGet() GUICtrlSetData($TXT_4,$CLIP) Case $msg[0] = $IN_5 $CLIP = ClipGet() GUICtrlSetData($TXT_5,$CLIP) Case $msg[0] = $IN_6 $CLIP = ClipGet() GUICtrlSetData($TXT_6,$CLIP) Case $msg[0] = $IN_7 $CLIP = ClipGet() GUICtrlSetData($TXT_7,$CLIP) Case $msg[0] = $IN_8 $CLIP = ClipGet() GUICtrlSetData($TXT_8,$CLIP) Case $msg[0] = $IN_9 $CLIP = ClipGet() GUICtrlSetData($TXT_9,$CLIP) Case $msg[0] = $IN_10 $CLIP = ClipGet() GUICtrlSetData($TXT_10,$CLIP) Case $msg[0] = $OUT_1 ClipPut($1_O) Case $msg[0] = $OUT_2 ClipPut($2_O) Case $msg[0] = $OUT_3 ClipPut($3_O) Case $msg[0] = $OUT_4 ClipPut($4_O) Case $msg[0] = $OUT_5 ClipPut($5_O) Case $msg[0] = $OUT_6 ClipPut($6_O) Case $msg[0] = $OUT_7 ClipPut($7_O) Case $msg[0] = $OUT_8 ClipPut($8_O) Case $msg[0] = $OUT_9 ClipPut($9_O) Case $msg[0] = $OUT_10 ClipPut($10_O) Case $msg[0] = $SET_APPLY $RGB_R = GUICtrlRead($SET_COLOR_R) $RGB_G = GUICtrlRead($SET_COLOR_G) $RGB_B = GUICtrlRead($SET_COLOR_B) GUISetBkColor(0x & $RGB_R & $RGB_G & $RGB_B,$CPY_GUI) Case $msg[0] = $SET_SAVE $SPLASH_IMAGE_DARK = GUICtrlRead($SET_SPLASH_DARK) $SPLASH_IMAGE_LIGHT = GUICtrlRead($SET_SPLASH_LIGHT) $SPLASH_DELAY = GUICtrlRead($SET_SPLASH_DEL) $RGB_R = GUICtrlRead($SET_COLOR_R) $RGB_G = GUICtrlRead($SET_COLOR_G) $RGB_B = GUICtrlRead($SET_COLOR_B) ;IniWrite($SETTINGS,"SPLASH","DELAY",$SPLASH_DELAY & "000") IniWrite($SETTINGS,"SPLASH","IMAGE",$SPLASH_IMAGE_DARK) IniWrite($SETTINGS,"SPLASH","IMAGE",$SPLASH_IMAGE_LIGHT) IniWrite($SETTINGS,"SPLASH","DELAY",$SPLASH_DELAY & "000") IniWrite($SETTINGS,"RGB","R",$RGB_R) IniWrite($SETTINGS,"RGB","G",$RGB_G) IniWrite($SETTINGS,"RGB","B",$RGB_B) GUISetState(@SW_HIDE,$CPY_SETTINGS_GUI) Case $msg[0] = $SET_SAVE_APPLY $SPLASH_DELAY = GUICtrlRead($SET_SPLASH_DEL) $RGB_R = GUICtrlRead($SET_COLOR_R) $RGB_G = GUICtrlRead($SET_COLOR_G) $RGB_B = GUICtrlRead($SET_COLOR_B) GUISetBkColor(0x & $RGB_R & $RGB_G & $RGB_B,$CPY_GUI) ;MsgBox(1,"TEST","DELAY = " & $SPLASH_DELAY) IniWrite($SETTINGS,"SPLASH","DELAY",$SPLASH_DELAY & "000") IniWrite($SETTINGS,"RGB","R",$RGB_R) IniWrite($SETTINGS,"RGB","G",$RGB_G) IniWrite($SETTINGS,"RGB","B",$RGB_B) GUISetState(@SW_HIDE,$CPY_SETTINGS_GUI) EndSelect WEnd Func Help() $HELP_F = "FILES\Help.html" If FileExists($HELP_F) Then Run(@ComSpec & " /c Start " & $HELP_F, "", @SW_HIDE) Else MsgBox(0,"ERROR", "HELP FILE CORRUPT OR MISSING" & @CRLF & "GO TO WWW.-.COM") ;GUISetIcon ($COPY_ALERT_ICO,"",-1) WinActivate("COPY") EndIf EndFunc Func Settings() GUISetState(@SW_SHOW,$CPY_SETTINGS_GUI) EndFunc A few things to note: The button on the left of the input will set the input to whatever is on the clipboard The button to the right of the input will copy whatever is in the input to the clipboard F1 launches the html help file in your default browser F2 launches (unfinished) settings You can save and load for future use I know that there are a million free apps out there that do this far better than what I have done here but it was fun to write and I posted it here because I think there are some useful examples. Please take it and do what you will with it, fix it break it, whatever you want. COPY.zip
-
You can set the state of a button to "$BS_DEFPUSHBUTTON", this will cause the same action as pressing the button would but by pressing enter. But I would think just setting the the enter key to run a function would better serve your situation.
-
There is probably a far better way but.... what if you set "enter" as a hot key to run a function that contains an "if" statement. I would think you could use "ControlGetFocus" to find out what step you are at and take the appropriate action, set focus to control or run function.
-
WinMove and GUIcreate question
JustinMeyer replied to zFrank's topic in AutoIt General Help and Support
1 Not sure how to make the GUI non movable, could try making a gui and disable it then put your controls on a child gui. 2 To move a window to the center I have used "WinGetPos" to get the width and height and subtract them from @desktopwidth and @desktopheight and divide by 2 3 and to create a GUI in the center use -1 for the X and Y positions -
I like it with the countdown timer, tells me exactly how much time I have left to meet my deadline. Cool script, thanks CHronologist!
-
Need help with PixelGetColor within a window
JustinMeyer replied to Shifthappens's topic in AutoIt General Help and Support
I have read your post a few times and can say that I am still not sure what your problem is.... either it is not very clear or I am really tired. I think you may want to look at @desktopwidth and @desktopheight in the help file.