Results 1 to 10 of 10

Thread: How to send commands to an AutoIt script/program

  1. #1
    Maximum Bitrate
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    520

    How to send commands to an AutoIt script/program

    I want to have an AutoIt program running in the background, to which I can send commands through RoadRunner. I couldn't find any code examples, though . Could some clever AutoIt-programmer lighten me up, please ?

  2. #2
    Mo' Programming Mo' Problems
    Auto Apps:loading...
    Sonicxtacy02's Avatar
    Join Date
    Sep 2004
    Location
    Woodbridge, VA
    Posts
    8,169
    Blog Entries
    53
    because its very easy and i have a script open at the moment i will show u how to run a road runner command in autoit. Copy this to your .au3

    Code:
    ;create SDK for COM with RR.  This must be done ONLY once per script
    $rr = ObjCreate("RoadRunner.SDK")
    
    ;replace COMMAND with your RR command
    $rr.execute("COMMAND")
    and because i'm a good mood i'll show u how to request an rr label into a autoit variable as well

    Code:
    ;trackname can be replaced with any rr label in the screens .skin file
    $var=$rr.getInfo("TRACKNAME")
    ;to request RR variables simply use
    $var=$rr.getInfo("=$musicpath$")
    mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
    Find my plugins on the MP3Car App Store!
    Follow Me on Twitter or Facebook
    Live mp3Car Facebook Chat

  3. #3
    Maximum Bitrate
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    520
    Thanks, but I know how to grab information from RoadRunner and make it execute commands. I want to know how it works vice versa : I want my AutoIt program LISTEN for commands from RoadRunner, i.e. I press a button in RoadRunner, then a command is send to my AutoIt program (which runs constantly in the background).

  4. #4
    Mo' Programming Mo' Problems
    Auto Apps:loading...
    Sonicxtacy02's Avatar
    Join Date
    Sep 2004
    Location
    Woodbridge, VA
    Posts
    8,169
    Blog Entries
    53
    Code:
    while 1
    $var1 = $rr.getInfo(=$Var1$)
    $var2 = $rr.getInfo(=$Var2$)
    if $var1 = "pressed" then 
       [RUN whatever stuff u wanna do with auto it]
        $rr.execute("SETVAR;VAR1;unpressed")
    end if
    if $var2 = "pressed" then
        [RUN whatever stuff u wanna do with the second button]
        $rr.execute("SETVAR;VAR2;unpressed")
    end if
    WEnd
    then instead of running RR commands with your button presses just set the appropriate variable to "pressed" (like SETVAR;VAR1;pressed) so that autoit performs that function. Quick and dirty way to do things and it works
    mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
    Find my plugins on the MP3Car App Store!
    Follow Me on Twitter or Facebook
    Live mp3Car Facebook Chat

  5. #5
    FLAC Sal R.'s Avatar
    Join Date
    Aug 2006
    Location
    Sun Diego
    Posts
    1,448
    Or from the RR source:

    Code:
    Global Const $StructDef_COPYDATA = "ptr;dword;ptr"
    Global Const $WM_COPYDATA = 0x4A
    Global Const $WM_CLOSE = 0x10
    Global Const $STRUCTDEF_AU3MESSAGE = "char[255]"
    
    Dim $cmd
    
    ; Create Reciver window
    $hwmd_Reciver = GUICreate("Receiver")
    
    ; Register Windows Messages
    GUIRegisterMsg($WM_COPYDATA, "_GUIRegisterMsgProc")
    GUIRegisterMsg($WM_CLOSE, "_GUIRegisterMsgProc")
    
    ;Loop indefinitely - put your commands in here
    While 1
    If $cmd = "this" Then
      $cmd = ""
      <do this>
    Endif
    
    If $cmd = "that" Then
      $cmd = ""
      <do that>
    Endif
    
    Sleep(250)
    WEnd
    
    ; Message Handler
    Func _GUIRegisterMsgProc($hWnd, $MsgID, $WParam, $LParam)
    	If $MsgID = $WM_COPYDATA Then
    		; We Recived a WM_COPYDATA Message
    		; $LParam = Poiter to a COPYDATA Struct
    		$vs_cds = DllStructCreate($StructDef_COPYDATA, $LParam)
    		; Member No. 3 of COPYDATA Struct (PVOID lpData;) = Pointer to Costum Struct
    		$vs_msg = DllStructCreate($STRUCTDEF_AU3MESSAGE, DllStructGetData($vs_cds, 3))
    
    		$SciTECmdLen = DllStructGetData($vs_cds, 2)
    		$cmd = StringLeft(DllStructGetData($vs_msg, 1), $SciTECmdLen)
    
    		; Display what we have recived
    		MsgBox(0, "Test String", $cmd)
    
    	ElseIf $MsgID = $WM_CLOSE Then
    	; We Recived a WM_CLOSE Message
    		Exit
    	EndIf
    EndFunc ;==>_GUIRegisterMsgProc
    Once the script is running, you can send commands to it from RR via "SENDMSG;Receiver;<cmd>"

    In this example, <cmd> can be "this" or "that."

    *Note the the "Receiver" name has to match

    Sonic's way is good too. I prefer the method above as it's more process friendly for my M10K since it just sleeps until a message is recieved.
    Pico-ITX / XP Home with EWF-HORM / RR v12/02/2009 / Winamp v5.13 / RRMedia v1.2.2

  6. #6
    Maximum Bitrate
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    520
    Thanks for your help guys .

  7. #7
    SMKFree liquid_smoke's Avatar
    Join Date
    Aug 2003
    Location
    Chicago
    Posts
    4,842
    another way is you can send command line arguments to your script at runtime, i find this works good for scripts that only run for a few secs, do there thing and exit.

    search in the autoit help file for cmdlineraw

    the way i normally use it is i have a command in RR that will run the script and send some bit of information from RR to the script. The script is expecting this information as cmdlineraw is a var inside of autoit.

    Both of the other methods above are very good also, i use them both but depends on what the script calls for ect.
    01101100 01101001 01110001 01110101 01101001 01100100 01011111 01110011
    01101101 01101111 01101011 01100101

    beer replenishment fund
    http://www.mp3car.com/vbulletin/rr-faq/
    mp3car live search

    i have joost invites, just hit me up for one.

  8. #8
    Maximum Bitrate
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    520
    I really appreciate your help guys .

    (Wouldn't this thread fit in the FAQ-section of RoadRunner ?)

  9. #9
    The Curator
    Auto Apps:loading...
    Blue ZX3's Avatar
    Join Date
    Aug 2004
    Location
    Chicago area,IL
    Posts
    5,079
    my media plugin has a LOT of sendmgs to it from rr..
    RideRunner...The #1 FE, PERIOD.

    Current Project: DFXVoice [v1.0 Released]
    Next in line: RRMedia v2.0

    DFX 5.1.1 Skin
    Appstore Link

    My RideRunner Plugins
    RRMedia
    RRExtended
    DFXVoice

    "There are no bugs - only undocumented features."

  10. #10
    Newbie
    Join Date
    Dec 2011
    Posts
    9
    I realize this is 4 years old but found this info very interesting... Anyone have some updates to this to use with Ride runner / DFX5?

    Do all of the above posts still apply and work with current RR?

    thanks!

Similar Threads

  1. Explantion needed about Skin commands
    By seninha in forum RR Skins
    Replies: 2
    Last Post: 03-12-2008, 03:17 PM
  2. iGuidance 4 and AutoIt Scripts
    By BlackStang in forum Road Runner
    Replies: 4
    Last Post: 12-19-2007, 10:54 AM
  3. Need help w/ AutoIT copy file/folder script...
    By Sal R. in forum Software & Software Development
    Replies: 5
    Last Post: 11-22-2007, 06:46 AM
  4. TT Sirius USB interface
    By Pyrotek in forum General Hardware Discussion
    Replies: 0
    Last Post: 09-08-2005, 09:15 AM
  5. send signal to RCA (not the screen)
    By lazynok in forum LCD/Display
    Replies: 8
    Last Post: 08-12-2003, 12:47 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •