AutoHotkey Community

It is currently May 26th, 2012, 12:14 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: February 21st, 2005, 2:54 pm 
Offline

Joined: July 5th, 2004, 9:07 pm
Posts: 56
Location: London
I wanted to be able to run a script on a remote computer over the local network. This example is so that I can mute the sound on the PC on the computer upstairs from the laptop downstairs. Until now I used VNC to do it. Thought I'd share it in case anyone wanted to do anything similar.

I managed to do it by installing a web server on the PC upstairs. Sounds a bit like overkill, but there is a great free server available at

http://www.aprelium.com/abyssws/index.html

which is small and easy to manage. I had to go into the advanced configuration and set enable SSI and set the parameter to allow Exec Cmd Execution.

I created a simple web page called index.shtml in the html folder where the server installed itself
Code:
<!-- #exec cmd="mute.exe" -->
<!-- #exec cmd="type temp.txt" -->

which means that whenever this page is requested, the server will run mute.exe, then display in contents of the file temp.txt

The AHK bit is then easy. On the remote PC in the same folder I created a simple script called mute.ahk and complited it
Code:
filedelete, temp.txt
SoundGet, master_mute, , mute
fileappend, was %master_mute%`n, temp.txt
SoundSet, +1, , mute
SoundGet, master_mute, , mute
fileappend, now %master_mute%, temp.txt

This just toggles the mute and puts whe result in the text file. Then all you need is something to call it from the other PC
Code:
FileDelete, down.html
URLDownloadToFile, http://192.168.0.3/index.shtml, down.html
FileRead, Result, down.html
msgbox, %result%


or of course just type http://192.168.0.3/index.shtml in a browser. (192.168.0.3 is just the ip address of the host computer on the network).

In theory you could use something similar to run scripts over the internet. You need to be careful though, by enabling ssi command execution could allow someone to run commands on the server.

If anyone has a simpler solution I would like to know. I tried just running programs over a shared drive but could not get it to work.

Mike


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2005, 3:50 pm 
PSExec ? ---> www.sysinternals.com


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2005, 5:07 pm 
Offline

Joined: July 5th, 2004, 9:07 pm
Posts: 56
Location: London
Thanks BoBo

I think that would work. I downloaded it and tried
Code:
psexec \\192.168.0.3 c:\mute
from the command prompt and it muted the sound.

An advantage of doing it this way is that it would be easy to pass parameters over so you could say whether to toggle, mute on, mute off (which you could do with the web server but it is more complicated).

I'll create a new script and see how they compare.

Mike


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2005, 8:12 pm 
Offline

Joined: July 2nd, 2004, 11:53 pm
Posts: 207
I've never gotten psexec to work right on my network, it only works if you're logged in as the same user on both computers.

I was going to suggest some kind of remote shell access using netcat on listen mode tied into cmd.exe, then you could just use netcat to connect to that computer and run whatever you want, but psexec is definitely the easier solution if it works for you :roll: .


Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 22nd, 2005, 2:23 am 
Offline

Joined: April 7th, 2004, 2:43 pm
Posts: 62
Smart. Very Smart :)
Thanks for sharing the idea.
Payam
Pallie wrote:
I wanted to be able to run a script on a remote computer over the local network. This example is so that I can mute the sound on the PC on the computer upstairs from the laptop downstairs. Until now I used VNC to do it. Thought I'd share it in case anyone wanted to do anything similar.

I managed to do it by installing a web server on the PC upstairs. Sounds a bit like overkill, but there is a great free server available at

http://www.aprelium.com/abyssws/index.html

which is small and easy to manage. I had to go into the advanced configuration and set enable SSI and set the parameter to allow Exec Cmd Execution.

I created a simple web page called index.shtml in the html folder where the server installed itself
Code:
<!-- #exec cmd="mute.exe" -->
<!-- #exec cmd="type temp.txt" -->

which means that whenever this page is requested, the server will run mute.exe, then display in contents of the file temp.txt

The AHK bit is then easy. On the remote PC in the same folder I created a simple script called mute.ahk and complited it
Code:
filedelete, temp.txt
SoundGet, master_mute, , mute
fileappend, was %master_mute%`n, temp.txt
SoundSet, +1, , mute
SoundGet, master_mute, , mute
fileappend, now %master_mute%, temp.txt

