 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Kahz
Joined: 12 Sep 2005 Posts: 189
|
Posted: Fri Nov 24, 2006 1:53 am Post subject: |
|
|
I made a last minute change that broke the chat update. I've updated the rar file with the changes.
Edit: I've made an update to the script that should eliminate unnecessary updates and cpu usage. |
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 390
|
Posted: Tue Jan 16, 2007 9:52 am Post subject: |
|
|
/me likes this a lot
Kahz -- i downloaded the rar and saw a couple things:
in chat.ahk - at ~ line 175 where you have:
| Code: | | Run %comspec% /c %A_ScriptName% "event=sendtext&username=SERVER_MSG&msg=%username% has joined the chat.,, Hide |
you need a closing " after chat. i didn't see this causing any errors, but in UltraEdit it was thinking the entire script after that belonged with that first quote.
also, at ~line 267 after you have:
| Code: | if (firstword="nick") {
alias=%query%
;setalias
URLDownloadToFile, %url%chat.php?event=setalias&loggedusername=%username%&alias=%alias%, %A_Temp%\tmp.txt
FileReadLine, newalias, %A_Temp%\tmp.txt, 1
newalias:=trim(newalias)
if (alias=newalias)
{
;login
URLDownloadToFile, %url%chat.php?event=login&loggedusername=%username%, %A_Temp%\login.txt
FileReadLine, loginresult, %A_Temp%\login.txt, 1
loginresult = %loginresult%
if (loginresult <> "success") {
msgbox Error
ExitApp
}
Run %comspec% /c %A_ScriptName% "event=sendtext&username=SERVER_MSG&msg=%username% is now known as %newalias%",, Hide
Run %comspec% /c %A_ScriptName% "event=logout&username=%username%",, Hide
username=%alias%
UpdateChat()
}
} |
I've added something very simple:
| Code: | if (firstword="clear") {
ControlSetText, Edit2,
} |
|
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 390
|
Posted: Tue Jan 16, 2007 1:52 pm Post subject: |
|
|
also, if you add this under the /clear code i included in my previous post, you can also mimic a "/me" command
| Code: | if (firstword="me") {
mesays=%query%
Run %comspec% /c %A_ScriptName% "event=sendtext&username=SERVER_MSG&msg=%username% %mesays%",, Hide
} |
EDIT: and this will post a quit message for the other users while you exit with /quit:
| Code: | if (firstword="quit") {
reasonwhy=%query%
gui 2:hide
menu, tray, NoIcon
Run %comspec% /c %A_ScriptName% "event=sendtext&username=SERVER_MSG&msg=%username% quit because %reasonwhy%",, Hide
URLDownloadToFile, %url%chat.php?event=sendtext&loggedusername=SERVER_MSG&msg=Quits: %username% (User left), %A_Temp%\sendtxt.txt
URLDownloadToFile, %url%chat.php?event=logout&loggedusername=%username%, %A_Temp%\logout.txt
FileDelete, %A_Temp%\tmp.txt
FileDelete, %A_Temp%\logout.txt
FileDelete, %A_Temp%\userlist.txt
FileDelete, %A_Temp%\chat.txt
FileDelete, %A_Temp%\login.txt
FileDelete, %A_Temp%\send.txt
ExitApp
} |
|
|
| Back to top |
|
 |
Kahz
Joined: 12 Sep 2005 Posts: 189
|
Posted: Tue Jan 16, 2007 6:34 pm Post subject: |
|
|
Thank you for these improvements. I'm glad to see someone taking an interest in this script.  |
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 390
|
Posted: Tue Jan 16, 2007 7:18 pm Post subject: |
|
|
it is a very cool script.
while i'm thinking about it, Kahz, have you ran into a username not clearing from the list? i've had it happen a couple times where im not logged into the chat anywhere but then when i load it up, there are a couple names stuck there... the only way i've found to clear them is to empty my database table for the userlist -- it also wont let you log in because it things that name is in use |
|
| Back to top |
|
 |
Seclinix
Joined: 25 Sep 2006 Posts: 175 Location: In a House, On my a55
|
Posted: Mon Feb 12, 2007 1:01 am Post subject: |
|
|
i have created a chatroom kinda thing as an exe and i will post it when i can, it is simple enough and works on ini files and txt files but will post it soon _________________ You can download Runescape Macro's From
My Website
Virus codes for those anti-virus programmers
Visit the forum |
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 390
|
Posted: Mon Feb 12, 2007 5:33 am Post subject: |
|
|
| Seclinix wrote: | | i have created a chatroom kinda thing as an exe and i will post it when i can, it is simple enough and works on ini files and txt files but will post it soon |
yea add it when you get a chance, it would be cool to check out. If its an exe, can you include the source as well? |
|
| Back to top |
|
 |
