Jump to content
FireFox

Skype UDF v1.2 (Sep 15, 2013)

Recommended Posts

Didn't work. It remains always the first webcam.

Maybe I must do a autoit script to control the skype client and make the manual change of webcam. It's a pity it can't be done from skype4com.

Share this post


Link to post
Share on other sites

@frank10

Are you trying to make a video surveillance ? if so it's a good idea ;)


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Yes I do.

I was thinking of sending webcam video through the net, maybe on a server to see them in a web page or creating an app on android, then I thought of skype and that's simpler.

Now I would like to record the camera sent to phone with skype. Any ideas?

Share this post


Link to post
Share on other sites

I'v been tinkering around with the Skype UDF and got a script that auto replies to chat when a user enters a special command. Example: >> !time . I feel it could help other people with the, "Skype_OnEvent" functions.

This was pieced together and taken from an old example. Amazing work btw, FireFox for making this udf. Was also wondering if there was a better way to respond to a chat directly from a message. Right now i'm using, "$oMsg.Chat.SendMessage". Thanks!

Example code below:

;Made by TJWho...
;
;You or a friend can message you with the following commands
;
;!help
;!time
;!slap [Person]
;!8ball [question]
;all the dice commands do the same thing
;!roll
;!DICE 20
;!RANDOM 1-100
;!RAND 3d3

;#include <Skype.au3>
;Depending on where your skype.au3 is at.
#include "Skype.au3"

_Skype_Start() ;in case not running

#Region Variables
Global $oChat, $blChat = False
Global $oCall, $blCall = False, $blCallHold = False
Global $sCurrUserHandle = _Skype_ProfileGetHandle()
Global $sDealUserHandle
#EndRegion Variables

#Region Skype_OnEvent
_Skype_OnEventAttachmentStatus("_AttachmentStatus")

_Skype_OnEventMessageStatus("_ChatMessage", $cCmsSent)
_Skype_OnEventMessageStatus("_ChatMessage", $cCmsReceived)

_Skype_OnEventError("_Error")
#EndRegion Skype_OnEvent

;Taken from a 8ball.ini file
#region 8ball.ini
local $a8ball[29]
$a8ball[0] = "Maybe..."
$a8ball[1] = "As I see It, Yes"
$a8ball[2] = "It is certain"
$a8ball[3] = "It is decidedly so"
$a8ball[4] = "Most likely"
$a8ball[5] = "Outlook good"
$a8ball[6] = "Signs point to Yes"
$a8ball[7] = "Without a doubt"
$a8ball[8] = "YES"
$a8ball[9] = "Yes, definitely"
$a8ball[10] = "You may rely on it"
$a8ball[11] = "Ask again later"
$a8ball[12] = "Better not tell you now"
$a8ball[13] = "Cannot predict now"
$a8ball[14] = "Concentrate and ask again"
$a8ball[15] = "Don't count on it"
$a8ball[16] = "My reply is No"
$a8ball[17] = "My sources say No"
$a8ball[18] = "Outlook not so good"
$a8ball[19] = "Reply Hazy, Try again"
$a8ball[20] = "Very doubtful"
$a8ball[21] = "Not only no, but HELL No!"
$a8ball[22] = "Not only yes, but HELL Yes!"
$a8ball[23] = "You will regret it!"
$a8ball[24] = "Signs point to No"
$a8ball[25] = "Go away... I don't want you back!"
$a8ball[26] = "Well I love you, come back!"
$a8ball[27] = "What? Are you taking me as an 8 ball?"
$a8ball[28] = "Outlook is disturbing"
#endregion 8ball.ini

;// Sleep
While 1
Sleep(1)
WEnd

;// Where the event gets called too
Func _ChatMessage($oMsg)
DecodeMsg($oMsg)
If $oSkype.Convert.ChatMessageTypeToText($oMsg.Type) = "unknown" Then
AutoChat($oMsg)
EndIf
if $oSkype.Convert.ChatMessageTypeToText($oMsg.Type) = 'Said' then
AutoChat($oMsg)
EndIf
EndFunc ;==>_ChatMessage