This just toggles the mute and puts whe result in the text file. Then all you need is something to call it from the other PC
Code:
FileDelete, down.html
URLDownloadToFile, http://192.168.0.3/index.shtml, down.html
FileRead, Result, down.html
msgbox, %result%


or of course just type http://192.168.0.3/index.shtml in a browser. (192.168.0.3 is just the ip address of the host computer on the network).

In theory you could use something similar to run scripts over the internet. You need to be careful though, by enabling ssi command execution could allow someone to run commands on the server.

If anyone has a simpler solution I would like to know. I tried just running programs over a shared drive but could not get it to work.

Mike


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 10th, 2005, 10:52 pm 
Offline

Joined: May 10th, 2005, 10:41 pm
Posts: 1
Hello all ,
this is realy amazing to find stuff here which i am looking for, actually i am not a professional programmer but trying to be haha ,, actually i also want to do that same thing as u people doing here, I want to exexute a shell script (on linux base computer & apache web server is running on it ) & exactly as Pallie had done but my ip might be Public one,i am thinking to do it by Java script (for web page) and call that shell script which i allread had saved to that server ,,, ,,,,,,,,,,,,,,,Please help be guys i am really in need of it
i will apreciate your help........................
i am egerly wating for your reply ...........................
give me suggestion .............
by


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 10th, 2005, 10:55 pm 
Offline

Joined: April 14th, 2005, 11:11 am
Posts: 186
Location: Wisconsin, USA
gaurav_jain, you should post that in the Support/Help section, as it will get more attention there.

_________________
Image
"Make it idiot-proof, and someone will make a better idiot."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 11th, 2005, 2:51 am 
savage wrote:
I've never gotten psexec to work right on my network, it only works if you're logged in as the same user on both computers.


Not for NT systems. You can use the -u and -p parameters with psexec. What it does, is install a "temporary" service that will execute your program or batch file on the remote machine. It runs this service using the credentials passed with -u and -p. Then when it's done, it removes the service. There is another program called Xcmd that does a similar thing and you can download the source code. This looks like it here.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 16th, 2009, 1:59 pm 
yfgfdfgdf :o :o :o :o


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 16th, 2009, 2:09 pm 
Offline

Joined: June 18th, 2009, 11:13 pm
Posts: 73
it might be an easier way to run a script on the remote that checks if specific file exists in a folder. Let's say it finds "mute.txt", mutes PC, and deletes the file. Advantage:

You can upload via Shared folder or FTP.
You can upload from external sources.
You can add more commands anytime.
...Ever thought about uploading an .ahk-script? 8)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2009, 9:18 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
skyd1v3r, did you notice the age of this thread?

Anyway, one of the following would probably be more efficient and responsive:

AHK Remote uses TCP/IP to remotely control a computer via an AutoHotkey script at either end.

Sparrow is a simple web server written in AutoHotkey, allowing AutoHotkey to be used for server-side scripts. One could potentially write a Sparrow script to remote-control the server via a web interface. The advantage of this approach is that each client requires only a web browser (and a network connection to the server...).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2009, 3:22 pm 
Offline

Joined: June 18th, 2009, 11:13 pm
Posts: 73
I did not, as it jumped up by this guest.
(how about some hard Capcha for guests?)

Yet it´s a topic worth keeping up-to-date. :lol:

... web server in AHK? Genius proof of concept, but why shoud anyone use AHK for that job? :shock: [/u]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2009, 3:26 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
skyd1v3r wrote:
why shoud anyone use AHK for that job? :shock:
I think my previous post points out the most obvious use. :P


Report this post
Top
 Profile  
Reply with quote  
 Post subject: How can I run
PostPosted: July 18th, 2009, 8:10 am 
Offline

Joined: July 16th, 2009, 11:23 am
Posts: 1
I don't want to run Apache or anything like that. I don't want to subscribe to a website and upload the script there.

Is there any way of basically running the .gci w/o having to do any of that hasselful stuff?

Is there a web browser that interprets .cgi?

Thanks,


web design miami


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 18th, 2009, 10:04 am 
Offline

Joined: June 18th, 2009, 11:13 pm
Posts: 73
I doubt any browser would nativly interpret a server-side script, as there is no use except for developers. Rather try to set up some SDK.
Alternativly, you might have luck with some dev-addon for firefox.

I guess developing and debuging obsolete outdated serverside applications can hardly be done without the hassle.

Maybe some of your tasks con be done in PHP?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: bbwht, Morpheus, oldbrother and 61 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group