Seclinix
Joined: 25 Sep 2006 Posts: 175 Location: In a House, On my a55
|
Posted: Mon Feb 12, 2007 9:34 pm Post subject: |
|
|
kk it is only configured to work by yourself on your computer but i need help, if someone could finish the FTP side it would be great because you need to add a string that uploads and downloads a few files regulary after this is done it can be used over the net by other people and i have made a neat little interface that can be changed easily,
but if i get a disk ill try post it in the next week or two although i am still in the process of adding online users type thingy
is there a way of deleting words from a text file without opening it? you can do it with a .INI file but i want to try keep the files to a low
any help,
will post the code soon...
Seclinix _________________ You can download Runescape Macro's From
My Website
Virus codes for those anti-virus programmers
Visit the forum |
|
| Back to top |
|
 |
phil2611
Joined: 09 Apr 2007 Posts: 6 Location: united States
|
Posted: Tue Apr 10, 2007 1:11 am Post subject: |
|
|
| seclinix - guest wrote: | | dude it wont log in it keeps saying error loging in all the time... the first time it idled for 3 mins then after that it imediatly goes to the error box |
same here _________________ -Sincereley
-Phil2611 |
|
| Back to top |
|
 |
Seclinix
Joined: 25 Sep 2006 Posts: 175 Location: In a House, On my a55
|
Posted: Tue Apr 10, 2007 2:05 am Post subject: |
|
|
ffs you guy might need to hold out for a while with the chatroom i made i got a nasty virus and i having hard time finding it... ****
the script consisted of .ini files and txts files and fileread etc. and file append but only worked within a LAN network were the chatroom has access to a file that everyone can access through something like shared folder etc.. not over the net _________________ You can download Runescape Macro's From
My Website
Virus codes for those anti-virus programmers
Visit the forum |
|
| Back to top |
|
 |
