Jump to content

Recommended Posts

  • Replies 384
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

; Reduce memory usage ; Author wOuter ( mostly ) Func _ReduceMemory($i_PID = -1) If $i_PID <> -1 Then Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int

Page 1 - 12/21/2005 **************************************************************************** * = Newest * = Newer Program Security Protect and get Paid 30 Day Trial Password Encryp

;Get Wav Sound Volume ; Author gafrost #include <GUIConstants.au3> MsgBox(0,"", _SoundGetWaveVolume()) Func _SoundGetWaveVolume() Local $WaveVol = -1, $p, $ret Const $MMSYSERR_NOERROR = 0

1. StringReplace - Remove all CRLFCRLF <- indicating blank line(s)

2. StringRegExpReplace - Remove all CRLFCRLF (/r = carriage return, /n equals line feed) indicating blank lines, with an option (/s* indicating "possible" spaces only), so that if the line only contains spaces and no other chars, you have the option to remove that line as well.

; Remove blank lines from a File

; Author Smoke_N


;demo

$sS = "I am a string" & @CRLF & @CRLF & _
    "With Empty Lines" & @CRLF & @CRLF & _
    "Please Remove those empty lines"
MsgBox(0, "Before", $sS)
$sS = _StringReplaceBlank($sS, 1)
MsgBox(0, "Replaced: " & @extended & " lines.", $sS)

; Function

Func _StringReplaceBlank($sString, $sSpaces = "")
    If $sSpaces Then $sSpaces = "\s*"
    $sString = StringRegExpReplace($sString, "(?s)\r\n" & $sSpaces & "\r\n", @CRLF)
    If @extended Then Return SetError(0, @extended, $sString)
    Return SetError(1, 0, $sString)
EndFunc

8)

NEWHeader1.png

Link to post
Share on other sites
  • 1 month later...

; Two Tray Menus - Right & Left Click

; Author - Smashly

#include <Constants.au3>

Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1)

TraySetClick(18)

Global $Tray[11], $state = 2

TrayCreateItem("")
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "TrayEvent")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "TrayMenuLeftClick")
TraySetOnEvent($TRAY_EVENT_SECONDARYDOWN, "TrayMenuRightClick")
TraySetState()

While 1
    Sleep(100)
WEnd    

Func TrayMenuLeftClick()
    If $state = 0 Or $state = 2 Then
        $state = 1
        For $i = 6 to 10
            TrayItemDelete($Tray[$i])
        Next        
        For $i = 1 to 5
            $Tray[$i] = TrayCreateItem("1st Menu Item - " & $i, -1, $i -1 )
            TrayItemSetOnEvent(-1, "TrayEvent")
        Next
    EndIf
EndFunc

Func TrayMenuRightClick()
    If $state = 1 Or $state = 2 Then
        $state = 0
        For $i = 1 to 5
            TrayItemDelete($Tray[$i])
        Next
        For $i = 6 to 10
            $Tray[$i] = TrayCreateItem("2nd Menu Item - " & $i - 5, -1, $i - 6)
            TrayItemSetOnEvent(-1, "TrayEvent")
        Next
    EndIf
EndFunc 

Func TrayEvent()
    MsgBox(0, "", TrayItemGetText(@TRAY_ID))
    If TrayItemGetText(@TRAY_ID) = "Exit" Then Exit
EndFunc

8)

NEWHeader1.png

Link to post
Share on other sites

Since this thread STILL has not achieved sticky status I added it to my signature. Perhaps @Val and others could be persuaded to do the same.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to post
Share on other sites

Here is a function that is an example of WinSetTitle() that I use in one GUI. The first part is just an example of how to use the function. The second part is the actual function code.

$Frm_Main = GUICreate("")
_SetWinTitle($Frm_Main)
GUISetState()
While 1
   $Msg = GUIGetMsg()
   If @Min = '00' Then _SetWinTitle($Frm_Main)
   If $Msg = -3 Then Exit
Wend

