Jump to content
Sign in to follow this  
PleaseHelpMEIWillLoveyou

Server to run a autoit script from another pc

Recommended Posts

PleaseHelpMEIWillLoveyou

Is there a way to use a custom terminal or something from my pc and run a script on another pc.

please let me know if its possible

(not for anything bad just for a project im working on)

Share this post


Link to post
Share on other sites
JLogan3o13

The easiest option is PSExec. Be aware, if you're doing something that relies on Send or MouseClick, or a GUI, you are going to have a difficult time of it.

  • Thanks 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
PleaseHelpMEIWillLoveyou
Posted (edited)
1 hour ago, JLogan3o13 said:

The easiest option is PSExec. Be aware, if you're doing something that relies on Send or MouseClick, or a GUI, you are going to have a difficult time of it.

thanks man but I was think of sending requests from a server and then when the script gets the request it runs the rest of the script.

don't know how to explain it but I think it could be done never played with this kinda stuff pretty solid programmer tho anyways thanks again.

Edited by PleaseHelpMEIWillLoveyou

Share this post


Link to post
Share on other sites
Juvigy

You can request data, or text files from the server and run the result. OR a simple scenario is for example PC1 has a shared folder with a txt file, the script on the server in the middle of the script downloads it and runs it. PC2 has another script - the script on the server in the middle of the script downloads it and runs it. Something like that.

Share this post


Link to post
Share on other sites
jdelaney

Tcpip messages between the computers.  requires that you have some sort of listening script.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
PleaseHelpMEIWillLoveyou
On 7/5/2018 at 2:30 PM, jdelaney said:

Tcpip messages between the computers.  requires that you have some sort of listening script.

Thats I was thinking of but don't know how to do it can you help me? 

Thank you

Share this post


Link to post
Share on other sites
PleaseHelpMEIWillLoveyou
On 7/5/2018 at 2:08 AM, Juvigy said:

You can request data, or text files from the server and run the result. OR a simple scenario is for example PC1 has a shared folder with a txt file, the script on the server in the middle of the script downloads it and runs it. PC2 has another script - the script on the server in the middle of the script downloads it and runs it. Something like that.

yea man, do you have a clue how to do this or something will be greatly appreciated. 

Share this post


Link to post
Share on other sites
KickStarter15
Posted (edited)

Maybe if you will use the send and received method that can solve your problem. Let's say something like sending a txt file on a shared folder as what Juvigy said.

How?

1. PC1, create a script that will send a text file on that specific shared folder with 0mb.

2. PC2, create a script that will loop to that shared folder looking for the specific text file using FileFindFirstFile() and FileFindNextFile().

3. Once the script in PC2 find the specific text file, then it will run and you should directly delete the text file before the whole script run (else it will loop back many times).

Or,

I suggest search for chat script in this forum and you will see what I mean. Chat script has the same scenario as I stated above.^_^

 

Here's a sample script where you can start with.

