Jump to content
Sign in to follow this  
PleaseHelpMEIWillLoveyou

Server to run a autoit script from another pc

Recommended Posts

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

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

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.

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

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

    • By topgundcp
      Hi, 
      This is my very first post in this forum and am also new with Autoit programming so be easy on me.
      Below is the code that I am trying to get the index of the item selected. No problem getting the text.
      Case $listEdition   ; handle of the list             local $index=0             $item=GUICTRLRead($listEdition)    ; This will return the text in the list             ; ==============   The loop below always fails  ==================             ; Meaning _GUICtrlListView_GetItemSelected($listEdition, $i) always return FALSE. WHY ???????              For $i = 0 To $editionArray[0] - 1   ; The content of the list in an array where editionArray[0] contains total count of items                 If _GUICtrlListView_GetItemSelected($listEdition, $i) Then                     $index = $i                     exitloop                 EndIf              Next              ;===================================================             ConsoleWrite( "Select Edition:     " & $item & "  index: " & $index & @CR) ....... Please look at the comments in the code & the pix attached.
      _GUICtrlListView_GetItemSelected($listEdition, $i) always returns FALSE.
      Another problem is on the list. It also populate  the total count of items from the Array. How can I skip this item from populating to the list ?.
      Please advise and thanks

    • By MarkIT
      Hi AutoIT masters,
      Good day! Sorry to have bothered this forum but we really need help. We are working on an automation project that is running on VDI server. The BOTS are in .exe are running fine until AV detected them and deleted the files. The files were re-compiled and AV kept on deleting them. The copy of the .exe BOT deleted were sent to Symantec for whitelisting. After whitelisting, it is no longer deleted but no longer working as designed (showing Line script error). We checked the scripts and there were no issues since we run it using SciTE editor and it performed the desired task. Good thing we found on this thread the solution using .a3x and the BOTS worked fine and no longer deleted. Now, the problem is they are asking why the BOTS won't run in .EXE and what is the reason behind Symantec AV deleting them. We raised a case with Symantec but they cannot provide further information as they are always seeing the file as "False Positive". We even tested with Symantec turned off and those .EXE files are working fine, however, after re-enabling, it got deleted.
      Just seeking help on how to better convince them that it is really Symantec causing the issue and the .a3x file.
    • By n0ktar
      is it possible to make a wall chams in rainbow six siege using autoit scripts? tell me please and how . 
    • By Rskm
      Hi, I am using excel as input media for my program. The excel file (i tried with .xls, .xlsx and .xlsm format) has inputs which the autoit script reads during the run and performs few calculations. Some times (not always), after the run, when i try to open the excel file manually, the file doesnt open at all in excel. see the screenshot attached. However, if the execute the autoit script, the scripts still reads the existing data from that excel and performs the calcs. I copied the excel file to another computer and there too, it doesnt open.  So, after this, i cannot edit the excel forever (if i need to change any inputs). It is only this particular file that got affected. other excel files works normal.  What could be the problem here.  please help as this is a new challenge for me during my program development. 

    • By TheAutomator
      Hi everyone!

      I'm using AutoIt for several years now and I really get the hang of it!
      I'm quite the curious OCD perfectionist kind of guy, so I can't help wondering..
      what would be the best way to program stuff for the compiler / interpreter / scripting engine?
      We're talking about the inner workings of the AutoIt's core here, and how to give it as less friction as possible but also take care of the machine running the script.
      For example,
      Imagine a script where we would constantly have to assign a Boolean value to a variable:
      ; A: local $bool = false $bool = true $bool = true $bool = false ; B: local $bool = false check(true) check(true) check(false) func check($b) if $bool = $b then return $bool = $b endfunc In this case, would it be better to just overwrite (A) the variable or first check if we really need to (B)?
      What would be best for the computers memory if it had to do this for a year non stop?
      Another example, imagine you're writing a function with an if statement.
      If you would look under the hood of AutoIt, what would be the best way to give your computer as less work / code nesting stack filling as possible:
      ; A: func decide($b_Input) if $b_Input then ;do something else ;do something else endif endfunc ; B: func decide($b_Input) if $b_Input then ;do something return endif ;do something else endfunc Last one for now:
      ; A: while 1 ; do stuff wend ; B: while true ; do stuff wend Isn't AutoIt taking an extra step in converting 1 to a Boolean in example (A)?
      Or is it the other way around and does the (B) way make AutoIt first convert a keyword (true or false) to a numerical value (0 or 1).
      I think this kinda detail stuff is quite interesting, makes me wonder how AutoIt converts and runs our code.
      What are your opinions on this topic?
      Any coders who know more about the inner workings of AutoIt?
      Any people like me who ask themselves similar questions (with examples)?

      Let me know! 😉
×
×
  • Create New...