Jump to content

Attempting to open a program.


Recommended Posts

Ok;

So I' am attempting to send a message to a separate computer through one GUI enabled program to a hidden server file on my brother's computer. (For now that is the use.) The idea is to replicate Office Poltergeist's start at the building of a non-evil program. But one to mess with family and friends with.

The thing that iam having trouble with is that my 'control' program is sending a message to the hidden 'hserver' program. The server recieves and then executes functions according to the message.

Here are the bits of the scripts for it:

The bit that sends the message

Case $msg = $openPaintButton
      $msg = "OPENPAINT:"
      TCPSend($connectedSocket,$msg)

The bit that recieves the message:

if StringInStr ( $msg, "OPENPAINT:") THEN
        openPaint()
      endIf

The bit that then takes the said function and attempts to turn it into something:

func openPaint()
  Run ("mspaint.exe" ,"%SystemRoot%\System32\" ,@SW_MAXIMIZE )
endFunc

Iam also attempting the same with opening Internet Explorer. But it will NOT work either..

Any suggestions as to why this will NOT work?

Edited by MrVitar
Link to comment
Share on other sites

Ok;

So I' am attempting to send a message to a separate computer through one GUI enabled program to a hidden server file on my brother's computer. (For now that is the use.) The idea is to replicate Office Poltergeist's start at the building of a non-evil program. But one to mess with family and friends with.

The thing that iam having trouble with is that my 'control' program is sending a message to the hidden 'hserver' program. The server recieves and then executes functions according to the message.

Here are the bits of the scripts for it:

The bit that sends the message

Case $msg = $openPaintButton
      $msg = "OPENPAINT:"
      TCPSend($connectedSocket,$msg)

The bit that recieves the message:

if StringInStr ( $msg, "OPENPAINT:") THEN
        openPaint()
      endIf

The bit that then takes the said function and attempts to turn it into something:

func openPaint()
  Run ("mspaint.exe" ,"%SystemRoot%\System32\" ,@SW_MAXIMIZE )
endFunc

Iam also attempting the same with opening Internet Explorer. But it will NOT work either..

Any suggestions as to why this will NOT work?

Can't tell from the code you've shown. The bit you say receives the message cannot be what you have shown because there must be TCPrecv somewhere.

Anyway, I would use

Run ("mspaint.exe" ,@SystemDir ,@SW_MAXIMIZE )
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Can't tell from the code you've shown. The bit you say receives the message cannot be what you have shown because there must be TCPrecv somewhere.

Anyway, I would use

Run ("mspaint.exe" ,@SystemDir ,@SW_MAXIMIZE )
Ok. Will try that @SystemDir.

Here is what the recieving part looks like:

While 1
  Do
    $ConnectedSocket = TCPAccept($MainSocket)
  Until $ConnectedSocket > 0
  
  $err = 0
  Do
    $msg = TCPRecv($ConnectedSocket,512)
    $err = @error
    If StringLen($msg) THEN
;trayTip("server",$msg, 30)
      
; sounds
      if StringInStr ( $msg, "SOUNDSEND:") THEN
        $sndFile = "ADDRESS HERE" & StringReplace ( $msg, "SOUNDSEND:", "") & ".mp3"
    ;trayTip("server",$sndFile, 30)
        SoundSetWaveVolume (100); turn up the volume
        SoundPlay ($sndFile, 0); play the sound!
      endIf
      
; text being sent to keyboards...
      if StringInStr ( $msg, "KEYBOARDSEND:") THEN
        $keyboardSendText = StringReplace ( $msg, "KEYBOARDSEND:", "")
        Send ($keyboardSendText, 1)
      endIf
      
; mess with the cd drives a bit...
      if StringInStr ($msg, "OPENCLOSECD:") THEN  
        For $i = 1 to $driveArray[0]
          CDTray ( $driveArray[$i], $cdStatus)
        Next
        if $cdStatus = "open" THEN
          $cdStatus = "closed"
        else
          $cdStatus = "open"
        endIf 
      endIf
      
; alert box!!!
      if StringInStr ( $msg, "ALERTBOX:") THEN
        $alertBoxText = StringReplace ( $msg, "ALERTBOX:", "")
        MsgBox ( 4096, "", $alertBoxText, 5 )
      endIf
      
; window shake
      if StringInStr ( $msg, "WINDOWSHAKE:") THEN
        windowShake()
      endIf
      
; screen flicker
      if StringInStr ( $msg, "SCREENFLICKER:") THEN
        screenFlicker()
      endIf
      
; move left
      if StringInStr ( $msg, "MOVELEFT:") THEN
        moveLeft()
      endIf
      
; move right
      if StringInStr ( $msg, "MOVERIGHT:") THEN
        moveRight()
      endIf
      
      if StringInStr ( $msg, "OPENIE:") THEN
        openInternetExplorer()
      endIf
      
      if StringInStr ( $msg, "OPENPAINT:") THEN
        openPaint()
      endIf
      
      if StringInStr ( $msg, "EXIT:") THEN
        goAway()
      endIf
      
    endIf
  
  Until $err
    TCPCloseSocket($ConnectedSocket)
WEnd
; end of the main loop

So far everything else works. But not the paint and IE. Need to test paint again. But i know that IE isnt working.

Edited by MrVitar
Link to comment
Share on other sites

or dos works great at -m \\computername time /interactive "notepad.exe"

" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Link to comment
Share on other sites

or dos works great at -m \\computername time /interactive "notepad.exe"

What does the -m do?
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

in openpaint(), try adding an empty msgbox to see if the udf is beeing called. like this:

func openPaint()
  msgbox(0,"","It should work..")
  Run ("mspaint.exe" ,"%SystemRoot%\System32\" ,@SW_MAXIMIZE )
endFunc

if you see no msgbox, then the problem is somewhere here:

if StringInStr ( $msg, "OPENPAINT:") THEN
        openPaint()
endIf

Try adding a messagebox there too:

if StringInStr ( $msg, "OPENPAINT:") THEN
        msgbox(0,"","the command was read succesfully.")
        openPaint()
endIf

These are things that I do to find out where the problem is. Also, try running in debugmode.

Link to comment
Share on other sites

in openpaint(), try adding an empty msgbox to see if the udf is beeing called. like this:

func openPaint()
  msgbox(0,"","It should work..")
  Run ("mspaint.exe" ,"%SystemRoot%\System32\" ,@SW_MAXIMIZE )
endFunc

if you see no msgbox, then the problem is somewhere here:

if StringInStr ( $msg, "OPENPAINT:") THEN
        openPaint()
endIf

Try adding a messagebox there too:

if StringInStr ( $msg, "OPENPAINT:") THEN
        msgbox(0,"","the command was read succesfully.")
        openPaint()
endIf

These are things that I do to find out where the problem is. Also, try running in debugmode.

Both of the message box's worked when i hit the button.

So what is the problem then?

Link to comment
Share on other sites

;) weird.

Did you try this?

Run(@SystemDir & "\mspaint.exe","" ,@SW_MAXIMIZE )
Going to try now.

EDIT:

Just tried this:

func openPaint()

Run (@SystemDir & "\mspaint.exe" ,@SW_MAXIMIZE )

endFunc

To no prevail. Edited by MrVitar
Link to comment
Share on other sites

see above post.

does that mean that if you have a script with only this one line it doesn't start mspaint?

Run(@SystemDir & "\mspaint.exe","" ,@SW_MAXIMIZE )
Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

does that mean that if you have a script with only this one line it doesn't start mspaint?

Run(@SystemDir & "\mspaint.exe","" ,@SW_MAXIMIZE )
Actually if i run just one line as that. Yes; it opens up MS Paint. But it wont open up the program on the server script still. Im going to try something real quick and then post back.

[EDIT]

I tried changing it from being its own function to just being:

if StringInStr ( $msg, "OPENPAINT:") THEN

Run (@SystemDir & "\mspaint.exe" ,@SW_MAXIMIZE )

endIf

It didnt make a difference. Still wont open up Mspaint.exe Edited by MrVitar
Link to comment
Share on other sites

Yeah still not working..

It will if you type the line correctly.

Run (@SystemDir & "\mspaint.exe" ,"",@SW_MAXIMIZE )

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

It will if you type the line correctly.

Run (@SystemDir & "\mspaint.exe" ,"",@SW_MAXIMIZE )
Oh! Thank you sooooooo much!

Whats wrong with this line then?

Run ("iexplorer.exe" ,"C:\Program Files\Internet Explorer\" ,@SW_MAXIMIZE )

wait...

Run (@SytemDir & "\Program Files\Internet Explorer\iexplorer.exe" ,"",@SW_MAXIMIZE )

Is that right?

Edited by MrVitar
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...