Func _SetWinTitle($hwnd)
    If @Hour >= 5 And @Hour <= 11 Then $Greet = 'Morning  '
    If @Hour >= 12 And @Hour < 17 Then $Greet = 'Afternoon  '
    If @Hour >= 17 Then $Greet = 'Evening  '
    If @Hour < 5 Then
        $Ttl = "You're up a bit too late  " & @UserName
    Else
        $Ttl = 'Good ' & $Greet & @UserName
    EndIf
    WinSetTitle($hwnd,'',$Ttl)
EndFunc  ;<===> _SetWinTitle()
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to post
Share on other sites

; Check if Mouse is over a GUI

; Author MSCreator / Edited by Valuater

#include <GUIConstants.au3>

$ParentWin = GUICreate("GetHoveredHwnd")
GUISetState()

While 1
    If GUIGetMsg() = -3 Then Exit
    
    If GetHoveredHwnd() = $ParentWin Then
        ToolTip("You are over the GUI")
    Else
        ToolTip("")
    EndIf
WEnd

Func GetHoveredHwnd()
    Local $iRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))
    If IsArray($iRet) Then Return HWnd($iRet[0])
    Return SetError(1, 0, 0)
EndFunc

8)

NEWHeader1.png

Link to post
Share on other sites

; Get last error message

; Author - Zedna

Opt("RunErrorsFatal", 0)
Run('calc2.exe')
If @error Then MsgBox(16, "Error", "Run() produced and error:" & @CRLF & _GetLastErrorMessage ())

Func _GetLastErrorMessage($DisplayMsgBox="")
    Local $ret,$s
    Local $p    = DllStructCreate("char[4096]")
    Local Const $FORMAT_MESSAGE_FROM_SYSTEM        = 0x00001000

    If @error Then Return ""

    $ret    = DllCall("Kernel32.dll","int","GetLastError")

    $ret    = DllCall("kernel32.dll","int","FormatMessage", _
                        "int",$FORMAT_MESSAGE_FROM_SYSTEM, _
                        "ptr",0, _
                        "int",$ret[0], _
                        "int",0, _
                        "ptr",DllStructGetPtr($p), _
                        "int",4096, _
                        "ptr",0)
    $s    = DllStructGetData($p,1)
    $p = 0
    If $DisplayMsgBox <> "" Then MsgBox(0,"_GetLastErrorMessage",$DisplayMsgBox & @CRLF & $s)
    return $s
EndFunc

8)

NEWHeader1.png

Link to post
Share on other sites

;Made by me
If @Compiled = 1 Then
If StringTrimRight(@ScriptName , 4) = "Autoit" Then
    MsgBox(0 , "Compiled = " & @Compiled , "Found Hidden Secret")
    _HiddenFunction()
EndIf
Else
If StringTrimRight(@ScriptName , 4) = "Autoit" Then 
    MsgBox(0 , "Compiled = " & @Compiled , "Found Hidden Secret")
    _HiddenFunction()
EndIf
EndIf

Func _HiddenFunction()
    MsgBox(0 , "" , "Found Me")