PC1 script:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
HotKeySet("{ESC}", "Terminate")

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("PC1", 150, 80, 300, 200)
$Button1 = GUICtrlCreateButton("Send", 16, 20, 81, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
               $logPath = "\\10.0.0.0\Shared\Test\"
               $info = MsgBox(4, "Sending Command in PC2", "This is just a confirmation!")
               If $info = 6 Then
                  $hFile = FileOpen($logPath & "Test.log", 1)
                  FileWriteLine($hFile, "")
                  FileClose($hFile)
                  Exit
               Else
                 Exit
               EndIf
    EndSwitch
WEnd

 

PC2 script:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
GUISetState(@SW_HIDE) ; this will hide the process...

While 1
   Sleep(1000)
   Example()
WEnd
Func _RemoveFileExt($string)
    Return StringLeft($string,StringInStr($string,".",Default,-1)-1)
EndFunc
Func Example()
    $LogPath = "\\10.0.0.0\Shared\Test\*" ; this is you shared folder
    Local $hSearch = FileFindFirstFile($LogPath)
    $sFileName = FileFindNextFile($hSearch)
    If FileExists($LogPath & ".log") Then
       FileDelete("\\10.0.0.0\Shared\Test\" & $sFileName)
       $Form2 = GUICreate("PC2", 160, 100, 200, 124)
       $Button1 = GUICtrlCreateButton("Click Me", 16, 20, 81, 33)
       GUISetState(@SW_SHOW)
        While 1
         Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
               Exit
            Case $Button1
               MsgBox(0,"",$sFileName)
         EndSwitch
        WEnd
    EndIf
EndFunc

 

If that's what you want.:)

Edited by KickStarter15
Added sample code.
  • Like 1

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

Share this post


Link to post
Share on other sites
PleaseHelpMEIWillLoveyou
On 7/7/2018 at 12:12 AM, KickStarter15 said:

Maybe if you will use the send and received method that can solve your problem. Let's say something like sending a txt file on a shared folder as what Juvigy said.

How?

1. PC1, create a script that will send a text file on that specific shared folder with 0mb.

2. PC2, create a script that will loop to that shared folder looking for the specific text file using FileFindFirstFile() and FileFindNextFile().

3. Once the script in PC2 find the specific text file, then it will run and you should directly delete the text file before the whole script run (else it will loop back many times).

Or,

I suggest search for chat script in this forum and you will see what I mean. Chat script has the same scenario as I stated above.^_^

 

Here's a sample script where you can start with.

PC1 script:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
HotKeySet("{ESC}", "Terminate")

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("PC1", 150, 80, 300, 200)
$Button1 = GUICtrlCreateButton("Send", 16, 20, 81, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
               $logPath = "\\10.0.0.0\Shared\Test\"
               $info = MsgBox(4, "Sending Command in PC2", "This is just a confirmation!")
               If $info = 6 Then
                  $hFile = FileOpen($logPath & "Test.log", 1)
                  FileWriteLine($hFile, "")
                  FileClose($hFile)
                  Exit
               Else
                 Exit
               EndIf
    EndSwitch
WEnd

 

PC2 script:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
GUISetState(@SW_HIDE) ; this will hide the process...

While 1
   Sleep(1000)
   Example()
WEnd
Func _RemoveFileExt($string)
    Return StringLeft($string,StringInStr($string,".",Default,-1)-1)
EndFunc
Func Example()
    $LogPath = "\\10.0.0.0\Shared\Test\*" ; this is you shared folder
    Local $hSearch = FileFindFirstFile($LogPath)
    $sFileName = FileFindNextFile($hSearch)
    If FileExists($LogPath & ".log") Then
       FileDelete("\\10.0.0.0\Shared\Test\" & $sFileName)
       $Form2 = GUICreate("PC2", 160, 100, 200, 124)
       $Button1 = GUICtrlCreateButton("Click Me", 16, 20, 81, 33)
       GUISetState(@SW_SHOW)
        While 1
         Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
               Exit
            Case $Button1
               MsgBox(0,"",$sFileName)
         EndSwitch
        WEnd
    EndIf
EndFunc

 

If that's what you want.:)

Thank you soo much Man Your the best!

Share this post


Link to post
Share on other sites
PleaseHelpMEIWillLoveyou
22 hours ago, jdelaney said:

For the TCP route, check the help file for:

TCPConnect
TCPListen
TCPSend

 

Thanks man :)

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  

  • Similar Content

    • mar3011
      By mar3011
      hello, I want to set in the inputbox field random key from the keyboard to which the function will be assigned, for example F4 function start notepad ALT + A function start notepad for one function. Thank you for any help.  
    • JuanFelipe
      By JuanFelipe
      Cambiar a español Hello friends, I need help with a problem I have, I want to know if there is any way to update a GUI already running, that is I have a GUI of a certain size and with a button I would like to enlarge it:
      example: $ form1 = GUICreate ("", 200,100,0,0)   When you press the button, the gui increases its size, and actuates the new size.
    • BogdanNicolescu
      By BogdanNicolescu
      While 1 / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / WEnd OR:

       
      HotKeySet("{ESC}", "Terminate") While 1 MouseClick("Right",674,422) MouseClick("Left",673,447) Sleep(2000) / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / MouseClick("Left",675,339) SLeep(3000) WEnd Func Terminate()     Exit 0 EndFunc  
      Sorry if i should't let this here to be found by newbies like me -.-'
    • santoshM
      By santoshM
      Dear friends i am facing a problem , i have created a window in autoit some time it is moving with the mouse curser even if iam not clicking the window 
    • sumanth1980
      By sumanth1980
      Here i am wrote a simple lines to install basic applications but when i clicked on one application/program to install it was working fine but when i cancel the program in the middle to install another program it was not working. I am not an expert in this but i want a solution for this ... Can any one help me on this....
      ORG-1.au3
×