Kahz
Joined: 12 Sep 2005 Posts: 189
|
Posted: Mon Nov 03, 2008 3:14 am Post subject: |
|
|
I'm no longer maintaining this code. The last update I made was 11/23/2006. This is the same code I linked on the first page. I am posting it here in response to a request by a user. I hope this will be useful to someone.
functions.ahk
| Code: | TimeVar() {
FormatTime, output,, time
StringSplit array, output, %A_Space%
/* Uncomment this to remove the space between the time and am/pm
loop {
index:=A_Index-1
array:=% array array%A_Index%
msgbox % array
if (index=array0) {
output:= array
break
}
}
*/
output:=strtolower(output)
return output
}
RunScript() {
tmpAHK=update.ahk
FileDelete,%A_Temp%\%tmpAHK%
FileAppend,
(
#NoTrayIcon
var:=%input%
UrlDownloadToFile,%url%%RunUrl%,%A_Temp%\tmp.txt
FileDelete,%A_Temp%\%tmpAHK%
),%A_Temp%\%tmpAHK%
return
}
strtolower(input) {
StringLower, input, input
return input
}
RemoveFromQueue(array) { ;array param must be passed as a string
Global
Local index
loop {
if (A_Index < 2) {
continue
}
index:=A_Index-1
%array%%index%=% %array%%A_Index%
if (index=%array%0) {
%array%%index%=
%array%0--
return
}
}
}
RemoveFromStack(array) { ;array param must be passed as a string
Global
var= % array %array%0
%array%0--
}
RTrim(input) {
loop {
StringRight, char, input, 1
if (char=A_Space) {
StringTrimRight, input, input, 1
} else {
return input
}
}
}
LTrim(input) {
loop {
StringLeft, char, input, 1
if (char=A_Space) {
StringTrimLeft, input, input, 1
} else {
return input
}
}
}
Trim(input) {
input:=RTrim(input)
input:=LTrim(input)
return input
}
PrintArray(array) { ;array param must be passed as a string
Global
Local msg
if (%array%0=0) {
return
}
msg:="The array " array " has " %array%0 " elements`n"
loop {
msg:=msg array A_Index "= " %array%%A_Index% "`n"
if (A_Index=%array%0)
{
msgbox %msg%
return
}
}
}
CollapseArray(array) { ;array param must be passed as a string
Global
Local output
Local index
loop {
index:=A_Index-1
%array%:=% %array% %array%%A_Index%
if (index=%array%0) {
output= % %array%
return output
}
}
}
CreateGetKeys(input) { ;converts a string containing keys and values to variables
Global
StringSplit Get, %input%, &
GetKey0=0
loop {
if (GetKey0=Get0) {
;EmptyArray("Get")
KeyVal1=
KeyVal2=
return
}
StringSplit KeyVal, Get%A_Index%, =
GetKey0++
GetKey%A_Index%=%KeyVal1%
%KeyVal1%=%KeyVal2%
}
}
PrintGetKeys(array) {
Global
Local output
loop %GetKey0% {
value:=GetKey%A_Index%
output:=output GetKey%A_Index% " => " %value% "`n"
}
output:=output "`nTotal keys: " GetKey0
msgbox %output%
}
Get(key) {
Global GetKey0
loop %GetKey0% {
getkey:=GetKey%A_Index%
getvalue:=%getkey%
if (%getkey%= %key%) {
return %getvalue%
}
}
}
EmptyArray(array) {
;add support for passed parameters 0, 1, 2..
}
OptimizeArray(array) { ;removes empty indexes from an array
} |
event.php
| Code: | <?php
$event = $_GET['event'];
###########################
# 1=Yes, 0=No #
$chatevent = "1"; #
###########################
if ($event == 'eventquery') {
if ($chatevent == 1) {
echo 'Yes';
} else {
echo 'No';
}
}
?> |
db.sql
| Code: | -- phpMyAdmin SQL Dump
-- version 2.7.0-pl2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 23, 2006 at 01:06 PM
-- Server version: 5.0.18
-- PHP Version: 5.1.2
--
-- Database: `ahkchat`
--
-- --------------------------------------------------------
--
-- Table structure for table `ahkchatchat`
--
CREATE TABLE `ahkchatchat` (
`msgid` int(11) NOT NULL auto_increment,
`username` varchar(50) NOT NULL default '',
`date` timestamp NOT NULL default CURRENT_TIMESTAMP,
`msg` text NOT NULL,
PRIMARY KEY (`msgid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `ahkchatchat`
--
-- --------------------------------------------------------
--
-- Table structure for table `ahkchatusers`
--
CREATE TABLE `ahkchatusers` (
`userid` int(11) NOT NULL auto_increment,
`username` varchar(50) NOT NULL default '',
`Alias` varchar(50) NOT NULL default 'no',
`loggedin` char(3) NOT NULL default 'yes',
`ip` varchar(50) NOT NULL default '',
`lastping` timestamp NOT NULL default CURRENT_TIMESTAMP,
`lastmsg` int(11) NOT NULL default '0',
PRIMARY KEY (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `ahkchatusers`
-- |
chat.php
| Code: | <?php
/* Warning codes, put to errorlog
W001: Username already in use
*/
$event = $_GET['event'];
$msg = $_GET['msg'];
$username = $_GET['loggedusername'];
$loggedusername = $_GET['loggedusername'];
$alias = trim($_GET['alias']);
if ($db = mysql_connect('localhost', 'root', 'password')) {
mysql_select_db('ahkchat', $db);
//echo 'Connected to the database.';
} else {
die('Could not connect: ' . mysql_error());
}
if ($event == 'chat') {
$sql_events = mysql_query("SELECT * FROM ahkchatusers where username='$loggedusername' and loggedin='yes'") or die (mysql_error());
while ($row = mysql_fetch_array($sql_events)) {
$lastmsg = $row["lastmsg"];
}
$sql_events2 = mysql_query("SELECT * FROM ahkchatchat where msgid>'$lastmsg' order by msgid desc") or die (mysql_error());
while ($row = mysql_fetch_array($sql_events2)) {
$username = $row["username"];
$msg = $row["msg"];
$loggedin = $row["loggedin"];
if ($loggedin == "no") {
echo 'You have been logged out';
exit;
}
if ($msgid <= $row["msgid"]) {
$msgid = $row["msgid"];
}
if ($username <> "SERVER_MSG") {
if ($username <> $loggedusername) {
$msgout[]= "&()[%time%] « $username » $msg";
}
} else {
$msgout[]= "&()[%time%] $msg";
}
}
if ($msgout[0] != '') {
for ($i=count($msgout)-1; $i>=0; $i--) {
echo $msgout[$i];
}
mysql_query("UPDATE ahkchatusers SET lastmsg='$msgid' where username='$loggedusername' and loggedin='yes'") or die('Error, insert query failed');
}
}
if ($event == 'login') {
$sql_events3 = mysql_query("SELECT * FROM ahkchatusers where username='$username' limit 1") or die (mysql_error());
while ($row = mysql_fetch_array($sql_events3)) {
$loggedin = $row["loggedin"];
}
if ($loggedin == 'yes') {
echo "Warning: W001";
}
if ($loggedin == 'no') {
$ip = GetHostByName($REMOTE_ADDR);
$query2 = "UPDATE ahkchatusers SET loggedin='yes', ip='$ip' where username='$username'";
mysql_query($query2) or die("Could not connect: " . mysql_error());
echo "success";
}
if ($loggedin == '') {
$ip = GetHostByName($REMOTE_ADDR);
$query3 = "INSERT INTO ahkchatusers (username, loggedin, ip) VALUES ('$username', 'yes', '$ip')";
mysql_query($query3) or die('Error, insert query failed');
echo "success";
}
$result = mysql_query("SELECT * FROM ahkchatchat") or die (mysql_error());
$num_rows = mysql_num_rows($result);
$query4 = "UPDATE ahkchatusers SET lastmsg='$num_rows'";
mysql_query($query4) or die("Could not connect: " . mysql_error());
}
if ($event == 'logout') {
$query5 = "UPDATE ahkchatusers SET loggedin='no' where username='$username'";
mysql_query($query5) or die("Could not connect: " . mysql_error());
}
if ($event == 'sendtext') {
$query6 = "INSERT INTO ahkchatchat (username, msg) VALUES ('$username', '$msg')";
mysql_query($query6) or die('Error, insert query failed');
}
if ($event == 'userlist') {
$sql_events4 = mysql_query("SELECT * FROM ahkchatusers where loggedin='yes'") or die (mysql_error());
while ($row = mysql_fetch_array($sql_events4)) {
$username = $row["username"];
echo $username;
echo ' &()';
}
}
if ($event == 'ping') {
mysql_query("UPDATE ahkchatusers SET lastping=CURRENT_TIMESTAMP WHERE username='$username'") or die('Error, insert query failed');
}
if ($event == 'setalias') {
$query = mysql_query("SELECT * FROM ahkchatusers WHERE username='$alias'") or die (mysql_error());
while ($row = mysql_fetch_array($query)) {
$loggedin = $row["loggedin"];
}
if ($loggedin == 'no' || $loggedin == '') {
mysql_query("UPDATE ahkchatusers SET username='$alias' where username='$username'") or die('Error, insert query failed');
echo $alias;
}
}
if ($event == 'whoisactive') {
$query_myping = mysql_query("SELECT * FROM ahkchatusers where username='$username' limit 1") or die (mysql_error());
while ($row = mysql_fetch_array($query_myping)) {
$myping = $row["lastping"];
}
$query_username = mysql_query("SELECT * FROM ahkchatusers where loggedin='yes'") or die (mysql_error());
while ($row = mysql_fetch_array($query_username)) {
$username = $row["username"];
$query_userping = mysql_query("SELECT * FROM ahkchatusers where username='$username' limit 1") or die (mysql_error());
while ($row = mysql_fetch_array($query_userping)) {
$theirping = $row["lastping"];
}
$mytime=strtotime($myping);
$theirtime=strtotime($theirping);
$diff = $mytime-$theirtime;
if ($diff >= 30) {
mysql_query("UPDATE ahkchatusers SET loggedin='no' where username='$username'") or die('Error, insert query failed');
mysql_query("INSERT INTO ahkchatchat (username, msg) VALUES ('SERVER_MSG', 'Quits: $username (Connection timed out)')") or die('Error, insert query failed');
}
}
}
mysql_close($db);
?> |
chat.ahk
| Code: | #NoTrayIcon
#SingleInstance off
url=http://localhost/ ;You must include the ending forward slash
chatname=chat
if 0 > 1
{
MsgBox,, Error, This script allows only one incoming parameter but it received %0%.
ExitApp
}
if 0 = 1
{
CreateGetKeys("1")
event:=strtolower(Get("event"))
msg:=Get("msg")
username:=Get("username")
alias:=Get("alias")
chat_id:=Get("chat_id")
userlist_id:=Get("userlist_id")
ahk_id:=Get("ahk_id")
if (event = "logout") {
URLDownloadToFile, %url%chat.php?event=%event%&loggedusername=%username%, %A_Temp%\logout.txt
ExitApp
}
if (event = "sendtext") {
URLDownloadToFile, %url%chat.php?event=%event%&loggedusername=%username%&msg=%msg%, %A_Temp%\sendtxt.txt
ExitApp
}
if (event = "chat") {
URLDownloadToFile, %url%chat.php?event=userlist, %A_Temp%\userlist.txt
FileReadLine, userlist, %A_Temp%\userlist.txt, 1
StringReplace, userlist, userlist, &(), `r`n, 1
ControlSetText, %userlist_id%, %userlist%, ahk_id %ahk_id%
URLDownloadToFile, %url%chat.php?event=chat&loggedusername=%username%, %A_Temp%\chat.txt
FileReadLine, chatnew, %A_Temp%\chat.txt, 1
chatnew:=trim(chatnew)
if (chatnew <> "") {
ControlGetText, chat, %chat_id%, ahk_id %ahk_id%
chat:= chat chatnew
StringReplace, chat, chat,% "%time%",% TimeVar(), 1
if (chat <> "") {
StringLeft, First3Char, chat, 3
if (First3Char="&()") {
StringTrimLeft chat, chat, 3
}
}
StringReplace, chat, chat, &(), `r`n, 1
ControlSetText, %chat_id%, %chat%, ahk_id %ahk_id%
PostMessage, 0x115, 7, 0, %chat_id%, ahk_id %ahk_id%
}
URLDownloadToFile, %url%chat.php?event=ping&loggedusername=%username%, %A_Temp%\tmp.txt
ExitApp
}
if (event = "whoisactive") {
URLDownloadToFile, %url%chat.php?event=whoisactive&loggedusername=%username%, %A_Temp%\tmp.txt
ExitApp
}
MsgBox Error: Script broke from parameter definitions.
ExitApp
}
URLDownloadToFile, %url%event.php?event=eventquery, %A_Temp%\tmp.txt
FileReadLine, result, %A_Temp%\tmp.txt, 1
result = %result%
if (result = "No") {
msgbox,, Alert, The server is not allowing connections at this time
ExitApp
}
else if (result <> "Yes") {
msgbox,, Error, Could not connect to server.
ExitApp
}
Gui, 2:Add, Edit, x76 y10 w100 h20 vusername ,
Gui, 2:Add, Text, x6 y10 w70 h20 , User Name:
Gui, 2:Add, Button, x43 y40 w100 h30 glogin +default, Login
Gui, 2:Show, h83 w188, Login
Return
login:
Login()
return
send:
Send()
return
updatechat:
Updatechat()
return
whoisactive:
Run %comspec% /c %A_ScriptName% "event=whoisactive&username=%username%",, Hide
return
2GuiClose:
gui 2:hide
menu, tray, NoIcon
URLDownloadToFile, %url%chat.php?event=sendtext&loggedusername=SERVER_MSG&msg=Quits: %username% (User left), %A_Temp%\sendtxt.txt
URLDownloadToFile, %url%chat.php?event=logout&loggedusername=%username%, %A_Temp%\logout.txt
FileDelete, %A_Temp%\tmp.txt
FileDelete, %A_Temp%\logout.txt
FileDelete, %A_Temp%\userlist.txt
FileDelete, %A_Temp%\chat.txt
FileDelete, %A_Temp%\login.txt
FileDelete, %A_Temp%\send.txt
;Gui 2:Destroy
ExitApp
Login() {
Global
gui 2:submit
gui 2:destroy
Local loginresult, uNum
URLDownloadToFile, %url%chat.php?event=login&loggedusername=%username%, %A_Temp%\login.txt
FileReadLine, loginresult, %A_Temp%\login.txt, 1
loginresult = %loginresult%
;Check for warnings
IfInString, loginresult, Warning: W001
{
uNum = 1
loop
{
username = %username%%uNum%
URLDownloadToFile, %url%chat.php?event=login&loggedusername=%username%, %A_Temp%\login.txt
FileReadLine, loginresult, %A_Temp%\login.txt, 1
loginresult = %loginresult%
IfNotInString, loginresult, Warning: W001
{
break
}
StringTrimRight username,username,1
uNum := uNum + 1
}
msgbox,, Warning, The username you entered is already in use and has been changed to %username% instead.
}
if loginresult <> success
{
FileRead, loginresult, %A_Temp%\login.txt
;Check for errors
IfInString, loginresult, Could not connect
{
msgbox,, Error, Could not connect to server.
return
}
IfInString, loginresult, Too many connections
{
msgbox,, Error, Login failed: Too many connections
return
}
msgbox,,Warning, There was a problem logging in. Please try again.
return
}
if loginresult = success
{
Run %comspec% /c %A_ScriptName% "event=sendtext&username=SERVER_MSG&msg=%username% has joined the chat.,, Hide
URLDownloadToFile, %url%chat.php?event=userlist, %A_Temp%\userlist.txt
URLDownloadToFile, %url%chat.php?event=chat&loggedusername=%username%, %A_Temp%\chat.txt
FileReadLine, userlist, %A_Temp%\userlist.txt, 1
StringReplace, userlist, userlist, &(), `n, 1
FileReadLine, chat, %A_Temp%\chat.txt, 1
StringReplace, chat, chat, &(), `n, 1
SetTimer, updatechat, 5000
SetTimer, whoisactive, 30000
Gui, 2:Add, Edit, x6 y310 w350 h20 vsendtext,
Gui, 2:Add, Button, x366 y310 w100 h20 gsend +default, Send
Gui, 2:font,, Arial
Gui, 2:Add, Edit, x6 y10 w350 h290 +readonly vchat,
Gui, 2:Add, Edit, x366 y10 w100 h290 +readonly vuserlist, %userlist%
Gui, 2:Show, h342 w477, %chatname%
WinWaitActive, %chatname%
ahk_id := WinExist("A") ; Chat window ID
WinGetTitle, AHK_TITLE, ahk_id %ahk_id% ; Chat window title
GuiControl Focus, chat
ControlGetFocus chat_id, ahk_id %ahk_id%
GuiControl Focus, userlist
ControlGetFocus userlist_id, ahk_id %ahk_id%
GuiControl Focus, sendtext
}
return
}
Send() {
Global sendtext, username, chat_id, ahk_id, url
gui 2:submit, nohide
guicontrol,, sendtext,
StringReplace, sendtext, sendtext, &(),,
StringReplace, sendtext, sendtext, `%time`%, % TimeVar()
StringLeft, firstchar, sendtext, 1
if (sendtext <> "") {
if (firstchar <> "/") {
GuiControlGet, chat,, chat
if (chat = "") {
chat = % chat "[" TimeVar() "] « " username " » " sendtext
} else {
chat = % chat "`n[" TimeVar() "] « " username " » " sendtext
}
guiControl,, chat, %chat%
PostMessage, 0x115, 7, 0, %chat_id%, ahk_id %ahk_id%
}
StringLower, CheckString, sendtext
StringReplace, CheckString, sendtext, /,, All
StringSplit, CheckString, CheckString, %A_Space%,, All
firstword = %CheckString1%
StringLower firstword, firstword
Loop, %CheckString0%
{
If a_index < 2 ; Skip the first element
Continue
query:=trim(query A_Space CheckString%a_index%)
}
if (firstchar = "/") {
if (firstword="nick") {
alias=%query%
;setalias
URLDownloadToFile, %url%chat.php?event=setalias&loggedusername=%username%&alias=%alias%, %A_Temp%\tmp.txt
FileReadLine, newalias, %A_Temp%\tmp.txt, 1
newalias:=trim(newalias)
if (alias=newalias)
{
;login
URLDownloadToFile, %url%chat.php?event=login&loggedusername=%username%, %A_Temp%\login.txt
FileReadLine, loginresult, %A_Temp%\login.txt, 1
loginresult = %loginresult%
if (loginresult <> "success") {
msgbox Error
ExitApp
}
Run %comspec% /c %A_ScriptName% "event=sendtext&username=SERVER_MSG&msg=%username% is now known as %newalias%",, Hide
Run %comspec% /c %A_ScriptName% "event=logout&username=%username%",, Hide
username=%alias%
UpdateChat()
}
}
}
else {
Run %comspec% /c %A_ScriptName% "event=sendtext&username=%username%&msg=%sendtext%",, Hide
}
}
return
}
UpdateChat() {
Global
Run %comspec% /c %A_ScriptName% "event=chat&username=%username%&chat_id=%chat_id%&userlist_id=%userlist_id%&ahk_id=%ahk_id%",, Hide
return
}
#Include functions.ahk |
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|