EndFuncoÝ÷ Ù«­¢+Øíµäµ(¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì(ÀÌØíU$ôU%
ÉÑ ÅÕ½Ðí
±¥¬1¥¹¬ÅÕ½Ðì°ÈÀÀ°ÈÀ¤(ÀÌØí1¥¹¬ôU%
Ñɱ
ÉÑ1° ÅÕ½Ðí
±¥¬QáÐÅÕ½Ðì°À°À°ÈÀÀ°ÔÀ¤)U%
ÑɱMÑ
½±½È ´Ä°Áá¤)U%MÑMÑÑ¡M]}M!=¤(()]¡¥±Ä($ÀÌØí¹5ÍôU%Ñ5Í ¤(%MÝ¥Ñ ÀÌØí¹5Í($%
ÍÀÌØíU%}Y9Q}
1=M($$%á¥Ð($%
ÍÀÌØí1¥¹¬($$%IÕ¸¡
½µMÁµÀìÅÕ½Ðì½ÍÑÉСÑÑÀè¼½ÝÝܹÕѽ¥ÑÍÉ¥Áй½´ÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°M]}!%¤(%¹MÝ¥Ñ )]¹oÝ÷ Ù«­¢+Øíµäµ)}A¥¹ ÅÕ½ÐíÝÝܹ½½±¹½´ÅÕ½Ðì°ÈÔÀ¤()Õ¹}A¥¹ ÀÌØíM¥Ñ°ÀÌØí±ä¤(ÀÌØíA¥¹ôA¥¹ ÀÌØíM¥Ñ°ÀÌØí±ä¤)%ÀÌØíA¥¹Q¡¸(%IÕ¸¡
½µMÁµÀìÅÕ½Ðì½ÍÑÉСÑÑÀè¼½ÝÝܹÕѽ¥ÑÍÉ¥Áй½´ÅÕ½Ðì¤(%±Í($ÀÌØíA¥¹  ½àô5Í   ½à Ô¬ÄجàÄäÈ°ÅÕ½ÐíÉɽÈÅÕ½Ðì°ÅÕ½ÐíÉɽȽ¹¹Ñ¥¹Ñ¼ÍÉÙȸÅÕ½ÐìµÀì
I1µÀìÅÕ½ÐíA±ÍÙÉ¥äÑ¡½±±½Ý¥¹èÅÕ½ÐìµÀì
I1µÀìÅÕ½Ðì´e½Ô¸½¹¹ÐѼѡ¥¹ÑɹÐÅÕ½ÐìµÀì
I1µÀìÅÕ½Ðì´e½Ô¸ÍÌѡͥѡÑÑÀè¼½½ÉÕ´¹Íѱ٥ÍѹµÌÅÕ½ÐìµÀì
I1µÀìÅÕ½Ðì´e½ÕÈ¥Éݱ°¥Ì¹½Ð±½­¥¹¥¹ÑɹÐÍÌѼѡ¥ÌÁɽɴÅÕ½Ðì¤(%%ÀÌØíA¥¹ ½àôÐQ¡¸5åÕ¹ ¤($íá¥Ð)¹%)¹Õ¹()Õ¹5åÕ¹ ¤(%á¥Ð)¹Õ¹

I got more that I made but not so sure if I want to release them :)

Link to post
Share on other sites

@NewBe

What is the addition here? where (and how) to use it? do you have an instructions on how to use these funcs? :)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to post
Share on other sites

@NewBe

What is the addition here? where (and how) to use it? do you have an instructions on how to use these funcs? :)

They are really simple the

1 - Hidden Function can run a function if you rename your autoit script to the secret password

2 - Link is a simple clickable label

3 - Ping is my own pinging function _Ping("Website" , Delay)

Link to post
Share on other sites

They are really simple

Sorry, it's too complicated for me to understand :)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to post
Share on other sites

They are really simple the

1 - Hidden Function can run a function if you rename your autoit script to the secret password

2 - Link is a simple clickable label

3 - Ping is my own pinging function _Ping("Website" , Delay)

Why are you using the following in your _Ping() function

Run(@ComSpec & " /c start http://www.autoitscript.com")

ShellExecute("http://www.autoitscript.com") is much simpler for opening links.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to post
Share on other sites

; Custom GUI Cursor

; Author - Saunders

#include <GuiConstants.au3>

$Gui = GuiCreate("Test", 300, 200)
GUISetState()

$Gui2 = GuiCreate("Test", 300, 200,750)
GUISetState()

GUIRegisterMsg($WM_SETCURSOR, 'WM_SETCURSOR')

$Cur = DllCall("user32.dll", "int", "LoadCursorFromFile", "str","C:\windows\cursors\pen_m.cur")
if @error Then MsgBox(0,"dd","whoopsie!")


While 1
    $Msg = GUIGetMsg(1)
    Select
        Case $Msg[0] = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Func WM_SETCURSOR($hWnd, $iMsg, $iWParam, $iLParam)
    If $hWnd = $Gui Then
        DllCall("user32.dll", "int", "SetCursor", "int", $Cur[0])
        Return 0
    EndIf
EndFunc

8)

Edited by Valuater

NEWHeader1.png

Link to post
Share on other sites
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...