;// The DecodeMsg event handler decodes messages in a chat and converts leave reasons to text for messages of type "Left":
Func DecodeMsg($oMsg)
$sText = $oMsg.FromHandle & " " & $oSkype.Convert.ChatMessageTypeToText($oMsg.Type) & ":"
If StringLen($oMsg.Body) Then
$sText = $sText & " " & $oMsg.Body
EndIf
Dim $oUser
For $oUser In $oMsg.Users
$sText = $sText & " " & $oUser.Handle
Next
#cs
If $oMsg.Type = $cMessageType_Left Then
$sText = $sText & " " & $oSkype.Convert.ChatLeaveReasonToText($oMsg.LeaveReason)
EndIf
#ce
ConsoleWrite($sText & @LF)
EndFunc

Func _AttachmentStatus($TAttachmentStatus)
;the Skype UDF will automatically attach to skype when this one will be available
EndFunc

;// $oMsg.Chat.SendMessage responds with a message
Func AutoChat($oMsg)
local $sTemp = StringSplit($oMsg.Body," ")
switch $sTemp[1]
case '!time'
$time = _DateDayOfWeek(@WDAY)&" "&_DateToMonth(@MON)&" "&@MDAY&" "&@YEAR&" -- "&@HOUR&":"&@MIN&":"&@SEC
$oMsg.Chat.SendMessage('/me >>'&$time)
;Tuesday November 27 2012 -- 21:49:50 -05:00
case '!help'
$oMsg.Chat.SendMessage('/me >>'&help_list())
case '!roll','!DICE','!RANDOM','!RAND'
$oMsg.Chat.SendMessage('/me >>'&DICE($oMsg.body))
EndSwitch
if $sTemp[0] = 1 then return 0
Switch $sTemp[1]
case '!slap'
$oMsg.Chat.SendMessage('/me >>'&$oMsg.FromHandle & ' slaps '&$sTemp[2]&' around a bit with a large trout')
case '!8ball'
$i = Random (0, UBound($a8ball) -1)
$oMsg.Chat.SendMessage('/me >>'&$a8ball[$i])
EndSwitch
EndFunc


Func DICE($d='')
;ConsoleWrite("BEFORE: "&$d & @LF)
local $regname = '(?x)(?i)!((roll)|(DICE)|(RANDOM)|(RAND))'
$d = StringRegExpReplace($d,$regname,"")
;ConsoleWrite("AFTER: "&$d & @LF)
if $d = '' then return Random(1,100,1)
local $tempd,$templ
local $Wrong = 'Invalid Syntax!'

$regexp = "(?x)(?i)(([1-9]d[1-9])|([0-9]{0,4}-[0-9]{0,4})|([0-9]{0,4}))"
if Not StringRegExp($d,$regexp) Then return $Wrong

$tempd = StringSplit($d,"d")
if $tempd[0] = 1 Then
$templ = StringSplit($d,"-")
if $templ[0] = 1 Then return Random(1,int($d),1)
return Random($templ[1],$templ[2],1)
Else
local $n = int($tempd[1])
if $n > 1000 then Return "Its too BIG!!!"
local $str = ''
While True
if $n = 0 then ExitLoop
$str &= '.'&Random(1,$tempd[2],1)
$n -=1
WEnd
return StringRight($str,StringLen($str)-1)
EndIf
return $Wrong
EndFunc

Func help_list()
local $str = "Current list of commands:" & _
"!HELP,!ROLL,!SLAP,!TRIVIABOT,!TIME,!8BALL"
Return $str
EndFunc

Func _Error($iError, $sError)
ConsoleWrite("iERROR: "&$iError&"sERROR: "& $sError & @LF)
EndFunc

Func _Exit()
Exit
EndFunc ;==>_Exit

Share this post


Link to post
Share on other sites

@frank10

If it's not possible to do it manually with Skype, you won't be able to do it with Skype4COM. However, you can always try to find a workaround somewhere.

@TJWho

Thank you ! :)

If you already know how to use the Skype4COM api with objects, only few functions will be useful for you because I have only converted objects to functions like AutoIt does, without handling non object errors.

