Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

AutoIt Snippets


  • Please log in to reply
170 replies to this topic

#161 MikahS

MikahS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 372 posts

Posted 07 August 2014 - 06:25 PM

@JLogan3o13 currently trying to figure that out ;), but thank you for the kind words :)


My Snips: graphCPUTemp ~ getENVvars

My Scripts: Short-Order Encrypter ~ AuPad - Notepad written entirely in AutoIt

 

Feel free to use any of my code for your own use. (a comment would be nice though)








#162 JLogan3o13

JLogan3o13

    115 and holding

  • MVPs
  • 4,175 posts

Posted 07 August 2014 - 08:03 PM

No, problem. Something like this may point you in the right direction:

  1. $WMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\wmi")
  2. $aClasses = $WMI.SubclassesOf()
  3.  
  4.     For $class In $aClasses
  5.         If StringInStr($class.Path_.Path, "thermalzonetemp") Then ConsoleWrite($class.Path_.Path & @CRLF)
  6.     Next

Have you ever listened to someone for a while and found yourself wondering..."Who ties your shoes for you?!"

 

My Scripts:Include Source with Compiled Script, Disk Maintenance for Windows XP, "Deal-A-Day" Sites, Windows Firewall UDF


#163 MikahS

MikahS

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 372 posts

Posted 08 August 2014 - 06:08 PM

@JLogan3o13 That is exactly what I was looking for, thanks for the push :)

 

See my OP for update.


My Snips: graphCPUTemp ~ getENVvars

My Scripts: Short-Order Encrypter ~ AuPad - Notepad written entirely in AutoIt

 

Feel free to use any of my code for your own use. (a comment would be nice though)


#164 gil900

gil900

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 769 posts

Posted 15 August 2014 - 11:57 AM

Hello,
I wrote a function that detects whether a message is pure spam .
The function returns the correct answer in most cases.

AutoIt         
#include <Array.au3> $test = FileRead(@ScriptDir&"\test.txt") $Output = SpamDetector($test) ConsoleWrite($Output & @CRLF) ; 1 = Spam , 0 = No Spam Func SpamDetector($Text)     Local $Output = 0 , $tmp , $tmp2 , $tmp3 , $aTmp2[1][2] , $aTmp[1]     $aTmp[0] = 0     $aTmp2[0][0] = 0     $tmp = StringSplit($Text,@CRLF,1)     For $a = 1 To $tmp[0]         $tmp2 = StringSplit($tmp[$a]," ",1)         For $a2 = 1 To $tmp2[0]             If $tmp2[$a2] = "" Then ContinueLoop             $tmp3 = Array2DSearch($aTmp2,$tmp2[$a2],0)             If $tmp3 <= 0 Then                 $aTmp2[0][0] += 1                 ReDim $aTmp2[$aTmp2[0][0]+1][2]                 $aTmp2[$aTmp2[0][0]][0] = $tmp2[$a2]                 $aTmp2[$aTmp2[0][0]][1] = 1             Else                 $aTmp2[$tmp3][1] += 1             EndIf         Next     Next ;~  _ArrayDisplay($aTmp2)     $tmp = 0     For $a = 1 To $aTmp2[0][0]         If $aTmp2[$a][1] > 3 Or StringLen($aTmp2[$a][0]) > 10 Then $tmp += 1    ; Count all the words that written more than 3 times or with more then 10 characters     Next     If $tmp/$aTmp2[0][0] > 0.70 Then $Output = 1 ; If more then 70% words are written more than 3 times then this is means that the message is very likely spam     Return $Output EndFunc ; ________________________________________________________________________________________________________________________________________ Func Array2DSearch($aArray,$String,$Dimension,$StartIndex = 1,$EndIndex = "")     Local $Output = -1 , $a     ;If IsArray($aArray) Then     ;   Local $a         If $EndIndex = "" Then $EndIndex = UBound($aArray)-1         If $StartIndex >= 0 And $StartIndex <= $EndIndex Then             For $a = $StartIndex To $EndIndex                 If $aArray[$a][$Dimension] = $String Then                     $Output = $a                     ExitLoop                 EndIf             Next         EndIf     ;EndIf     Return $Output EndFunc

