Jump to content
Sign in to follow this  
MrVitar

Attempting to open a program.

Recommended Posts

MrVitar

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

Share this post


Link to post
Share on other sites
martin

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.

Share this post


Link to post
Share on other sites
MrVitar

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

Share this post


Link to post
Share on other sites
flip209

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

Share this post


Link to post
Share on other sites
martin

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.

Share this post


Link to post
Share on other sites
Nahuel

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.

Share this post


Link to post
Share on other sites
MrVitar

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?

Share this post


Link to post
Share on other sites
Nahuel

;) weird.

Did you try this?

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

Share this post


Link to post
Share on other sites
MrVitar

;) 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

Share this post


Link to post
Share on other sites
martin

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.

Share this post


Link to post
Share on other sites
MrVitar

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

Share this post


Link to post
Share on other sites
Bowmore

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

Share this post


Link to post
Share on other sites
MrVitar

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

Share this post


Link to post
Share on other sites
system24

It's iexplore.exe, not iexplorer.exe.


[center]It's a question of mind over matter, if I don't mind, it doesn't matter.[/center]

Share this post


Link to post
Share on other sites
MrVitar

It's iexplore.exe, not iexplorer.exe.

Wow.. im so amazed... How on earth did that slip past? And is that a typo on Microsoft's end? i could have sworn it was Explorer.

Share this post


Link to post
Share on other sites
LongBowNZ

I think it's "iexplore.exe" because of 8.3 naming but not sure about that.

Share this post


Link to post
Share on other sites
MrVitar

I think it's "iexplore.exe" because of 8.3 naming but not sure about that.

Ok well either way it still didnt work.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.