So, If you want to convert your script with a minimum of "visible" class objects, this would be (not tested) :

#include "Skype.au3"

;Made by TJWho...
;
;You or a friend can message you with the following commands
;
;!help
;!time
;!slap [Person]
;!8ball [question]
;all the dice commands do the same thing
;!roll
;!DICE 20
;!RANDOM 1-100
;!RAND 3d3

;#include <Skype.au3>
;Depending on where your skype.au3 is at.
#include "Skype.au3"

_Skype_Start() ;in case not running

#region Variables
Global $oChat, $blChat = False
Global $oCall, $blCall = False, $blCallHold = False
Global $sCurrUserHandle = _Skype_ProfileGetHandle()
Global $sDealUserHandle
#endregion Variables

#region Skype_OnEvent
_Skype_OnEventAttachmentStatus("_AttachmentStatus")

_Skype_OnEventMessageStatus("_ChatMessage", $cCmsSent)
_Skype_OnEventMessageStatus("_ChatMessage", $cCmsReceived)

_Skype_OnEventError("_Error")
#endregion Skype_OnEvent

;Taken from a 8ball.ini file
#region 8ball.ini
Local $a8ball[29]
$a8ball[0] = "Maybe..."
$a8ball[1] = "As I see It, Yes"
$a8ball[2] = "It is certain"
$a8ball[3] = "It is decidedly so"
$a8ball[4] = "Most likely"
$a8ball[5] = "Outlook good"
$a8ball[6] = "Signs point to Yes"
$a8ball[7] = "Without a doubt"
$a8ball[8] = "YES"
$a8ball[9] = "Yes, definitely"
$a8ball[10] = "You may rely on it"
$a8ball[11] = "Ask again later"
$a8ball[12] = "Better not tell you now"
$a8ball[13] = "Cannot predict now"
$a8ball[14] = "Concentrate and ask again"
$a8ball[15] = "Don't count on it"
$a8ball[16] = "My reply is No"
$a8ball[17] = "My sources say No"
$a8ball[18] = "Outlook not so good"
$a8ball[19] = "Reply Hazy, Try again"
$a8ball[20] = "Very doubtful"
$a8ball[21] = "Not only no, but HELL No!"
$a8ball[22] = "Not only yes, but HELL Yes!"
$a8ball[23] = "You will regret it!"
$a8ball[24] = "Signs point to No"
$a8ball[25] = "Go away... I don't want you back!"
$a8ball[26] = "Well I love you, come back!"
$a8ball[27] = "What? Are you taking me as an 8 ball?"
$a8ball[28] = "Outlook is disturbing"
#endregion 8ball.ini

;// Sleep
While 1
Sleep(10) ;min 10 ;)
WEnd

;// Where the event gets called too
Func _ChatMessage($oMsg)
DecodeMsg($oMsg)
$sMsgType = _Skype_ChatMessageGetType($oMsg)

If _Skype_ConvertChatMessageType($sMsgType, True) = "Unknown" Then ;or not converted: $cCmeUnknown
AutoChat($oMsg)
ElseIf _Skype_ConvertChatMessageType($sMsgType, True) = "Said" Then ;or not converted: $cCmeSaid
AutoChat($oMsg)
EndIf
EndFunc ;==>_ChatMessage

;// The DecodeMsg event handler decodes messages in a chat and converts leave reasons to text for messages of type "Left":
Func DecodeMsg($oMsg)
$sText = _Skype_ChatMessageGetFromHandle($oMsg) & " " & _Skype_ConvertChatMessageType(_Skype_ChatMessageGetType($oMsg), True) & ":"

$sMsgBody = _Skype_ChatMessageGetBody($oMsg)
If StringLen($sMsgBody) Then
$sText &= " " & $sMsgBody
EndIf

#cs
If $oMsg.Type = $cMessageType_Left Then
$sText = $sText & " " & $oSkype.Convert.ChatLeaveReasonToText($oMsg.LeaveReason)
EndIf
#ce

ConsoleWrite($sText & @LF)
EndFunc ;==>DecodeMsg

