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!

How to get your question answered on this forum!

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

    • SharpDressedMan
      By SharpDressedMan
      Hi all,
      I need to use ControlMove() on some controls of a hidden GUI window.
      This works properly on a GUI window created with default style, but does not work on a GUI window created with style $WS_OVERLAPPEDWINDOW
      func GUItest($bOverlapped) $m = GUICreate("test", 200, 100, -1, -1, $bOverlapped ? $WS_OVERLAPPEDWINDOW : -1) $g = GUICtrlCreateButton("test", 0, 0) ControlMove($m, "", $g, 30, 30) GUISetState() endfunc GuiTest(false) ; button 'test' properly moved to (30,30) GuiTest(true) ; button 'test' not moved and still sitting at (0,0) Any reason for this unexpected behavior ?
      Any workaround to fix this ?
      Thanks for any help
    • 2Toes
      By 2Toes
      Hi all..
      I'm having slight issue that has be a bit puzzled.
      I have an Input control.. After a certain function runs, it Disables that Input control, and sets it to ReadOnly.
      When running another certain function, it re-Enables that Input control, and sets the style back to Default.
      Which does work, however, when typing into the Input control after re-Enabling it, the text appears as a light gray color, rather than its original black color.
      I'm sure there's a simple solution here.. But what that is, appears to be beyond me.
      Here is a simplified example code:
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 245, 215, 192, 124) Global $disableBTN = GUICtrlCreateButton("Disable", 32, 64, 75, 25) Global $enableBTN = GUICtrlCreateButton("Enable", 128, 64, 75, 25) Global $Input1 = GUICtrlCreateInput("", 32, 120, 169, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $disableBTN disable() Case $enableBTN enable() EndSwitch WEnd Func disable() GUICtrlSetState($Input1, $GUI_DISABLE) GUICtrlSetStyle($Input1, $ES_READONLY) EndFunc Func enable() GUICtrlSetState($Input1, $GUI_ENABLE) GUICtrlSetStyle($Input1, $GUI_SS_DEFAULT_INPUT) EndFunc  
      Any help would be greatly appreciated
      Thank you in advance!
    • jantograaf
      By jantograaf
      Hi all,
      I'm trying to create a script that runs a JSON-query and then can retrieve some variables out of the returned, decoded object using JSON.au3. I have tried some other examples on this forum, but I'm stuck at one point. My query works perfectly and gets loaded into the variable $data. Then, decoding $data to $object seems to work as well. But then I can't get the date-field out of this JSON-structure with my script.
      The JSON-structure returned looks like this:
      { "content": [ { "id": "451ec583-8f27-4926-82a3-a2d85e57a110", "createdDate": "2018-08-08T08:40:57.449004Z", "updatedDate": "2018-08-08T08:40:57.449004Z", "lastOpenedDate": "2018-08-08T08:40:57.449004Z", "date": "2018-04-26T00:00:00", "description": "X-Ray Exam", "patient": { "id": "f857238a-c75d-4760-b8d1-8f50f8f9bbfa", "createdDate": "2018-08-08T08:40:37.623976Z", "updatedDate": "2018-08-08T08:40:37.623976Z", "lastOpenedDate": "2018-08-08T08:40:37.623976Z", "name": "Fuerstonia", "birthDate": "2014-06-08", "breed": "", "chip": "", "color": "", "damsire": "", "sire": "", "neutered": false, "orthancUuid": "", "sex": "U", "species": "Paard", "ueln": "De 431310762114", "pmsReference": "", "origin": "" }, "type": "study", "accessionNumber": "KME201806960467", "instanceUid": null, "orthancUuid": "", "sent": false, "seriesCount": 0, "modalityType": "RX", "typeAndModality": "study RX", "client": { "id": "be627195-8458-4927-8446-f1ef37b917a4", "createdDate": "2018-08-08T08:40:31.433968Z", "updatedDate": "2018-08-08T08:40:31.433968Z", "lastOpenedDate": "2018-08-08T09:26:49.512298Z", "via": "", "extraInfo": "", "pmsReference": "", "contact": { "id": "406cc555-c491-4c29-b6bb-8d903f0e35a9", "createdDate": "2018-08-08T08:40:31.428968Z", "updatedDate": "2018-08-08T08:40:31.428968Z", "lastName": "Client 1", "firstName": "", "company": "", "email": "", "language": "nl", "phone": "", "address": { "id": "6fc7703c-137a-4e0a-ba96-8c7f38f2044b", "city": "", "country": "", "line": "", "postalCode": "" } } } }, My script looks like this:
      #RequireAdmin #include <json.au3> #include <inet.au3> #include <File.au3> ;Create a handle to a logfile (will be created if it doesnt exist) Global $logfile = FileOpen("C:\VSOL\VSTK\Logs\MigrationFix\MigrationFix.log",9) FileWriteLine($logfile,"Start script") ;Create the URL with the JSON-query $URL = "http://localhost:8080/v0/studies/?seriesCount=1" ;Catch the query output into a variable $data = _INetGetSource($URL) ;Check if there is any data at all in this variable, if not, exit If Not $data Then MsgBox(1,"Error","No answer. Server is probably not running.") Exit EndIf ;For debugging purposes FileWriteLine($logfile,$data) ;Decode the JSON_string into a useable object $object = Json_Decode($data,1000) If @error Then FileWriteLine($logfile,"Error decoding JSON") Exit EndIf Local $i = 0 ;Start a loop to retrieve the study date of each study... While 1 $study_date = json_get($object,'[' & $i & '].date') If @error Then FileWriteLine($logfile,"Study-Date retrieval error") ExitLoop EndIf $i = $i + 1 WEnd ;Close the logfile FileWriteLine($logfile,"Stop script") FileClose($logfile) ;Open the logfile for quick reference ShellExecute("C:\VSOL\VSTK\Logs\MigrationFix\MigrationFix.log") If believe it has something to do with my json_get($object...)-command. Anyone who can point me in the right direction?
      Thanks in advance!
      Kind regards
    • gahhon
      By gahhon
      Hi Guys,
      I was trying to read some data from the excel file and without opening the file. But I tried a lot of methods, it still open the file.
      And also, I am able to capture the ColumnA value but not Column B.
      Thanks for advance information.
      Global $oDataA, $oDataB Call ("ExcelRead", "B2", "C2") Func ExcelRead($oColumnA, $oColumnB) Local $oPath = @ScriptDir & "\MyFile.xlsx" Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oExcel, $oPath, 1, 0) $oDataA = _Excel_RangeRead($oWorkbook, "Sheet 1", $oColumnA) $oDataB = _Excel_RangeRead($oWorkbook, "Sheet 1", $oColumnB) MsgBox(0, "Test Value", $oDataA & ", " & $oDataB) EndFunc  
    • SharpDressedMan
      By SharpDressedMan
      I have an array of subarrays, eg:
      local $a[3] = [ 1, 2, 3 ] local $b[3] = [ 4, 5, 6 ] local $c[2] = [ $a, $b ] I can read read a subarray element of the array, as follows:
      local $c12 = ($c[1])[2] ; result: $c12 = 6 However, when I try to set a subarray element as follows, it fails:
      ($c[1])[2] = 12 ; this fails to set subarray element local $c12 = ($c[1])[2] ; result: $c12 = 6 How to set a subarray element ?
      Thanks
×