Edited by gil900, 15 August 2014 - 12:13 PM.

Please correct my English in this post. I want to learn how to write correctly in English


#165 JohnOne

JohnOne

    John

  • Active Members
  • PipPipPipPipPipPip
  • 12,599 posts

Posted 15 August 2014 - 01:08 PM

Do you know what spam means?


AutoIt Absolute Beginners Require a serial
 
 
OMG! Women are the cows of people.


#166 gil900

gil900

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 769 posts

Posted 15 August 2014 - 01:31 PM

When I say i "pure spam", I means to something like this:

 

blabla blabla blabla blabla blabla blabla blabla blabla blabla
Test Test Test Test Test Test Test Test Test Test Test
xxxxxxxxxxxxxxxxxxxxxxx

This is the kind of spam/text that my function can identify as a junk message.

 

but my function  can't identify a smart spam..

I mean, my function can not identify Message that speaks bullshit as junk message


Edited by gil900, 15 August 2014 - 01:38 PM.

Please correct my English in this post. I want to learn how to write correctly in English


#167 jchd

jchd

    Whatever your capacity, resistance is futile.

  • MVPs
  • 5,241 posts

Posted 15 August 2014 - 01:38 PM

Isn't this approach clearly inferior to the bayesian + keywords + other rules filter that comes with essentially every mail client?


SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!

SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)

An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.

 

SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.

 

PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

RegExp tutorial: enough to get started

Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.


#168 gil900

gil900

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 769 posts

Posted 15 August 2014 - 01:54 PM

Isn't this approach clearly inferior to the bayesian + keywords + other rules filter that comes with essentially every mail client?

I have not checked thoroughly my mail client..

 

But anyway, every message that sent to my client cost me place for another message..

I can get up to X messags per month.

So i want to block the ability to send the message in my program when the message is "spam" in order to save space for messages(that i can receive each month)

 

I hope you understand


Please correct my English in this post. I want to learn how to write correctly in English


#169 jchd

jchd

    Whatever your capacity, resistance is futile.

  • MVPs
  • 5,241 posts

Posted 15 August 2014 - 02:32 PM

I do understand: I receive an average of 650 messages a day and I heavily rely on spam filtering. I only have 1-2 false positives per month and no false negative in the last 10 years.


SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!

SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)

An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.

 

SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.

 

PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

RegExp tutorial: enough to get started

Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.


#170 ResNullius

ResNullius

    Drink Deep, or Taste Not the Pierian Spring

  • Active Members
  • PipPipPipPipPipPip
  • 1,034 posts

Posted 16 August 2014 - 12:34 AM

Simplified (?) version of a function originally posted by guinness @ http://www.autoitscript.com/forum/topic/139260-autoit-snippets/#entry1005153

Improvements (?): Does not require Date.au3 include and Date string can be passed with or without separators

ConsoleWrite(_IsDateOrAboveEx(@YEAR & "/" & @MON & '/' & @MDAY-3) & @CRLF) ; Returns False ConsoleWrite(_IsDateOrAboveEx(@YEAR & @MON & @MDAY+1) & @CRLF) ; Returns True Func _IsDateOrAboveEx($sDateString)     ;Check if a date is equal to/or has passed the current date.     ;Pass the string as YYYYMMDD, with or without separators e.g. 20140815 or 2014/08/15, or 2014-08-15, or 2014.08.15     ;Original concept by guinness http://www.autoitscript.com/forum/topic/139260-autoit-snippets/#entry1005153     Return Number(StringRegExpReplace($sDateString, "\D|$", "")) >= NUMBER(@YEAR & @MON & @MDAY) EndFunc

  • JScript likes this

#171 JScript

JScript

    I'm back ... I miss, why not!

  • Active Members
  • PipPipPipPipPipPip
  • 1,230 posts

Posted 07 September 2014 - 01:49 PM

@ResNullius

Yeah, sure, it makes more sense to me because I always thought the "snippets" should not have includes ...

I also noticed that here is a little slow, I posted several snippets that are still here: http://www.autoitscript.com/forum/index.php?app=core&module=search&do=search&fromMainBar=1

JS

Edited by JScript, 07 September 2014 - 01:51 PM.

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!       





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users