Func _AttachmentStatus($TAttachmentStatus)
;the Skype UDF will automatically attach to skype when this one will be available
EndFunc ;==>_AttachmentStatus

;// $oMsg.Chat.SendMessage responds with a message
Func AutoChat($oMsg)
$sMsgBody = _Skype_ChatMessageGetBody($oMsg)

Local $sTemp = StringSplit($sMsgBody, " ")
Switch $sTemp[1]
Case '!time'
$time = _DateDayOfWeek(@WDAY) & " " & _DateToMonth(@MON) & " " & @MDAY & " " & @YEAR & " -- " & @HOUR & ":" & @MIN & ":" & @SEC
$oMsg.Chat.SendMessage('/me >>' & $time)
;Tuesday November 27 2012 -- 21:49:50 -05:00
Case '!help'
$oMsg.Chat.SendMessage('/me >>' & help_list())
Case '!roll', '!DICE', '!RANDOM', '!RAND'
$oMsg.Chat.SendMessage('/me >>' & DICE($sMsgBody))
EndSwitch
If $sTemp[0] = 1 Then Return 0
Switch $sTemp[1]
Case '!slap'
$oMsg.Chat.SendMessage('/me >>' & _Skype_ChatMessageGetFromHandle($oMsg) & ' slaps ' & $sTemp[2] & ' around a bit with a large trout')
Case '!8ball'
$i = Random(0, UBound($a8ball) - 1)
$oMsg.Chat.SendMessage('/me >>' & $a8ball[$i])
EndSwitch
EndFunc ;==>AutoChat


Func DICE($d = '')
;ConsoleWrite("BEFORE: "&$d & @LF)
Local $regname = '(?x)(?i)!((roll)|(DICE)|(RANDOM)|(RAND))'
$d = StringRegExpReplace($d, $regname, "")
;ConsoleWrite("AFTER: "&$d & @LF)
If $d = '' Then Return Random(1, 100, 1)
Local $tempd, $templ
Local $Wrong = 'Invalid Syntax!'

$regexp = "(?x)(?i)(([1-9]d[1-9])|([0-9]{0,4}-[0-9]{0,4})|([0-9]{0,4}))"
If Not StringRegExp($d, $regexp) Then Return $Wrong

$tempd = StringSplit($d, "d")
If $tempd[0] = 1 Then
$templ = StringSplit($d, "-")
If $templ[0] = 1 Then Return Random(1, Int($d), 1)
Return Random($templ[1], $templ[2], 1)
Else
Local $n = Int($tempd[1])
If $n > 1000 Then Return "Its too BIG!!!"
Local $str = ''
While True
If $n = 0 Then ExitLoop
$str &= '.' & Random(1, $tempd[2], 1)
$n -= 1
WEnd
Return StringRight($str, StringLen($str) - 1)
EndIf
Return $Wrong
EndFunc ;==>DICE

Func help_list()
Local $str = "Current list of commands:" & _
"!HELP,!ROLL,!SLAP,!TRIVIABOT,!TIME,!8BALL"
Return $str
EndFunc ;==>help_list

Func _Error($iError, $sError)
ConsoleWrite("iERROR: " & $iError & "sERROR: " & $sError & @LF)
EndFunc ;==>_Error

Func _Exit()
Exit
EndFunc ;==>_Exit

Was also wondering if there was a better way to respond to a chat directly from a message. Right now i'm using, "$oMsg.Chat.SendMessage".

Good question, I have not found any example so I don't know, but it should exist. For the moment you must have the chat object which is not the case in your example.

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

so, i wanted to call someone then instantly hang up. as i understand it, _Skype_CallCreate("user") returns the call object? so i set it as a variable then used it in the finsih function, it calls but never finishes, heres the code:

----

$user = "lolpork"

Global $oCall = _Skype_CallCreate($user)

_Skype_CallFinish($oCall)

----

any ideas why it wont end the call? do i need some special object that i dont have?

Edited by lionfaggot

Share this post


Link to post
Share on other sites

Lets see,

