-
Posts
76 -
Joined
-
Last visited
Profile Information
-
Location
Washington
-
WWW
http://www.trystiansky.com/
Trystian's Achievements
Wayfarer (2/7)
1
Reputation
-
Schneeflocke reacted to a post in a topic:
PixelSearch Multi - (Moved)
-
PixelSearch Multi - (Moved)
Trystian replied to Schneeflocke's topic in AutoIt General Help and Support
Hey Snowflake and everyone else, I don't know if this will work, being that PixelSearch refuses to work for me. My implementation must be off (perhaps someone more qualified can point out my mistake). Here's the code I threw together. It may give you a starting point. HotKeySet ("{ENTER}", "Start") HotKeySet ("{ESC}", "_Exit") Global $iStartX = 0 Global $iStartY = 0 Global $iEndX = @DesktopWidth Global $iEndY = @DesktopHeight ; Make sure the following arrays have the same amount of elements Global $aKeyColor = [0x0000FF,0xFF0000,0xFFA500] ; Colors to check for: Green,Red,Orange (in hexadecimal) Global $aKeyPress = ["#","#","#"] ; Keys to Press Global $aKeyRepeat = [10,4,12] ; How many times to repeat Key Presses Global $iMatch = UBound($aKeyColor) If ($iMatch = UBound($aKeyPress) And $iMatch = UBound($aKeyRepeat)) Then ; Make sure all Key arrays match element counts While 1 Sleep(50) ;Sleep Loop WEnd Else MsgBox(16,"PixelTest","Key Arrays don't have same amount of elements!") EndIf Func Start() Local $iLoop While 1 For $iCount = 0 To $iMatch-1 Sleep(20) $aSearch = PixelSearch($iStartX,$iStartY,$iEndX,$iEndY,$aKeyColor[$iCount]) If UBound($aSearch) = 2 Then For $iKeyRepeat = 1 To $aKeyRepeat[$iCount] Send($aKeyPress[$iCount]) ; Send Keys to current window. You can also use ControlSend Sleep(20) ; Pause in between key presses Next EndIf Next WEnd EndFunc Func _Exit() Exit 0 EndFunc I truly hope it ISN'T used for game automation. Keep in mind I haven't touched AutoIt in three+ years, so I'm rusty. Peace, -Trystian -
Hello all, I have a 3dConnexion SpaceNavigator for my WindowsXP SP3 system. It's installed as a HID compliant device (ID: HID\VID_046D&PID_C626). I'd like to write an AutoIt program that will read from this device (or possibly others) to programmatically control other things. Has someone written a function to talk to HID devices yet? I was thinking 'MSDN -> User Input/Raw Input' might be a good starting point, but I'm not good with translating C#/VB code to AutoIt. Any help would be greatly appreciated. Thanks, -Trystian
-
Thanks for the feedback dmob. I forgot to change the winhandle call. Thanks Authenticity. Decided to use WinGetHandle("[CLASS:Progman]") instead of Opt("WinTitleMatchMode", 4) to make the function play well with other functions. =)
-
Hey, great function James. I hope you don't mind, but I added the "powersave" functionality, along with turning on the screensaver. ;=============================================================================== ; Function Name: _Monitor() ; Description: Changes the state of the monitor or turns on screensaver. ; Syntax: _Monitor ( [$sIo_control] ) ; ; Parameter(s): $sIo_control = The command to send (default = "on"). ; "on" turns on monitor. ; "off" turns off monitor. ; "powersave" puts monitor(s) in powersave mode. ; "screensaver" turns on screensaver, if one has been selected in Windows. ; ; Requirement(s): External: = user32.dll (it's already in system32). ; Internal: = None. ; ; Author(s): Original function by JamesBrooks (on/off). Modified by TrystianSky (added powersave/screensaver). ; ; Example(s): ; _Monitor("powersave") ;=============================================================================== Func _Monitor($sIo_control = "on") Local $iWM_SYSCommand = 274 Local $iSC_MonitorPower = 61808 Local $iSC_ScreenSave = 61760 Local $hWnd = WinGetHandle("[CLASS:Progman]") Switch StringUpper($sIo_control) Case "OFF" DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWnd, "int", $iWM_SYSCommand, "int", $iSC_MonitorPower, "int", 2) Case "ON" DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWnd, "int", $iWM_SYSCommand, "int", $iSC_MonitorPower, "int", -1) Case "POWERSAVE" DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWnd, "int", $iWM_SYSCommand, "int", $iSC_MonitorPower, "int", 1) Case "SCREENSAVER" DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWnd, "int", $iWM_SYSCommand, "int", $iSC_ScreenSave, "int", 0) Case Else MsgBox(64, @ScriptName, "Command usage: on/off/powersave/screensaver") EndSwitch EndFunc;==>_Monitor Edit: Changed WinGetHandle call. Thanks Authenticity.
-
Ok, I got it to work now, and here's the code.... #include <GUIConstants.au3> Opt("WinTitleMatchMode", 4) Opt("GUIOnEventMode", 1) if $CmdLine[0] = 1 Then $sSourceFile = $CmdLine[1] EndIf $aProcess = ProcessList(@ScriptName) if $aProcess[0][0] > 1 Then $handle = WinGetHandle("classname=AutoIt v3 GUI","VideoLan Stream Launcher") ControlSetText($handle,"","Edit1",$sSourceFile,0) WinActivate($handle) Exit 0 EndIf <gui stuff goes here> While 1 Sleep(100) WEnd <functions go here> Thank you all for the assistance.
-
Greetings again. I am trying to make a program that will detect if it is already running, and if so, will pass information received via a command line parameter to the first instance of the program, then exit the second instance. I have searched the forums for an hour trying to find a solution, but to no avail. I'm sure it's been discussed before. Typically, I use the console for debugging my uncompiled scripts (in SciTE), but never used it for compiled scripts before. Anyhow, here are snippets of what I have so far (Compiled script is named "VideoLan.exe").... #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) If $CmdLine[0] = 1 Then $sSourceFile = $CmdLine[1] EndIf $aProcess = ProcessList("VideoLan.exe") if $aProcess[0][0] > 1 Then ConsoleWrite("VideoLan: " & $sSourceFile) Exit 0 EndIf <gui stuff goes here> While 1 If ConsoleRead(0,true) > 0 Then $sCon = ConsoleRead() if StringLeft($sCon,8) = "VideoLan" Then GUICtrlSetData ($gSourceInput,StringMid($sCon,11)) EndIf EndIf Sleep(100) WEnd <functions go here> I think that the ConsoleRead/ConsoleWrite isn't the correct functions for what I need. I looked at StdoutRead/StdoutWrite, but from what I understood, that would only work for child processes, which this program wouldn't apply. Thank you in advance, -Trystian PS: I'm using AutoIT 3.2.2.0
-
Context menu on Taskbar (Minimize,Maximize,Close, etc.)
Trystian replied to Trystian's topic in AutoIt GUI Help and Support
Just as I thought, right in front of my eyes. I'm still a bit new at creating AutoIT Gui's. This is the solution: $Form1 = GUICreate("TrystianSoft - VideoLan Stream Launcher", 580, 300, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_SYSMENU), $WS_EX_ACCEPTFILES) Vielen Dank th.meger! -Trystian -
Greetings everyone. I've got a problem with my compiled script not showing the normal context menu when you right-click on the programs' tab in the taskbar. My other compiled scripts give me the usual options (Restore, Move, Size, Minimize, Maximize, and Close), yet this one doesn't. I know it's an obvious solution, but I can't seem to find it. Any help would be greatly appreciated. #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Dim $SourceFile,$VLCEXEC,$sSourceFile,$sVCodec,$sVBitrate,$sACodec,$sAChannels,$sABitRate,$sSAPInput,$sURL $VLCEXEC = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\VideoLAN\VLC","") if @error <> 0 Then msgbox(1024,"Error","VideoLan (VLC) not installed") EndIf $Form1 = GUICreate("TrystianSoft - VideoLan Stream Launcher", 580, 300, -1, -1, $WS_MINIMIZEBOX, $WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, "AForm1Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "AForm1Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "AForm1Restore") GUICtrlCreatePic(@ScriptDir & "\VideoLanHeader.jpg", 0, 0, 574, 22) GUICtrlCreateLabel("Codec", 16, 64, 35, 17) GUICtrlCreateLabel("BitRate", 120, 64, 39, 17) GUICtrlCreateLabel("Codec", 296, 64, 35, 17) GUICtrlCreateLabel("Channels", 488, 64, 48, 17) GUICtrlCreateLabel("BitRate", 400, 64, 39, 17) if $CmdLine[0] = 1 Then $sSourceFile = $CmdLine[1] EndIf $SourceFile = GUICtrlCreateInput($sSourceFile, 8, 24, 441, 21) GUICtrlSetState($SourceFile,$GUI_DROPACCEPTED) $SourceBrowse = GUICtrlCreateButton("Browse...", 456, 24, 113, 25, 0) GUICtrlSetOnEvent(-1, "fcnSourceBrowse") $Group1 = GUICtrlCreateGroup("Video Options", 8, 48, 281, 65) $VCodec = GUICtrlCreateCombo("", 16, 80, 97, 25) GUICtrlSetData ( $VCodec, " |WMV1|WMV2|DIV3|DIV2|DIV1|mp1v|mp2v|mp4v|H263|h264|MJPG|", " " ) $VBitRate = GUICtrlCreateCombo("", 120, 80, 81, 25) GUICtrlSetData ( $VBitRate, "16|32|64|128|256|512|1024|2048|3072|4096", "2048" ) $Group2 = GUICtrlCreateGroup("Audio Options", 288, 48, 281, 65) $ACodec = GUICtrlCreateCombo("", 296, 80, 97, 25) GUICtrlSetData ( $ACodec, " |mpga|mp2a|mp3|mp4a|a52|vorb|flac|spx|fl32", "mp3" ) $ABitRate = GUICtrlCreateCombo("", 400, 80, 81, 25) GUICtrlSetData ( $ABitRate, "16|32|64|96|128|192|256|512", "192" ) $AChannels = GUICtrlCreateCombo("", 488, 80, 65, 25) GUICtrlSetData ( $AChannels, "1|2|4|6", "2" ) $Group3 = GUICtrlCreateGroup("SAP Announce", 8, 120, 561, 49) $SAPInput = GUICtrlCreateInput("LanTV (" & @ComputerName & ")", 16, 136, 545, 21) $Group4 = GUICtrlCreateGroup("URL", 8, 175, 561, 49) $URL = GUICtrlCreateInput("239.255.1.1:1234", 16, 191, 545, 21) $LaunchVLCClient = GUICtrlCreateButton("Launch Client", 100, 230, 153, 25, 0) GUICtrlSetOnEvent(-1, "fcnLaunchClient") $LaunchVLCServer = GUICtrlCreateButton("Launch Server", 320, 230, 153, 25, 0) GUICtrlSetOnEvent(-1, "fcnLaunchServer") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func fcnSourceBrowse() $strFilename = FileOpenDialog("Select File","","Videos (*.avi;*.mp?g;*.r?m;*.rmvb)", 1+2) GUICTRLSetData($SourceFile, $strFilename) EndFunc Func fcnReadControls() $sSourceFile = GUICtrlRead($SourceFile) $sVCodec = GUICtrlRead($VCodec) $sVBitRate = GUICtrlRead($VBitRate) $sACodec = GUICtrlRead($ACodec) $sABitRate = GUICtrlRead($ABitRate) $sAChannels = GUICtrlRead($AChannels) $sSAPInput = GUICtrlRead($SAPInput) $sURL = GUICtrlRead($URL) EndFunc Func fcnLaunchClient() fcnReadControls() Run($VLCEXEC & " -vvv udp:@" & $sURL) EndFunc Func fcnLaunchServer() fcnReadControls() Dim $sVid If StringStripWS($sVCodec,7) <> "" Then $sVid = "transcode{vcodec=" & $sVCodec & ",vb=" & $sVBitRate & ",scale=1,acodec=" & $sACodec & ",ab=" & $sABitRate & ",channels=" & $sAChannels & "}:" EndIf $sL = "-vvv """ & $sSourceFile & """ --sout ""#" & $sVid & "duplicate{dst=std{access=udp,mux=ts,dst=" & $sURL & ",sap,name='" & $sSAPInput & "'}}"" --ttl 1" Run($VLCEXEC & " " & $sL) EndFunc Func AForm1Close() Exit 0 EndFunc Func AForm1Minimize() EndFunc Func AForm1Restore() EndFunc This code is still under heavy construction. All it currently does is launch VideoLan in Client or Server mode using a UDP stream (with server options). It won't work unless VideoLan (VLC) is installed.
-
Avast AntiVirus false positives (Win:Autoit [Trj])
Trystian replied to Trystian's topic in AutoIt General Help and Support
I've been running Avast for about 2 months now, and this is the first time that it's popped up stating that all my compiled scripts are infected, including the "AutoIT3Wrapper.exe". I sent the false positive report to Avast (email: virus@avast.com). I've had this issue with other Virus scanners that I've used in the past with regards to AutoIT compiled scripts. There will always be someone out there that screws things up for the rest of us by producing evil things with good tools. Virus producers should be hung by their N*+$. Thanks th.meger for the link. Here a thread on Avast Forums about this AutoIT issue: http://forum.avast.com/index.php?topic=24309.0 -
If you are looking for a specific location of something that pops up in game, use the "Autoit Window Info" tool to get the location/pixelcolor, or if that doesn't work, do a screenshot, then use a graphics editing tool (photoshop/gimp) to find the location of the pixel you are attempting to work with.
-
Actually, that would be the second useful post. w0uter was the first. Search the forums, and you will find your answers, as I did.
-
Try looking here: http://www.autoitscript.com/forum/index.php?showtopic=20736