-
Posts
76 -
Joined
-
Last visited
Everything posted by Trystian
-
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
-
Keyboard: Special key detection
Trystian replied to Trystian's topic in AutoIt General Help and Support
I found the only keyboard driver made for this keyboard (Chicony PS/2 KB-0108 - made in Taiwan), BUT, the functions are all hardcoded into the drivers. All the keys MUST have an ID/scancode for the driver to assign it a function. There isn't any documentation anywhere on the net that I have found that gives the codes for each of the special keys for this keyboard. I have tried contacting the manufacturer, but so far have gotten no reply. What I am looking for it some way to detect the codes for each of these special keys, and be able to write custom functions in Autoit to be able to assign a custom URL or Program to each of these keys. I can do it with some with the built-in HotkeySet function, but not all the special keys. With the new Autoit Beta, there is the SEND("{ASC 0000}"), but can that format be used for the HotKeySet function [HotKeySet("{ASC 0000}",fcnDoSomething)]. 0000 being a keycode 0000-9999. -
Keyboard: Special key detection
Trystian replied to Trystian's topic in AutoIt General Help and Support
I can't believe there is nobody out there that hasn't overcome this issue. ANY help would be greatly appreciated. Thank you, -Trystian -
Keyboard: Special key detection
Trystian replied to Trystian's topic in AutoIt General Help and Support
So, anyone have any ideas? -
Keyboard: Special key detection
Trystian replied to Trystian's topic in AutoIt General Help and Support
I was hoping THAT word wouldn't creep into this topic. And no, I'm not taking it personally. Yes, I want to use this to detect ONLY the "special" keys on my keyboard to be able to launch programs and/or URL's. Just like Microsoft's Intellitype, or Logitech's iTouch/SetPoint software. NO KEYLOGGING. My old keyboard was so messed up that I had to switch. I was so used to my old Logitech keyboard's extra key functionality that I'm having seizures now that I don't have that with this new keyboard. So, I thought I'd write my own application with AutoIT to help with this issue. Even though there are an unlimited number beneficial things that can be created with AutoIT, there will always be people who exploit it for truly ugly and negative purposes. I am not one of those people. -
Keyboard: Special key detection
Trystian replied to Trystian's topic in AutoIt General Help and Support
I've read it, but it doesn't help with this issue. Hence the reason for this post. Thanks, -Trystian -
Keyboard: Special key detection
Trystian replied to Trystian's topic in AutoIt General Help and Support
Some of these do work, but others don't. Plus these don't cover all the keys that I need to add custom functionality to. Perhaps I'll have to use a DLL that taps into the Keyboard Hooks. I'd rather not use this approach if there is a built-in way to do this in AutoIT. -
Greetings everyone, I am attempting to make a program that detects the special keyboard keys so that when someone presses one, it will launch a URL or program. The reason I'm not using something like iTouch, Intellitype Pro, or any other such software, is that it doesn't work with all the special keys on my current keyboard (eMachines KB-0108), and the software that is available for this keyboard doesn't let you customize functionality. My question: Is there a way to detect the keycode/scancode for the special function keys, then use that code in the HotKeySet function? Some keys use the standard codes that AutoIT3 can detect (MEDIA_NEXT,MEDIA_PREV,MEDIA_STOP,MEDIA_PLAY_PAUSE, etc.), but others just don't seem to work. I've tried HotKeySet ( "{ASC 0xxx}", "fcnTest"), with xxx being 000 -> 031 and 128 -> 255, but to no avail. Here is the basic code: HotKeySet ( "{LAUNCH_APP1}", "fcnTest") While 1=1 Sleep(100) WEnd Func fcnTest() msgbox(0,"Key Test","Keypress: LAUNCH_APP1") ; Launch URL or Program EndFunc The keys I'd like to give special functions to are: CutCopyPasteSleepCalulatorMedia Play/PauseMedia PreviousMedia NextMedia StopMedia MuteMedia Vol UpMedia Vol DownInternetE-mailSearchBackwardForwardFavoriteHere's a visual of my keyboard (with special buttons labelled): Any help would be appreciated. -Trystian
-
Your best bet is to use the GD graphics library, and possibly the inclusion of the FLY interpreter, depending on your implementation. If you want to use the Win32 GD DLL directly in AutoIT, without FLY, read the directions thoroughly that are included in the zip file. -Trystian
-
Direct SQL access in autoit (beta)
Trystian replied to scriptkitty's topic in AutoIt Example Scripts
If you don't want to, or can't setup your own DNS entry on your client machine, here is the DSN-Less connection string to connect directly to a mySQL database. You need to have the myODBC driver installed on the client. Get the driver HERE. $sConn = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=mysql.yoursever.com;DATABASE=database;USER=username;PASSWORD=password;PORT=3306;OPTIO N=3;" Enjoy, -Trystian -
Just a note to say thanks to Jon and the devs
Trystian replied to MrSmiley's topic in AutoIt General Help and Support
That's funny. A similar thing happened to me. The company I was working for hired someone (East Indian with work Visa) to "help me with my job". Ask me to train him with EVERYTHING I know, then laid me off two weeks later. I knew what was happening, and "forgot" to mention certain key things about my job. They called me a couple days afterwards and asked that I come back to help fill in the blanks. I immediately told them I would do it, but for $120/hour as an independant consultant (1099). A small step up from my $40/hour job. =) They had no choice, since it was business critical info. I made a nice $6k that week. And it FELT GOOD! And yes, I was using a lot of my "undocumented" AutoIT scripts to automate the db/web/file prepping/propping. Thanks guys for making such an incredibly useful tool. It's not just a simple scripting language anymore, it's a very robust, essential tool to have for anyone working with automation.