One way to do this is use the _Skype_CallGetStatus function. Look for the word ";TCallStatus" in the Skype UDF. That will give you all the different call status that you can look for. Here is an example if you want them to pick up first and then it will drop the call.

#include "Skype.au3"
local $user = "lolpork"
$oCall = _Skype_CallCreate($user)
While 1
  ;Wait for them to answer then drop the call
  if _Skype_CallGetStatus($oCall) = $cClsInProgress then ExitLoop
WEnd
_Skype_CallFinish($oCall)

Hope this is what you looking for.

Share this post


Link to post
Share on other sites

Hi FireFox.

First of all. GREAT UDF. This will be a killer if i just understand how the heck everything is suposed to work :P

here the deal.

I want to create a script that add uers to the contact list. I have a list of skype-names and Ive managed to be able to check if the current user is in the contact list. heres my code

#include 
#include 

$data = _Skype_SearchForUsers("skypename")
;~ _arraydisplay($data)
consolewrite(_Skype_UserGetAuthorized($data[0]) & @CRLF)
if _Skype_UserGetAuthorized($data[0]) = "False" Then
ConsoleWrite($data[0].TBuddyStatus.budPendingAuthorization & @CRLF)
EndIf

Now if the function returns false, i would like to att the user to the list. or at least send a request to that person (a custom message woyld be awsome). But i cannot find a fuction for that so i seached the net and found that the API uses somthing called "TBuddyStatus.budPendingAuthorization". But i cant get it to work. The code runs, but nothing is happening.

Any help would be appritiated.

/G

Share this post


Link to post
Share on other sites

First of all. GREAT UDF. This will be a killer if i just understand how the heck everything is suposed to work :P

I'm glad you like it :)

Here you go :

#include "Skype.au3"

_Skype_OpenAddAFriend("echo123")

;or directly
$oSkype.Friends.Add("echo123")

I have not found how to set a custom add message, but I think that the first message sent is the custom message so try it.

For the rest, keep your code.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

I have now tried forever and i cant get it to work.

I used _Skype_OpenAddAFriend("echo123") and the only thing that happend was that skype searched for users with that name. But didnt add them to my list

I the tried to manually add the skypename of a user that i have deleted from my list

_Skype_OpenAddAFriend("my.skype.name") and nothing happend. I tried the secound pice of code aswell. Same thing. Nothing happend.

Share this post


Link to post
Share on other sites

oh.., the syntax was a suggestion and you're right it's not as simple as I thought.

Here you go :

#include "Skype.au3"

_Skype_UserAdd("echo123")

Func _Skype_UserAdd($sUserHandle, $sPendingMessage = "Hi !") ;by FireFox
If _Skype_UserGetBuddyStatus($sUserHandle) <> $cBudFriend Then
__Skype_SendCommand("SET USER " & $sUserHandle & " BUDDYSTATUS " & $cBudPendingAuthorization & " " & $sPendingMessage, "", False)
EndIf
EndFunc ;==>_Skype_UserAdd

P.S: Don't try to add yourself as I saw "my.skype.name" in your last post.

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

oh.., the syntax was a suggestion and you're right it's not as simple as I thought.

Here you go :

#include "Skype.au3"

_Skype_UserAdd("echo123")

Func _Skype_UserAdd($sUserHandle, $sPendingMessage = "Hi !") ;by FireFox
If _Skype_UserGetBuddyStatus($sUserHandle) <> $cBudFriend Then
__Skype_SendCommand("SET USER " & $sUserHandle & " BUDDYSTATUS " & $cBudPendingAuthorization & " " & $sPendingMessage, "", False)
EndIf
EndFunc ;==>_Skype_UserAdd

P.S: Don't try to add yourself as I saw "my.skype.name" in your last post.

Br, FireFox.

Alright i tried it on one of my friends (witch i had deeted befor) and it works. Great stuff! :D

However the program never finishes. I just keep running like its waiting for somthing to happen or an never ending loop.

The plan is to create a script that will add all contacts in out company to your skype.NBut if this little code never finshes, then i cant do more then one :)

Share this post


Link to post
Share on other sites

Huh, this is an autoit/Skype4COM issue.

