-
Posts
707 -
Joined
-
Last visited
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by Squirrely1
-
Englarge an Edit control's Undo queue - Solved
Squirrely1 replied to Squirrely1's topic in AutoIt General Help and Support
jdelaney, Thank-you for your help. kylomas, Thank-you. -
Englarge an Edit control's Undo queue - Solved
Squirrely1 replied to Squirrely1's topic in AutoIt General Help and Support
Maybe what I'm asking for look too much looking like a vicious key-logger. -
I would be thankful for any scripts that can enlarge the undo queue Or any good idea for a strategy for implementing undo's and redo's. I found this script on the web but I do use AutoIt3 ... case WM_CHAR: switch (wParam) { case 0x08: // Process a backspace. break; case 0x0A: // Process a linefeed. break; case 0x1B: // Process an escape. break; case 0x09: // Process a tab. break; case 0x0D: // Process a carriage return. break; default: // Process displayable characters. break; } It seems so far that this is a kind of a difficult project.
-
Very Small Function ::: _Ash_UserKey_Detect
Squirrely1 replied to Ashalshaikh's topic in AutoIt Example Scripts
Ashalshaikh - Thank you very much: you have succeeded completely in communicating what the function does. I have not discovered why anyone should write to this key or read from it except to clean out the registry of unnecessary clutter. Probably you should use a key under HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE instead. -
Netherlands - You know you really probably should write your code in the selfsame language from beginning to end - "Not AutoIt" is probably a language that does not use "$" to designate a variable - what language are you trying to use?
-
Very Small Function ::: _Ash_UserKey_Detect
Squirrely1 replied to Ashalshaikh's topic in AutoIt Example Scripts
Ashalshaikh - Please describe for me more perspicaciously exactly what this function has purpose to do - use any modern language. -
For locations within the United States, a five-digit zipcode works best. But London, United Kingdom worked for me. For Düsseldorf, Germany - Use English letters... Dusseldorf, Germany For Hamburg, Federal Republic of Germany (Bundesrepublik Deutschland) - use "Hamburg, Germany" For city names of more than one word, like Tel Aviv, you can maybe go to http://www.weather.com and get the city code from the url "ISXX0026" and edit the ini file. I guess the script could use some work. Thanks for the feedback guys.
-
picea892 - type this in... Timmins, Canada If that doesn't work, type in just the name of a larger city or town nearby - if a dialog with a dropdown box comes up, use it to choose which Portland to use, Portland, Oregon or Portland, Maine. Then click on Refresh Weather Data. You can click anywhere on that MSN window to close it.
-
Here is a script I started working on about 2 1/2 years ago. A compiled version has survived some rigorous testing - but the script will probably not work in some countries due to the extended ASCII character problem found in another thread on the topic of googleweather (written by nobbe I think). Included within the .zip file, the image file should be unzipped to the same folder, the two includes files _IniFile.au3 and _ConnectSq.au3 go in your "includes library" else you should just put all four files in the same folder and change lines 103 & 104 within WeatherTraySq.au3 from... #include <_IniFile.au3> #include <_ConnectSq.au3> to... #include "_IniFile.au3" #include "_ConnectSq.au3" The Stuff: Enjoy the spring weather while it lasts!
-
MagnumXL You should post more of your code for a question like this, but perhaps just as helpful is taking more time to explain what your code is supposed to do. This looks strange - Send($s_vendor) And why are you using _GUICtrlComboBox_SetEditSel ?
-
Here is something I wrote about 4 months ago - since then JdeB or Jos or someone came up with a probably better version - but this has worked for me... ;#include <INet.au3> _SendMail("mailhost.worldnet.att.net", "Squirrel <[email protected]>", _ "Nut-gatherer <[email protected]>", "Sq Biz", "", "", "C:\sqMail.htm") ; #FUNCTION# ======================================================================================= ; Name...........: _SendMail ; Description....: Calls the appropriate loop function, depending on the value of $_SS_Mode ; Syntax.........: ; ; _SendMail($sSmtpServer, $sToAddress, $sFromAddress, $sSubject, $sPlainTextBody, $sHtmlBody, $sLocalMhtmlFilepath, $sAttachmentFilepath, $sCarboncopyAddress, $sBlindCC ) ; ; Parameters.....: $sSmtpServer - "my.outgoing.smtp.server" ; $sToAddress - "Manadar <[email protected]>" ; $sFromAddress - "Squirrely1 <[email protected]>" ; $sSubject - Email's subject line - can contain no @CR's ; $sPlainTextBody - plain text as the body of the email ; $sHtmlBody - Html string as the body of the email - can contain @CRLF's ; $sLocalMhtmlFilepath - Mhtml file as the body of the email ; $sAttachmentFilepath - Attachments: "\\server\filefolder\FTPlog.TXT" or local file shortnamed ; $sCarboncopyAddress - CC's ; $sBlindCC - BCC's ; ; Return values .: (None.) ; ; Author.........: Lewis Roberts, Squirrely1 ; Modified.......: ; Remarks........: If youre sending the same message to more than one person, separate email ; address strings with commas in $sToAddress. ; ; Related........: _SS_SetTestLoopFunc, _SS_SetConfigLoopFunc, _SS_SetInstallLoopFunc, _SS_GUICreate, __TimeInTicksOf_LastUserInput . ; Link...........; http://www.lewisroberts.com/2006/06/09/sending-cdomessage-with-importance/ ; Example........; ; Reference......; INet.au3 ;=================================================================================================== Func _SendMail($sSmtpServer, $sToAddress, $sFromAddress = "", $sSubject = "", _ $sPlainTextBody = "", $sHtmlBody = "", $sLocalMhtmlFilepath = "", _ $sAttachmentFilepath = "", $sCarboncopyAddress = "", $sBlindCC = "") Local $objMail, $cdoConf, $sMhtmlFile, $sch $objMail = ObjCreate("CDO.Message") If @error Then Return SetError(1, 0, 0) $cdoConf = ObjCreate("CDO.Configuration") If @error Then Return SetError(1, 0, 0) With $objMail .From = $sFromAddress .To = $sToAddress .Subject = $sSubject Select Case StringLen($sPlainTextBody) .TextBody = $sPlainTextBody Case StringLen($sHtmlBody) .HTMLBody = $sHtmlBody; = "<h1>This is a message.</h1>" Case StringLen($sLocalMhtmlFilepath) If FileExists($sLocalMhtmlFilepath) Then; ; $sMhtmlFile = "file://" & StringLower(StringReplace(_INetExplorerCapable($sLocalMhtmlFilepath), "\", "/")) $sMhtmlFile = "file://" & StringLower(StringReplace($sLocalMhtmlFilepath, "\", "/")) ConsoleWrite(@CR & $sMhtmlFile & @CR) ;.CreateMHTMLBody "file://c:/mydocuments/test.htm" ... .CreateMHTMLBody($sMhtmlFile); Send an mhtml file as the body. EndIf EndSelect If StringLen($sAttachmentFilepath) Then .AddAttachment($sAttachmentFilepath) EndIf If StringLen($sCarboncopyAddress) Then .CC = $sCarboncopyAddress EndIf If StringLen($sBlindCC) Then .Bcc = $sBlindCC EndIf ;ConsoleWrite(@CR & .TextBody & @CR) ;ConsoleWrite(@CR & .HTMLBody & @CR) ;ConsoleWrite(@CR & .From & @CR) ;ConsoleWrite(@CR & .To & @CR) ;ConsoleWrite(@CR & .Subject & @CR) ; .AddAttachment("c:\mydocuments\test.txt") ; .CreateMHTMLBody("file://c:/mydocuments/test.htm"); Send an email as the body. ; EndWith $sch = "http://schemas.microsoft.com/cdo/configuration/" $cdoConf.Fields.Item($sch & "sendusing") = 2 ; $cdoConf.Fields.Item($sch & "smtpconnectiontimeout") = 480; 8 minutes? ; $cdoConf.Fields.Item($sch & "smtptimeout") = 480; 8 minutes? $cdoConf.Fields.Item($sch & "smtpserver") = $sSmtpServer; "mailhost.worldnet.att.net"; "my.outgoing.smtp.server" $cdoConf.Fields.Item($sch & "smtpserverport") = 25 $cdoConf.Fields.Item($sch & "smtpauthenticate") = 0 $cdoConf.Fields.Update $objMail.Configuration = $cdoConf $objMail.Fields.Item("urn:schemas:mailheader:X-MSMail-Priority") = "High"; For Outlook 2003. $objMail.Fields.Item("urn:schemas:mailheader:X-Priority") = 2; For Outlook 2003. $objMail.Fields.Item("urn:schemas:httpmail:importance") = 2; For Outlook Express. $objMail.Fields.Update $objMail.Send; Send the email. Sleep(220) $objMail = 0; Clean-up the mail objects ... $cdoConf = 0 Sleep(380) EndFunc
-
I noticed an internal function in the UDF called _ICL_SaveIconGroup Are you thinking of writing a function that can create .icl files ProgAndy?
-
I haven't tested this, but in the call to _XMLFileOpen he should maybe pass a version number as the second parameter...$objDoc = _XMLFileOpen($infile, 3) It seems like the latest parser should be able to read these characters - if not, I think there is a international government conspiracy at work to prevent it because I am a congenital conspiracy theorist.
-
rejeshontheweb - Try the _LocalSystem_IsInet_Connected function within _ConnectSq.au3 - look below in the signature of this post. After some research, I decided that the WinInet function it calls is the most reliable way to check for a connection brcause some workstations don't allow an out-going Ping. :pinch:
-
WinINet.au3 (FTP/HTTP/HTTPS/Gopher+)
Squirrely1 replied to -Ultima-'s topic in AutoIt Example Scripts
Good work Ultima ! I'm just a scripter, so I had use for these simple functions which use somewhat modified versions of four of your WinInet UDF's ... ; Squirrely1 Functions: ; ; _ActiveInetConnection_IsLAN ; _ActiveInetConnection_IsDialup ; _ActiveInetConnection_IsThroughProxy ; _Dial_DefaultRASConnection ; _Disconnect_Dialup_Connection ; _Get_DefaultINetConnection_Name ; _IsSysConfiguredForDialup ; _LocalSystem_IsInet_Connected ; _Open_NetworkConnections_Folder - contains some new syntax and different set of tests -
Clicking things in a Window that is minimized
Squirrely1 replied to bundyxc's topic in AutoIt General Help and Support
If I thought you wanted to do things in a flash object of a minimized window in order to write a game cheat, I wouldn't tell you that I think it is not possible to do this from within AutoIt. -
I might have messed something up here. I didn't read the OP's post number 5, and only tried to solve the one described in post number 1. This must be the code he actually needs ... #Include <Misc.au3> Global Const $_AUTOIT_WIN_TITLE = "Unique string uiop_asdf" Global $_sole_instance $_sole_instance = _Singleton("Another unique string", 1); Returns 0 if another instance found. If Not $_sole_instance Then $i_msgRet = MsgBox(262144+32+2, "MyApp", _ 'An instance of this program is already running. ' _ & @CR & 'Click "Abort" to exit this instance, Retry to' _ & @CR & 'exit the previous instance, or Ignore for neither.') Switch $i_msgRet Case 5; "Aborting" CleanupThisInstance() Exit Case 4; "Retrying" CleanupPreviousInstance() WinClose($_AUTOIT_WIN_TITLE) EndSwitch EndIf ; Stamp this instance only now - only after any previous instance is closed. AutoItWinSetTitle($_AUTOIT_WIN_TITLE) Func CleanupPreviousInstance() ; Code to cleanup before exiting PREVIOUS instance goes here. EndFunc Func CleanupThisInstance() ; Code to cleanup before exiting THIS instance goes here. EndFunc
-
I had the same kind of need the OP has when I was writing a screensaver - how to close the previous instance. james3mg had a solution... Global Const $_AUTOIT_WIN_TITLE = "My unique string #qwertyuiopasdf" If WinExists($_AUTOIT_WIN_TITLE) Then $i_RetVal = MsgBox(262144+32+3, "MyApp", _ "An instance of this program is already " _ & @CR & "running. Exit the previous instance?") If $i_RetVal = 6 Then ; Close only the last instance, not the current one ... WinClose($_AUTOIT_WIN_TITLE) EndIf EndIf ; Stamp this instance only now - only after the previous instance is closed. AutoItWinSetTitle($_AUTOIT_WIN_TITLE) I had thought at first that this issue might involve the use of the _Singleton function, but this is only a somewhat similar situation. _Singleton is instead used to keep a second instance from ever starting by closing any second instance as soon as it begins.
-
Since I wanted a solution to the OP's problem and I found one, I hereby resurrect this thread. Backup the file before running it; but you can save it as "âÛ ÅÓ@.au3" and even compile it and it should work. _SelfDelete(1, @ScriptDir) If @error Then MsgBox(0, "_SelfDelete", "The function failed.") Else Exit EndIf ;============================================================================== ; Name...........: _SelfDelete ; Description....: Deletes the currently running script. ; Syntax.........: ; _SelfDelete([ $iDelay = 1 [, $sTempDir = @TempDir ]]) ; ; Parameters.....: $iDelay - The wait in seconds, before attempting the deletion (default = 1). ; $sTempDir - path of the folder to put the batch file (default = @TempDir). ; ; Return values..: Success: 1; @error = 0 ; Failure: 0; @error = 1 ; ; Author.........: MHz ; Modified.......: Squirrely1 ; ; This version of the function works even if @ScriptFullPath contains characters NOT found in ; the English language, such as "Eichhörnchenfamilie Geschäft.exe", "Merkwürdig.au3", ; "Divný.au3", "âÛ ÅÓ@.exe", "Afæë 8Sq.scr", "âÛ ÅÓ@.au3" ... ; ; Be sure to Exit soon after calling this function. ; ; To wait the actual $iDelay, in the ping command 1 is now added to $iDelay. ; ; The default $iDelay was changed to 1 second. ; ; The second parameter was added. ; ; Remarks........: IMPORTANT: Make a copy of the file in @ScriptFullPath before running this function. ; Related........: ; Link...........; ; Example........; ; ; _SelfDelete(1, @ScriptDir) ; If @error Then ; MsgBox(0, "_SelfDelete", "The function failed.") ; Else ; Exit ; EndIf ; ;============================================================================== Func _SelfDelete($iDelay = 1, $sTempDir = @TempDir) Local Const $_DEL_FILE = FileGetShortName(@ScriptFullPath) If StringInStr($_DEL_FILE, " ") Then Return SetError(1, 0, 0) Local Const $_DEL_FILE_DIR = StringLeft($_DEL_FILE, StringInStr($_DEL_FILE, "\", 0, -1) - 1) If StringRight($sTempDir, 1) = "\" Then $sTempDir = StringTrimRight($sTempDir, 1) Local Const $_COMMANDS = 'ping -n ' & String($iDelay + 1) & ' 127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del ' & $_DEL_FILE & ' > nul' & @CRLF _ & 'ping -n 2 127.0.0.1 > nul' & @CRLF _ & 'if exist ' & $_DEL_FILE & ' goto loop' & @CRLF _ & 'del "' & $sTempDir & '\scratch.bat' & '"' Local Const $_H_BATCH_TEMP = FileOpen($sTempDir & '\scratch.bat', 2) Sleep(180) If (Number($_H_BATCH_TEMP) = -1) Then Return SetError(1, 0, 0) Local Const $_RET_CODE = FileWrite($_H_BATCH_TEMP, $_COMMANDS) If ($_RET_CODE = 0) Then Return SetError(1, 0, 0) Sleep(180) FileClose($_H_BATCH_TEMP) Sleep(1800) Run($sTempDir & '\scratch.bat', "", @SW_HIDE) If @error Then Return SetError(1, 0, 0) Return SetError(0, 0, 1) EndFunc Edit 1: Commented-line edited in the code.
-
I was careful not to mess with anything that didn't need work. I documented the few lines of code I changed - only 9 - carefully. I worked only on these functions: _Timer_SetTimer - changed 3 lines of code _Timer_KillTimer - changed 3 lines of code _Timer_KillAllTimers - changed 3 lines of code Fixed: _Timer_KillTimer setting its return value incorrectly. Fixed: _Timer_KillTimer not using window handles correctly. Fixed: _Timer_KillTimer not updating the array to reflect that a timer had been killed. Fixed: _Timer_KillAllTimers setting its return value incorrectly. Fixed: _Timer_KillAllTimers not using window handles correctly. Fixed: _Timer_SetTimer not using window handles correctly - so it could not re-use timers. I didn't have much hope for fixing that last one at first - but in consideration that I had already uncovered the same basic problem which the rest of the script had - that Microsoft had this documentation exactly and precisely backwards: ...it only took a few minutes to fix. Well, here's the working version of Timers.au3 - slightly modified by Squirrely1: #include-once ; #INDEX# ========================================================================= ; Title .........: Timers ; AutoIt Version: 3.2.3++ ; Language: English ; Description ...: An application uses a timer to schedule an event for a window after a specified time has elapsed. ; Each time the specified interval (or time-out value) for a timer elapses, the system notifies the window ; associated with the timer. Because a timer's accuracy depends on the system clock rate and how often the ; application retrieves messages from the message queue, the time-out value is only approximate. ; Author ........: Gary Frost ; ================================================================================= ; #VARIABLES# ===================================================================== Global $_Timers_aTimerIDs[1][3] ; ================================================================================= ; ================================================================================= ; #CURRENT# ======================================================================= ;_Timer_Diff ;_Timer_GetIdleTime ;_Timer_GetTimerID ;_Timer_Init ;_Timer_KillAllTimers ;_Timer_KillTimer ;_Timer_SetTimer ; ================================================================================= ; #INTERNAL_USE_ONLY#============================================================== ;_Timer_QueryPerformanceCounter ;_Timer_QueryPerformanceFrequency ; ================================================================================= ; #FUNCTION# ====================================================================== ; Name...........: _Timer_Diff ; Description ...: Returns the difference in time from a previous call to _Timer_Init ; Syntax.........: _Timer_Diff($iTimeStamp) ; Parameters ....: $iTimeStamp - Timestamp returned from a previous call to _Timer_Init(). ; Return values .: Success - Returns the time difference (in milliseconds) from a previous call to _Timer_Init(). ; Author ........: Gary Frost, original by Toady ; Modified.......: ; Remarks .......: ; Related .......: _Timer_Diff ; Link ..........; ; Example .......; Yes ; ================================================================================= Func _Timer_Diff($iTimeStamp) Return 1000 * (_Timer_QueryPerformanceCounter() - $iTimeStamp) / _Timer_QueryPerformanceFrequency() EndFunc ;==>_Timer_Diff ; #FUNCTION#;====================================================================== ; Name...........: _Timer_GetIdleTime ; Description ...: Returns the number of ticks since last user activity (i.e. KYBD/Mouse) ; Syntax.........: _Timer_GetIdleTime() ; Parameters ....: None ; Return values .: Success - integer ticks since last (approx. milliseconds) since last activity ; Failure - Sets @extended = 1 if rollover occurs (see remarks) ; Author ........: PsaltyDS at http://www.autoitscript.com/forum ; Modified.......: ; Remarks .......: The current ticks since last system restart will roll over to 0 every 50 days or so, ; which makes it possible for last user activity to be before the rollover, but run time ; of this function to be after the rollover. If this happens, @extended = 1 and the ; returned value is ticks since rollover occured. ; Related .......: ; Link ..........; ; Example .......; Yes ;;========================================================================================== Func _Timer_GetIdleTime() ; Get ticks at last activity Local $tStruct = DllStructCreate("uint;dword"); DllStructSetData($tStruct, 1, DllStructGetSize($tStruct)); DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($tStruct)) ; Get current ticks since last restart Local $avTicks = DllCall("Kernel32.dll", "int", "GetTickCount") ; Return time since last activity, in ticks (approx milliseconds) Local $iDiff = $avTicks[0] - DllStructGetData($tStruct, 2) If $iDiff >= 0 Then ; Normal return Return $iDiff Else ; Rollover of ticks counter has occured Return SetError(0, 1, $avTicks[0]) EndIf EndFunc ;==>_Timer_GetIdleTime ; #FUNCTION# =============================================================================== ; Name...........: _Timer_GetTimerID ; Description ...: Returns the Timer ID from $iwParam ; Syntax.........: _Timer_GetTimerID($iwParam) ; Parameters ....: $iwParam - Specifies the timer identifier event. ; Return values .: Success - The Timer ID ; Failure - 0 ; Author ........: Gary Frost ; Modified.......: ; Remarks .......: ; Related .......: _Timer_SetTimer ; Link ..........; ; Example .......; Yes ; ========================================================================================== Func _Timer_GetTimerID($iwParam) Local $_iTimerID = Dec(Hex($iwParam, 8)), $iMax = UBound($_Timers_aTimerIDs) - 1 For $x = 1 To $iMax If $_iTimerID = $_Timers_aTimerIDs[$x][1] Then Return $_Timers_aTimerIDs[$x][0] Next Return 0 EndFunc ;==>_Timer_GetTimerID ; #FUNCTION# =============================================================================== ; Name...........: _Timer_Init ; Description ...: Returns a timestamp (in milliseconds). ; Syntax.........: _Timer_Init() ; Parameters ....: ; Return values .: Success - Returns a timestamp number (in milliseconds). ; Author ........: Gary Frost, original by Toady ; Modified.......: ; Remarks .......: ; Related .......: _Timer_Diff ; Link ..........; ; Example .......; Yes ; ========================================================================================== Func _Timer_Init() Return _Timer_QueryPerformanceCounter() EndFunc ;==>_Timer_Init ; #FUNCTION# =============================================================================== ; Name...........: _Timer_KillAllTimers ; Description ...: Destroys all the timers ; Syntax.........: _Timer_KillAllTimers($hWnd) ; Parameters ....: $hWnd - Handle to the window associated with the timers. ; |This value must be the same as the hWnd value passed to the _Timer_SetTimer function that created the timer ; Return values .: Success - True ; Failure - False ; Author ........: Gary Frost ; Modified.......: Squirrely1 ; Remarks .......: The _Timer_KillAllTimers function does not remove WM_TIMER messages already posted to the message queue ; Related .......: _Timer_KillTimer, _Timer_SetTimer ; Link ..........; ; Example .......; Yes ; ========================================================================================== Func _Timer_KillAllTimers($hWnd) Local $iResult, $hCallBack = 0, $iNumTimers = $_Timers_aTimerIDs[0][0] If $iNumTimers Then For $x = $iNumTimers To 1 Step -1 ; If Not IsHWnd($hWnd) Then; line is wrong - Squirrely1 If IsHWnd($hWnd) Then; line is fixed - The Microsoft documentation has this backwards. - Squirrely1 $iResult = DllCall("user32.dll", "int", "KillTimer", "hwnd", $hWnd, "int", $_Timers_aTimerIDs[$x][1]) Else $iResult = DllCall("user32.dll", "int", "KillTimer", "hwnd", $hWnd, "int", $_Timers_aTimerIDs[$x][0]) EndIf ; If @error Then Return SetError(-1, -1, False); line could use work. - Squirrely1 If @error Or ($iResult[0] = 0) Then Return SetError(-1, -1, False);line worked on. - Squirrely1 $hCallBack = $_Timers_aTimerIDs[$x][2] If $hCallBack <> 0 Then DllCallbackFree($hCallBack) $_Timers_aTimerIDs[0][0] -= 1 Next ReDim $_Timers_aTimerIDs[1][3] Else Return False EndIf ; Return $iResult <> 0; line is wrong - Squirrely1 Return $iResult[0] <> 0; line fixed - Squirrely1 EndFunc ;==>_Timer_KillAllTimers ; #FUNCTION# =============================================================================== ; Name...........: _Timer_KillTimer ; Description ...: Destroys the specified timer ; Syntax.........: _Timer_KillTimer($hWnd, $iTimerID) ; Parameters ....: $hWnd - Handle to the window associated with the specified timer. ; |This value must be the same as the hWnd value passed to the _Timer_SetTimer function that created the timer ; $iTimerID - Specifies the timer to be destroyed ; Return values .: Success - True ; Failure - False ; Author ........: Gary Frost ; Modified.......: Squirrely1 ; Remarks .......: The _Timer_KillTimer function does not remove WM_TIMER messages already posted to the message queue ; Related .......: _Timer_KillAllTimers, _Timer_SetTimer ; Link ..........; @@MsdnLink@@ KillTimer ; Example .......; Yes ; ========================================================================================== Func _Timer_KillTimer($hWnd, $iTimerID) Local $iResult[1] = [0], $hCallBack = 0, $iUBound = UBound($_Timers_aTimerIDs) - 1 For $x = 1 To $iUBound If $_Timers_aTimerIDs[$x][0] = $iTimerID Then ; If Not IsHWnd($hWnd) Then; line is wrong - Squirrely1 If IsHWnd($hWnd) Then; line is fixed. - The Microsoft documentation has this backwards. - Squirrely1 $iResult = DllCall("user32.dll", "int", "KillTimer", "hwnd", $hWnd, "int", $_Timers_aTimerIDs[$x][1]) Else $iResult = DllCall("user32.dll", "int", "KillTimer", "hwnd", $hWnd, "int", $_Timers_aTimerIDs[$x][0]) EndIf If @error Or ($iResult[0] = 0) Then Return SetError(-1, -1, False); line was worked on - Squirrely1 ; If @error Then Return SetError(-1, -1, False); line could use some work - Squirrely1 $hCallBack = $_Timers_aTimerIDs[$x][2] If $hCallBack <> 0 Then DllCallbackFree($hCallBack) For $i = $x To $iUBound - 1 $_Timers_aTimerIDs[$i][0] = $_Timers_aTimerIDs[$i + 1][0] $_Timers_aTimerIDs[$i][1] = $_Timers_aTimerIDs[$i + 1][1] $_Timers_aTimerIDs[$i][2] = $_Timers_aTimerIDs[$i + 1][2] Next ; ReDim $_Timers_aTimerIDs[UBound($_Timers_aTimerIDs)][3]; line need fixing - Squirrely1 ReDim $_Timers_aTimerIDs[UBound($_Timers_aTimerIDs) - 1][3]; line fixed - Squirrely1 $_Timers_aTimerIDs[0][0] -= 1 ExitLoop EndIf Next Return $iResult[0] <> 0 EndFunc ;==>_Timer_KillTimer ; #INTERNAL_USE_ONLY#======================================================================= ; Name...........: _Timer_QueryPerformanceCounter ; Description ...: Retrieves the current value of the high-resolution performance counter ; Syntax.........: _Timer_QueryPerformanceCounter() ; Parameters ....: ; Return values .: Success - Current performance-counter value, in counts ; Failure - -1 ; Author ........: Gary Frost ; Modified.......: ; Remarks .......: ; Related .......: _Timer_QueryPerformanceFrequency ; Link ..........; @@MsdnLink@@ QueryPerformanceCounter ; Example .......; ; ========================================================================================== Func _Timer_QueryPerformanceCounter() Local $tperf = DllStructCreate("int64") DllCall("kernel32.dll", "int", "QueryPerformanceCounter", "ptr", DllStructGetPtr($tperf)) If @error Then Return SetError(-1, -1, -1) Return DllStructGetData($tperf, 1) EndFunc ;==>_Timer_QueryPerformanceCounter ; #INTERNAL_USE_ONLY#======================================================================= ; Name...........: _Timer_QueryPerformanceFrequency ; Description ...: Retrieves the current value of the high-resolution performance counter ; Syntax.........: _Timer_QueryPerformanceFrequency() ; Parameters ....: ; Return values .: Success - Current performance-counter frequency, in counts per second ; Failure - 0 ; Author ........: Gary Frost ; Modified.......: ; Remarks .......: If the installed hardware does not support a high-resolution performance counter, the return can be zero. ; Related .......: _Timer_QueryPerformanceCounter ; Link ..........; @@MsdnLink@@ QueryPerformanceCounter ; Example .......; ; ========================================================================================== Func _Timer_QueryPerformanceFrequency() Local $tperf = DllStructCreate("int64") DllCall("kernel32.dll", "int", "QueryPerformanceFrequency", "ptr", DllStructGetPtr($tperf)) If @error Then Return SetError(-1, -1, 0) Return DllStructGetData($tperf, 1) EndFunc ;==>_Timer_QueryPerformanceFrequency ; #FUNCTION# =============================================================================== ; Name...........: _Timer_SetTimer ; Description ...: Creates a timer with the specified time-out value ; Syntax.........: _Timer_SetTimer($hWnd[, $iElapse = 250[, $sTimerFunc = ""[, $iTimerID = -1]]]) ; Parameters ....: $hWnd - Handle to the window to be associated with the timer. ; |This window must be owned by the calling thread ; $iElapse - Specifies the time-out value, in milliseconds ; $sTimerFunc - Function name to be notified when the time-out value elapses ; $iTimerID - Specifies a timer identifier. ; |If $iTimerID = -1 then a new timer is created ; |If $iTimerID matches an existing timer then the timer is replaced ; |If $iTimerID = -1 and $sTimerFunc = "" then timer will use WM_TIMER events ; Return values .: Success - Integer identifying the new timer ; Failure - 0 ; Author ........: Gary Frost ; Modified.......: Squirrely1 ; Remarks .......: ; Related .......: _Timer_KillTimer, _Timer_KillAllTimers, _Timer_GetTimerID ; Link ..........; @@MsdnLink@@ SetTimer ; Example .......; Yes ; ========================================================================================== Func _Timer_SetTimer($hWnd, $iElapse = 250, $sTimerFunc = "", $iTimerID = -1) Local $iResult[1], $pTimerFunc = 0, $hCallBack = 0, $iIndex = $_Timers_aTimerIDs[0][0] + 1 If $iTimerID = -1 Then ; create a new timer ReDim $_Timers_aTimerIDs[$iIndex + 1][3] $_Timers_aTimerIDs[0][0] = $iIndex $iTimerID = $iIndex + 1000 For $x = 1 To $iIndex If $_Timers_aTimerIDs[$x][0] = $iTimerID Then $iTimerID = $iTimerID + 1 $x = 0 EndIf Next If $sTimerFunc <> "" Then ; using callbacks, if $sTimerFunc = "" then using WM_TIMER events $hCallBack = DllCallbackRegister($sTimerFunc, "none", "hwnd;int;int;dword") If $hCallBack = 0 Then Return SetError(-1, -1, 0) $pTimerFunc = DllCallbackGetPtr($hCallBack) If $pTimerFunc = 0 Then Return SetError(-1, -1, 0) EndIf $iResult = DllCall("user32.dll", "int", "SetTimer", "hwnd", $hWnd, "int", $iTimerID, "int", $iElapse, "ptr", $pTimerFunc) If @error Or ($iResult[0] = 0) Then Return SetError(-1, -1, 0); line worked on - Squirrely1 ; If @error Then Return SetError(-1, -1, 0); line that could use the work - Squirrely1 $_Timers_aTimerIDs[$iIndex][0] = $iResult[0] ; integer identifier $_Timers_aTimerIDs[$iIndex][1] = $iTimerID ; timer id $_Timers_aTimerIDs[$iIndex][2] = $hCallBack ; callback identifier, need this for the Kill Timer Else ; reuse timer For $x = 1 To $iIndex - 1 If $_Timers_aTimerIDs[$x][0] = $iTimerID Then If IsHWnd($hWnd) Then $iTimerID = $_Timers_aTimerIDs[$x][1]; line fixed - Squirrely1 ; $iTimerID = $_Timers_aTimerIDs[$x][1]; line that needed fixing - Squirrely1 $hCallBack = $_Timers_aTimerIDs[$x][2] If $hCallBack <> 0 Then ; call back was used to create the timer $pTimerFunc = DllCallbackGetPtr($hCallBack) If $pTimerFunc = 0 Then Return SetError(-1, -1, 0) EndIf $iResult = DllCall("user32.dll", "int", "SetTimer", "hwnd", $hWnd, "int", $iTimerID, "int", $iElapse, "ptr", $pTimerFunc) If @error Or ($iResult[0] = 0) Then Return SetError(-1, -1, 0); line worked on - Squirrely1 ; If @error Then Return SetError(-1, -1, 0); line that could use work - Squirrely1 ExitLoop EndIf Next EndIf Return $iResult[0] EndFunc ;==>_Timer_SetTimer I still don't see the practical point to the existence of _Timer_GetTimerID unless it's the hint for us from someone that the script was crying out for help. Probably what will happen, is that the dev's will never update this Timers.au3, and that they intensionally left some problems in it so we little people would have good chance to learn how to fix some "bum-@$$ code" as they call it.
-
Well I found a few problems in my versions of the Timer functions I have in Screensaver.au3 v0.99 Here are some fresh versions, documented better, and which include the standard udf _WinAPI_IsWindow in nearly much unadulterated form ... This does not work with Screensaver.au3 yet, but I might use it there - simple to use and reliable if not overused ... Latest - Doesn't use window handles: This shoud work in Screensaver.au3 v0.99.5 ... Survived - without harness - good as udf's - Survived rigorous tests - w/ harness - Complete with a test harness - (Somewhat Broken): Edit: Thanks again for your help, UEZ. v0.99.5 is out now.
-
It probably will not work - in SciTe I used to be able to compile my screensavers directly to a .scr extension but in more recent versions, you can't do this any longer. Probably there was a good reason the developers changed this, so I didn't complain or make a feature request in the appropriate forum. Edit: I take that back - Pain's suggestion does work: Thanks to Jos's hint, I found out that the following will compile my .au3 file directly to a .scr ... RunWait('"C:\Program Files\AutoIt3\Beta\Aut2Exe\Aut2exe" /in "C:\My Documents\SquirrelWare Light_A_Candle\Light a Candle.au3" /out C:\sq.scr /nopack', "", @SW_HIDE) So you could probably make a windows shortcut with your compiling syntax as its target. Look in the AutoIt help file under AutoIt > Using AutoIt > Compiling Scripts for the correct syntax. You don't get your #AutoIt3Wrapper_ ... lines to work for you when you compile this way, but you can control the compression used and specify an icon.
-
1337 text translator with imagesearch
Squirrely1 replied to bf2forlife's topic in AutoIt General Help and Support
Hey bump-buddy - can you post an example of what you are trying to translate, and tell us what greater end this serves? Then we all tell better how to better Zedna' code, but not by much. -
I guess by "output box" you mean the "Output pane". If you just recently switched to using Vista x64, then either this is a bug, or you need somehow to get SciTe to run in a 32-bit environment - this is possible, I hear, in the 64-bit edition of Vista. You might best post this in the AutoIt "Bug Reports and Feature Requests" forum - that will sooner get you some testy expert coder's attention. This is the "General Help and Support" forum. But welcome to the AutoIt forums - you're stuck with us all now, and for the rest of forever - so just get settled in. Edit: Hey, I just thought of something you could do right away if you know the admin's password: Write a little program in AutoIt that uses the AutoIt internal function "RunAs" to launch SciTe under Administrator credentials. Don't compile the file and you can just put it on the desktop or in Quicklaunch because it would be smaller than a windows shortcut at < 60 bytes. To hide the password from most everyone, you could just compile it instead.
-
[Solved] Parent Process & Child Process
Squirrely1 replied to UEZ's topic in AutoIt General Help and Support
Thanks for all your attention my behalf, UEZ, but I see a few problems with your function ... #1: _ProcessGetChildren returns a two-dimensional array when it even returns an array. #2: I see nothing in the documentation for _ProcessGetChildren even that $aArray[0][0] returns the number of child processes. #3: Couldn't it be true that when some other screensaver is selected in the combo, that your screensaver's process keeps running but stops being a child, while the newly selected one begins being a child, thereby keeping the number of child processes the same? Thanks again from the USA (no that country is nowhere in China).