The only workaround is to replace the default Exit statement (when you don't have one it's at the end of the script) by :

ProcessClose(@AutoItPID)

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Hi everyone,

How do I send skype message using this UDF? I added the Libraries to my code, trying to run, but nothing happends.

#include <GUIConstants.au3>
#include <Array.au3>
#include <WinAPI.au3>
#include "lib\Skype.au3"
#AutoIt3Wrapper_UseX64=n
$sUserHandle = "Wisenlucky"
_Skype_ChatCreateWith($sUserHandle)
Edited by Wisenlucky

Share this post


Link to post
Share on other sites

I added the Libraries to my code

:mellow: Those librairies have nothing to deal with the Skype UDF. You have not even included the UDF itself you want to use.

I let you correct your mistake by yourself. As I see you are a novice in programming languages, start some tutorials.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

I let you correct your mistake by yourself.

Thanks a lot. I don't imagine how I would live further without your permission.

Those librairies have nothing to deal with the Skype UDF. You have not even included the UDF itself you want to use.

Actually I did. Just made mistake posting not all the included UDF's. I included all the other UDF's as in your example script, as i wasn't sure - maybe Skype.au3 UDF uses some of them. This is the code (corrected the code above also)

#include <GUIConstants.au3>
#include <Array.au3>
#include <WinAPI.au3>
#include "lib\Skype.au3"

#AutoIt3Wrapper_UseX64=n

$sUserHandle = "Wisenlucky"
_Skype_ChatCreateWith($sUserHandle)

...start some tutorials.

I read your tutorials before posting. It didn't help. For example as I understand I need to create chat first , then send the message using these functions.

_Skype_ChatCreate($sUserHandle)

_Skype_ChatMessage($iChatId, $sMessage)

Nowhere in the manual I can find what's $sUserHandle and what's $iChatId.

Logic tells me $sUserHandle is the username or skype nickname. Neither of them works in the code above.

Second problem - nowhere in tutorial I can find how to get parameter ChatId.

Can any one give any advice regarding these parameters?

Edited by Wisenlucky

Share this post


Link to post
Share on other sites

Actually I did. Just made mistake posting not all the included UDF's. I included all the other UDF's as in your example script, as i wasn't sure

Ok my apologizes then.

There is indeed a bug in the UDF for the function _Skype_ChatCreate, but you can handle a chat using the object instead of the ID.

Here is how : (download the fixed version first to test with the ChatId)

#include "Skype.au3"

Local $iChatId, $oChat

;userhandle: account name of the user.

;using chat id:
$iChatId = _Skype_ChatCreate("userhandle")

_Skype_ChatMessage($iChatId, "test")

;using chat object:
$oChat = _Skype_ChatCreateWith("userhandle")

_Skype_ChatSendMessage($oChat, "test2")

Nowhere in the manual I can find what's $sUserHandle and what's $iChatId.

Logic tells me $sUserHandle is the username or skype nickname. Neither of them works in the code above.

Second problem - nowhere in tutorial I can find how to get parameter ChatId.

Read carefully what the function returns, if it's an object or an ID.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Read carefully what the function returns, if it's an object or an ID.

Uh. Now I think I got it! :sweating:

Works perfectly now. Thanks a lot for your UDF, help and such a quick bugfix! :thumbsup:

Edited by Wisenlucky

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

  • Similar Content

    • By Rhidlor
      So I'm trying to do some as400 automation and hit a wall when trying to get a COM object. The code on line 8 is failing, the as400.ws file opens with PCSWS.exe so I tried using that as the file path too but that didn't work either. Any and all help is greatly appreciated! 
       
      $file = "C:\Users\Rhidlor\Desktop\as400.ws" If Not FileExists($file) Then MsgBox(0, "Error", "Error finding file") Exit EndIf $object = ObjGet($file) If @error Then MsgBox(0, "Error", "Error getting object") Exit EndIf $object.SendKeys("05")  
    • By kurtykurtyboy
      GuiFlatButton is a UDF to easily create regular buttons with different colors for background, foreground, border, hover, focus, etc..
      This started as an effort to change the background color of a button and eventually grew into a full UDF.
      If you've looked around forums for changing button background colors, you have probably noticed that each proposed workaround has its own set of issues/side-effects. The answers usually circle back to 'use ownerdrawn buttons' and 'not worth it'. Well, now it is possible for anyone to easily create ownerdrawn buttons - totally worth it!
      Some issues with other workarounds such as drawing with GDI+ or using a colored label as a 'button':
      Not 'real' buttons so you lose built-in functionality that windows gives to buttons Messy / inefficient code in the main while loop to check for mouse position Slow to respond to click, paint, etc... Having to deal with GUIRegisterMsg messages Not straight-forward to implement GuiFlatButton is not a workaround; it is a technique to respond to Windows' built-in owner-drawn button events.
      With minimal effort, we can now create true simple colored buttons.
      The idea is to create an owner-drawn button using GUICtrlCreateButton then subclass the GUI and controls to handle the button-specific events to paint it however we want.
      This UDF magically does all of this for us! No need to worry about event handling or main while loop logic.
       
      How to use
      It couldn't be any easier! Simply create a new button using the familiar syntax. This creates an ownerdrawn button with default colors.
      $mybutton1 = GuiFlatButton_Create("Button 1", 78, 20, 120, 40) If you want to change the background and text colors:
      GuiFlatButton_SetBkColor(-1, 0x5555FF) GuiFlatButton_SetColor(-1, 0xFFFFFF) Advanced Usage
      Set background/text/border all at once
      GuiFlatButton_SetColors(-1, 0x0000FF, 0xFFFFFF, 0x9999FF) Set ALL colors for ALL button states! (normal, focus, hover, selected)
      Local $aColorsEx = [0x0000FF, 0xFFFFFF, -2, 0x4444FF, 0xFFFFFF, 0xAAAAFF, 0x6666FF, 0xFFFFFF, 0xCCCCFF, 0x0000EE, 0xFFFFFF, 0x7777EE] GuiFlatButton_SetColorsEx(-1, $aColorsEx) Set default colors to apply to any future buttons
      ;set colors GuiFlatButton_SetDefaultColors(0x0000FF, 0xFFFFFF, 0x9999FF) ;create buttons $mybutton1 = GuiFlatButton_Create("Button 1", 12, 20, 120, 40) $mybutton2 = GuiFlatButton_Create("Button 2", 143, 20, 120, 40) Set ALL color defaults
      ;set colors Local $aColorsEx = [0x0000FF, 0xFFFFFF, -2, 0x4444FF, 0xFFFFFF, 0xAAAAFF, 0x6666FF, 0xFFFFFF, 0xCCCCFF, 0x0000EE, 0xFFFFFF, 0x7777EE] GuiFlatButton_SetDefaultColorsEx($aColorsEx) ;create buttons $mybutton1 = GuiFlatButton_Create("Button 1", 12, 20, 120, 40) $mybutton2 = GuiFlatButton_Create("Button 2", 143, 20, 120, 40)  
      Available Functions
       
      Simple Example

      #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include "GuiFlatButton.au3" Example() ;GUI with one button Func Example() Local $hGUI, $mybutton1 $hGUI = GUICreate("GuiFlatButton Ex0", 275, 120) GUISetBkColor(0x333333) $idLabel = GUICtrlCreateLabel("Click the button", 10, 100, 150, 30) GUICtrlSetColor(-1, 0xFFFFFF) ;create new button then set the background and foreground colors $mybutton1 = GuiFlatButton_Create("Button 1", 78, 20, 120, 40) GuiFlatButton_SetBkColor(-1, 0x5555FF) GuiFlatButton_SetColor(-1, 0xFFFFFF) GUISetState(@SW_SHOW, $hGUI) Local $i = 0 Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $mybutton1 $i += 1 GUICtrlSetData($idLabel, $i) ConsoleWrite($i & @CRLF) EndSwitch Sleep(10) WEnd GUIDelete() EndFunc ;==>Example
      Menu/Toolbar Example

      #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include "GuiFlatButton.au3" Example() ;Example GUI with toolbar Func Example() Local $hGUI, $idLabel, $aButtons, $iTbSize $hGUI = GUICreate("GuiFlatButton Ex2", 300, 200) GUISetBkColor(0x444444) $idLabel = GUICtrlCreateLabel("Click a button", 10, 180, 150, 30) GUICtrlSetColor(-1, 0xFFFFFF) $aButtons = createToolbar() $iTbSize = UBound($aButtons) GUISetState(@SW_SHOW, $hGUI) Local $i = 0 Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $aButtons[0] To $aButtons[$iTbSize - 1] ConsoleWrite("1") GUICtrlSetData($idLabel, GuiFlatButton_Read($iMsg)) EndSwitch Sleep(10) WEnd GUIDelete() EndFunc ;==>Example Func createToolbar() Local $aButtons[6] Local $bkColor = 0x777777 Local $textColor = 0xFFFFFF Local $borderColor = 0x999999 Local $aBtnClrs[12] = [0x777777, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT, 0x888888, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT, 0x999999, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT, 0x666666, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT] For $i = 0 To UBound($aButtons) - 1 $aButtons[$i] = GuiFlatButton_Create("B" & $i, $i * 50, 0, 50, 17) GuiFlatButton_SetColorsEx($aButtons[$i], $aBtnClrs) Next Return $aButtons EndFunc ;==>createToolbar
      I'm sure there are some use-cases I've forgotten, so feedback is welcome!

      Update 2019-02-09
      Added 2 new functions to set the button colors globally for all future buttons.
      GuiFlatButton_SetDefaultColors 
      GuiFlatButton_SetDefaultColorsEx
      Download the UDF and several examples: GuiFlatButton.zip

      Credits to:
      Melba23 (UDF template)
      LarsJ (general subclassing code)
      4ggr35510n (TrackMouseEvent example)
      binhnx (disable dragging with $WS_EX_CONTROLPARENT)
      GUIRegisterMsg in AutoIt Help (owner-draw button example)
    • By HansHenrik
      here's some PHP code to access AutoIt functions from php: 
      https://github.com/divinity76/autoit_php -
       
      as of writing, only 5 functions are added: MouseMove and MouseClick and _ScreenCapture_Capture and WinWaitActive and Send,

      it also has support for running in Cygwin (which is where i've developed it, but it *should*, in theory, run on normal php-cli for windows as well.), is there any community interest for this? 
       
      example usage
      <?php require_once("autoit.class.php"); $au = new AutoIt(); $au->MouseMove(10, 10, 5); $au->MouseClick("left"); echo "waiting up to 5 seconds for notepad window.."; if($au->WinWaitActive("[CLASS:Notepad]","",5)){ echo "found notepad!\n"; $au->Send("hello from autoit_php"); }else{ echo "timed out while waiting for notepad.\n"; } $imageBinary = $au->_ScreenCapture_Capture(); var_dump(strlen($imageBinary), imagecreatefromstring($imageBinary));  

      (i wanted to use some autoit functions from php-cli, and google wasn't of much help this time..)
    • By Rhidlor
      I was wondering if there was a library or something which provides the capability to Send() to inactive windows, and I know what you're thinking, I could just use ControlSend(); the reason I can't use that in this situation is because I need to hold down keys for specific prolonged periods of time. Also activating the window, Send()ing then de-activating the window isn't really an option here, I need the target window to always be in the background. I've looked around the forums for an adequate amount of time and didn't find anything useful, perhaps because the threads were all 10 years old, nevertheless, if anyone has any suggestions they would be greatly appreciated.
      Thanks!
    • By MFrancisca
      Hello! 
      I've been checking the logging UDFs in the wiki, mostly Log4a and Loga and I wanted to ask which one would you recommend for a script that will be executed remotely through PSExec. My main question is where the logs are located in that situation and if I can change that location to a custom one., because I need to retrieve them at the end of execution.
      So in a rough description the process is
      Open PSExec
      Send compiled AutoIT script to remote machine
      Execute script
      Copy logs from the remote to the local machine.
       
      Any opinions? 
×
×
  • Create New...