
Lilla
Active Members-
Posts
73 -
Joined
-
Last visited
Everything posted by Lilla
-
below is some .vbs code I found when I was looking for an IsServiceRunning() function. It includes an IsConnectible() function that relates to this thread. The author says in Works an "all" WSH versions. Perhaps you can write some AutoIt code that does the same thing, or just call the .vbs from your AutoIt code. I am using his IsServiceRunning() - the short version. Is it possible to rewrite this function in AutoIt? Click the link below to see the full code for both functions. The author is a scripting guru. IsConnectible() and IsServiceRunning() by torgeir Microsoft MVP Scripting and WMI, Porsgrunn Norway ...snip... ' ping the computer to see if it is online If IsConnectible(sCompName, "", "") Then On Error Resume Next Set oComputer = GetObject("WinNT://" & sCompName & ",computer") If Err.Number <> 0 Then 'WScript.Echo sCompName & " is online but not available" Else ...snip... Function IsConnectible(sHost, iPings, iTO) ' Returns True or False based on the output from ping.exe ' ' Author: Alex Angelopoulos/Torgeir Bakken ' Works an "all" WSH versions ' sHost is a hostname or IP ' iPings is number of ping attempts ' iTO is timeout in milliseconds ' if values are set to "", then defaults below used If iPings = "" Then iPings = 2 If iTO = "" Then iTO = 750 Const OpenAsDefault = -2 Const FailIfNotExist = 0 Const ForReading = 1 Set oShell = CreateObject("WScript.Shell") Set oFSO = CreateObject("Scripting.FileSystemObject") sTemp = oShell.ExpandEnvironmentStrings("%TEMP%") sTempFile = sTemp & "\runresult.tmp" oShell.Run "%comspec% /c ping -n " & iPings & " -w " & iTO _ & " " & sHost & ">" & sTempFile, 0 , True Set fFile = oFSO.OpenTextFile(sTempFile, ForReading, _ FailIfNotExist, OpenAsDefault) sResults = fFile.ReadAll fFile.Close oFSO.DeleteFile(sTempFile) Select Case InStr(sResults,"TTL=") Case 0 IsConnectible = False Case Else IsConnectible = True End Select End Function
-
How Do I Check The Exit Code Set By A .vbs
Lilla replied to Lilla's topic in AutoIt General Help and Support
Valik & Larry. Thank you. Method 3 is working now. Not sure why it appeared not to be working before. And Larry, you are correct WScript.exe works. I switch to that now. Thanks for the tip. Lilla -
Windows XP Home SP1 AutoIt v3 build 101 pub 11Mar2004 How do I check exit code set by a .vbs The .vbs terminates with WScript.Quit(1) ;1=FAIL, 0=SUCCESS Method 1, doesn't work. RunWait('cscript.exe "chkdsk_ScheduleForNextRestart.vbs"') $errorlevel= ENVGET('ERRORLEVEL') Method 2, doesn't work RunWait('cscript.exe "chkdsk_ScheduleForNextRestart.vbs"') if @error then Method 3, doesn't work $errorlevel=RunWait('cscript.exe "chkdsk_ScheduleForNextRestart.vbs"') Question: What do I need to do to read the exit code set by a .vbs Thank you, Lilla
-
AutoPatcher for XP, 2000, 2003 http://www.autopatcher.com/Index.htm automation of windows updates and more I haven't used it yet myself, but I read some very good comments about it, so I saved the link. Definitely worth checking out. Lilla
-
JdeB, thanks for the tweaksI got the newest bits now from your site and all fine now. You are doing a GREAT job with your .au3 mods for SciTE. Lilla
-
Launch A .vbs File From Autoit?
Lilla replied to emmanuel's topic in AutoIt General Help and Support
Jon, thanks. I didn't know about cscript.exe/wscript.exe I was using Comspec. I've now replaced it with cscript.exe and it works great here. Lilla -
all my program files are on c:\, thus... c:\program files\autoit3 c:\program files\sciTE Editor all my autoit code that I write is on drive d: d:\Scripts_byLilla Lilla
-
Valik thanks, that fixed it for me. I had this: # *** Specify here your AutoIt program directory *** autoit3dir=\program files\autoit3 I had to add c: autoit3dir=c:\program files\autoit3 ==== Seems like it would be better to include c:\ as the default, and let people change it that don't use drive c: This way it would be right for most people. It was already correct in earlier versions, so perhaps this is a little tiny bug. Lilla
-
Thanks for all your good work. Looks good, except that I am having a small problem. In SciTE Editor, Compile and Go for .au3 files is now broken. Tidy still works from SciTE. Compile Script and Run Script still works from right-click context menu for .au3 files. 1) I downloaded SciTE Editor v1.60 from developers site, and installed it to a new/empty folder named SciTE Editor. I deleted the folder containing v1.59. 2) I installed your SciTE-106 upgrade for SciTE editor v1.60 Not sure if I need this, but in case it would fix the problem I am having I decided to install it. 3) I installed your sciteau3.exe dated 1May2004. Any ideas what I need to do to get Compile and Go for .au3 working in SciTE v1.60 Thanks, Lilla
-
Here's the function I wrote, it works, and looks nice (I think). For a test, you can just run it without doing a restart, then you will see what it looks like. ;to run demo (without doing a restart), uncomment the next two lines ;WinMinimizeAll() ;WaitUntilWindowsIsFullyLoaded('') ;to run demo (with a retart) ;first, schedule run once task/s ;shutdown(6) ;at beginning of run once code, call the function below before doing anything else Func WaitUntilWindowsIsFullyLoaded($Title) Local $message1, $message2, $dif1, $dif2, $begin1, $begin2, $sleeptime, $Title If $Title='' then $Title = @ScriptName EndIf $message1 = 'Please wait...' & @LF & 'The automation script will begin once Windows is fully loaded.' SplashTextOn($Title, $message1, 640, 70, -1, -1, 16, 'Comic Sans MS', 10) $array=WinGetClientSize('Program Manager') ;returns desktop size MouseMove ( $array[0]/2+300, $array[1]/2+35) ;rest cursor at end of middle line $sleeptime=1000 ;1000=1 seconds $begin1 = TimerStart() While 1 If MouseGetCursor() = 2 Then ; 2=arrow $begin2 = TimerStart() While 1 $dif1 = TimerStop($begin1) $dif2 = TimerStop($begin2) $message2 = $message1 & @LF & 'Load time: ' & StringFormat("%.1f", $dif1 / 1000) & ' seconds' ControlSetText($Title, "", "Static1", $message2) ; update splashtexton If $dif2 > 10000 Then ;1000=1sec Sleep(1000) ;allow time to read final load time ExitLoop 2 ;exit out of both While-Wend loops EndIf Sleep($sleeptime) If MouseGetCursor() <> 2 Then ExitLoop EndIf Wend Else Sleep($sleeptime) EndIf Wend SplashOff() Return ; Windows is fully loaded EndFunc
-
I use RunOnce for some scripts. It works really well. For example, I use it to run a script that cleans and defrags. Another example. I run a script that Schedules chkdsk on all drives to run on the next restart (in the blue screen before Windows loads). A RunOnce is used to create a chkdsk/autodsk report when windows does load, and display it immediately for the user to read. When the RunOnce script starts, I always wait 30 seconds before starting the script to allow windows to fully load. If I don't wait long enough (for example, 15 seconds is not long enough) I will have problems with the first script that executes in the RunOnce state. I learned how to use RunOnce and to wait 30 seconds from a guy named Larry (probably you) back when AutoIt2 was the latest version, and we were in the Yahoo group. Still there I know. I've been looking for a way to replace to 30 seconds with something more exacting, your idea of testing on the cursor sounds like it might work. I'm going to try it. If anyone has any other ideas on how to do this I'm interested. Lilla
-
Autoit3-gui - How To Tell If Checked And Disabled
Lilla replied to Lilla's topic in AutoIt General Help and Support
In the REAL code the user can check/uncheck that field, depending on what is going on at the time. There is a list of check boxes and radio boxes. Some of them cannot be combined. So there is the concept of sets. Boxes that do not apply to the active set are disabled (or sometimes hidden). Most of the boxes are part of more than one set. If there were a way to read the attributes that would be the easiest way. But since that isn't possible, then of course I can track the attributes in my While-Wend loop. Thanks for helping me determine the direction I need to go. Thanks for your help (again!), Lilla -
Autoit3-gui - How To Tell If Checked And Disabled
Lilla replied to Lilla's topic in AutoIt General Help and Support
Larry, thanks for the suggestion. I tried it but it doesn't work. The following is true, and msgbox is displays, so GuiRead() doesn't seem to see the DISABLE attribute. It is set though, you can see it in the GUI display. If GuiRead ($chk_test1) = $GUI_CHECKED Then msgbox(0,'debug','chk_test1 is checked') EndIf -
Windows XP Home with SP1 AutoIt3-GUI v102.20 AutoIt v3 build 101 pub 11 mar 2004 How do I tell if CHECKED and DISABLED? I tried this, but it doesn't work... If GuiRead ($chk_test1) = $GUI_CHECKED + $GUI_DISABLE Then Thank you, Lilla Some test code ================= Dim $GUI_CHECKED=1, $GUI_UNCHECKED=4, $GUI_ENABLE=64, $GUI_DISABLE=128, $BS_AUTOCHECKBOX = 0x0003 Dim $chk_test1, $chk_test2 GUI() Func GUI() GuiCreate ('test', 100, 100) $chk_test1 = GuiSetControl ("checkbox", 'Test chk1', 20, 20, 50, 20, $BS_AUTOCHECKBOX) GuiSetControlEx (-1, $GUI_CHECKED) GuiSetControlEx (-1, $GUI_DISABLE) GuiSetControlNotify () $chk_test2 = GuiSetControl ("checkbox", 'Test chk2', 20, 40, 50, 20, $BS_AUTOCHECKBOX) GuiSetControlEx (-1, $GUI_CHECKED) GuiSetControlEx (-1, $GUI_ENABLE) GuiSetControlNotify () While GuiMsg () > 0 $n = GuiRead () TEST1() Wend EndFunc Func test1() If GuiRead ($chk_test1) = $GUI_CHECKED Then msgbox(0,'debug','chk_test1 is checked') EndIf If GuiRead ($chk_test1)= $GUI_CHECKED + $GUI_DISABLE Then msgbox(0,'debug','chk_test1 is checked and disabled') EndIf EndFunc
-
I found a workaround, use cut and paste, it's very fast... EXAMPLE: $var=$var & 'AutoIt v3 is a BASIC-like scripting language designed for automating ' & @crlf $var=$var & 'the Windows GUI.It uses a combination of simulated keystrokes, mouse' & @crlf $var=$var & 'movement and window/control manipulation in order to automate tasks in a way not' & @crlf Run('Notepad.exe' , '', @SW_MAXIMIZE) winwaitactive('Untitled - Notepad') Winactivate('Untitled - Notepad') ClipPut($var) ;copy to clipboard Sleep(100) Send('^v') ;paste from clipboard Sleep(100)
-
OK, I found and fixed the problem. It seems to work good for me. Check it out, let me know what you think. This function is useful when using Windows Matching on applications that include the file name in the title such as: Notepad, Word, Excel, etc. I added a demo, so just save, uncomment the demo line, and run FolderOptions.au3 --------------------- #include-once ;Demo() ; ------------------------------------------------------------------------------ ; ; AutoIt Version: 3.0 ; Language: English ; Description: Functions that assist with Windows Folder Options. ; ; ------------------------------------------------------------------------------ ;=============================================================================== ; ; Description: Query or set Windows option to Show/Hide file extensions ; Syntax: _ShowHideFileExt( $iParm ) ; Parameter(s): $iParm - the action you want the function to perform ; -1 = query. Return the current setting for extensions. ; 0 = show. Assure extensions are showing, set if necessary. ; 1 = hide. Assure extensions are hiding, set if necessary. ; Requirement(s): None ; Return Value(s): On Success - returns the current setting (0=Show 1=Hide) ; On Failure - returns -1 and sets @error = 1 ; if there is an error reading the registry ; or if a bad parameter is passed. ; Author(s): Lilla Renfro Slater <lilla@earthlink.net> ; Notes: For all versions of windows. Tested under Windows XP and 98. ; Under Windows XP, "Hide extensions for known files" option (default = enabled) ; is located on Control Panel > Folder Options > View tab. ; ; This function is helpful when using AutoIt Windows Matching with applications ; that show the file name on the title bar, such as: Notepad, Word, Excel, etc. ; ; For example, ; eula - Notepad (window title when extensions are set to hide) ; eula.txt - Notepad (window title when extensions are set to show) ; ; Example 1: This code assures that extensions are showing. ; _ShowHideFileExt(0) ; run('notepad.exe c:\windows\system32\eula.txt') ; WinWaitActive('eula.txt - Notepad') ; ; Example 2: This code adapts to the existing Show/Hide File Ext. setting ; $result = _ShowHideFileExt(-1) ; return the current setting ; run('notepad.exe c:\windows\system32\eula.txt') ; If $result = 0 Then ;extensions are showing ; $ext='.txt' ; Else ;extensions are hidden ; $ext='' ; EndIf ; WinWaitActive('eula' & $ext & ' - Notepad') ; ; Example 3: This code assures that extensions are showing, and ; restores the initial setting when done. ; Dim $query = -1, $show =0 , $hide = 1 ; $initial = _ShowHideFileExt($query) ; If $initial <> $show then ; $flag=1 ; _ShowHideFileExt($show) ; EndIf ; run('notepad.exe c:\windows\system32\eula.txt') ; WinWaitActive('eula.txt - Notepad') ; msgbox(0,'debug',"observe that Notepad's title line INCLUDES file extension") ; WinClose('eula.txt - Notepad') ; If $flag=1 then _ShowHideFileExt($initial) ;restore initial setting ; ;=============================================================================== Func _ShowHideFileExt($iParm) Local $key, $ret, $query = -1, $show = 0, $hide = 1 $key = RegRead( 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'HideFileExt' ) If @error Then $ret = -1 SetError( 1 ) Else Select Case $iParm = $show If $key = $hide Then ;hide => show RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", 0) ;EnvUpdate() - doesn't appear to make a difference EndIf $ret = $show Case $iParm = $hide If $key = $show Then ;show => hide RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", 1) ;EnvUpdate() - doesn't appear to make a difference EndIf $ret = $hide Case $iParm = $query $ret = $key Case Else $ret = -1 SetError( 1 ) EndSelect EndIf Return $ret EndFunc ;==>_ShowHideFileExt Func Demo() ; toggle hide/show file extensions Local $query = -1, $show = 0, $hide = 1 For $i = 1 To 2 $initial = _ShowHideFileExt ($query) ;toggle setting for demo purposes If $initial = 1 Then $flag = 1 $now = _ShowHideFileExt (0) ElseIf $initial = 0 Then $flag = 1 $now = _ShowHideFileExt (1) EndIf Run('notepad.exe c:\windows\system32\eula.txt') If $now = 1 Then WinWaitActive('eula - Notepad') MsgBox(0, @scriptname, "observe that Notepad's title line does NOT include file extension") WinClose('eula - Notepad') ElseIf $now = 0 Then WinWaitActive('eula.txt - Notepad') MsgBox(0, @scriptname, "observe that Notepad's title line INCLUDES file extension") WinClose('eula.txt - Notepad') EndIf Next EndFunc ;==>Demo
-
Looking good there on the install_tidy.exe, I gave it a try just to check it out. SUGGESTION: on initial screen, you could use Yes / No / Cancel - so user can cancel if they decide they don't want to continue with the install. I wanted to cancel, but had to answer No to the first question so I could choose cancel on the 2nd screen. --- I am using 1.0.11 (scite.zip version) of tidy, I found a small problem. Any code below #comments-start is misaligned. It doesn't happen in all situations, so I have included some code below that you can use to see the problem. I've stripped out excess code to make it small enough to post here, so it probably won't run, but it is enough to demo the tidy formatting problem. ;Code: AutoIt v3.0 build 101 pub 11 Mar 2004 ;hide cmd.exe window that opens Run( @ComSpec & ' /c eventvwr.msc', '', @SW_HIDE ) WinWaitActive('Event Viewer') ;Application (the letter a) Send('a') Sleep(100) WinWaitActive('Event Viewer', 'Event Viewer (Local)\Application') ;&View menu (alt+v), F&ilter... (the letter i) Send('!v') Sleep(100) Send('i') Sleep(100) WinWaitActive('Application Properties') ;Event I&D field (alt+D), type 1001 (chkdsk/autochk events) Send('!d') Sleep(100) Send('1001') Sleep(100) ;&From (alt+F), select "Events on" (the letter E) Send('!fe') Sleep(100) ;move to date field (tab) Send('{TAB}') Sleep(100) ;send starting date (yyyy-mm-dd) Send($StartDate) Sleep(100) #comments-start Send('{TAB}') Sleep(100) Send($StartTime12) Sleep(100) #comments-end ;&Apply button (alt+A) Send('!a') Sleep(100) ;OK button (Enter key) Send('{ENTER}') Sleep(100) WinWaitClose('Application Properties') WinWaitActive('Event Viewer') Exit
-
Klaatu, nice list. You might want to add *.MSC for Windows XP. c:\windows\*.msc ... there are 15 on my system so far I have used these: ;Device Manager Run('mmc.exe ' & @windowsdir & '\system32\devmgmt.msc') ;Event Viewer Run('mmc.exe ' & @windowsdir & '\system32\eventvwr.msc') ;Services Run('mmc.exe ' & @windowsdir & '\system32\services.msc') On your system, you can: Start > Run > services.msc (press enter) (this method should not be used in your code because it is possible that the user has disabled it). Lilla 2004-04-25 updated to use mmc.exe rather than as dos cmd. This eliminates the black DOS screen.
-
Yes, indeed it does exact that. The problem is that a program started via RunOnce starts running before windows is fully loaded, and this can cause your code to fail. Under AutoIt v2.64, the workaround is to sleep awhile to assure that windows is fully loaded before you start doing stuff. Larry's AutoIt v2.64 sample script allows 30 seconds so that's what I use. I tried 15 seconds, and I had problems, so I moved it back to 30 seconds. But, I wonder if perhaps some machines could need more than 30 seconds? Under AutoIt v3, I wonder if there are one/more processes I could monitor to determine when windows is fully loaded, at that point I know I can safely begin doing stuff in my RunOnce code? Lilla
-
Windows XP Home AutoIt v3 build 101 pub 11Mar2004 I wrote a WinXP Home cleaning script that runs via RunOnce. Upon restart the runonce routine is triggered... ;runonce routine ;Sleep for a bit to let Windows Fully Load Sleep(30000) ;30seconds ;start doing stuff I learned how to use runonce from reading posts by Larry for AutoIt v2.64. With AutoIt v3, perhaps there is a better way than sleep. With AutoIt v3 is there a way to determine when Windows is fully loaded? Maybe using processexisits() or something? My script is for Windows XP & Windows 98. Thank you, Lilla
-
Thanks for explaining. I guess I need to learn how to tweak icons.Maybe for now, I'll just try to find an icon that looks ok as is. Lilla
-
Windows XP Home 2002 AutoIt v3 build 101 pub 11Mar2004 AutoIt3-GUI v102.17 I've written a GUI script using AutoIt3-GUI. I compile it using the command below. RunWait( @programfilesdir & '\AutoIt3\AutoItGUI\Aut2Exe.exe /in myscript.au3 /icon "' & @programfilesdir & '\AutoIt3\Aut2Exe\Icons\Misc\Helping Hand.ico"') Notice that I am using an icon that is supplied with AutoIt3. The icon looks nice in Windows Explorer when I look at the folder my script is installed to. The icon looks nice on the desktop, when I make a shortcut to myscript. However, when I run myscript.exe, the icon in the window title looks ugly. The white gloved helping hand, looks like it has arthritis. This icon is 32x32, why does it looks bad in the window title? Will this be resolved in a future release? Is there some other kind of icon that I should give it (other than 32x32)? Is there something I can do to resolve this problem? Thank you, Lilla
-
JdeB, just installed it. Looks good here (with large fonts). A couple of thoughts... - Tidy startup window, Setup button. Consider renaming this button Settings or Options. These days, Setup usually means Install. A search of my system drive found 21 files named setup.exe in various folders. - Since doc doesn't yet include installation, I've included some notes to help newbies below. Feel free to use any/all of this in your doc if that would be helpful. 1) How to install tidy as a standalone app., ie. when not using SciTE Editor. To install it under AutoIt3, like this... c:\program files\AutoIt3\Tidy c:\program files\AutoIt3\Tidy\Tidy_doc_files Extract all files contained in tidy.zip to a subfolder (named Tidy) of the folder you installed AutoIt3 to. In your unzipping program, check the option to "use folder names", this is WinZip terminology. It might be called something else in your unzipping program. If you don't check this option, tidy_doc.htm will not be able to find the graphics (ie screen shots). 2) How to install Tidy when using SciTE Editor. Extract all files contained in tidy.zip to a subfolder (named Tidy) of the folder that you installed SciTE Editor to. In your unzipping program, check the option to "use folder names", this is WinZip terminology. It might be called something else in your unzipping program. If you don't check this option, tidy_doc.htm will not be able to find the graphics (ie screen shots). For example, my install looks like this... c:\program files\SciTE Editor\Tidy c:\program files\SciTE Editor\Tidy\Tidy_doc_files Thank you for sharing Tidy for AutoIt with us, Lilla
-
Is Splashoff() Required To Reclaim Memory?
Lilla replied to Lilla's topic in AutoIt General Help and Support
Thank you Larry. AutoIt v3 is terrific. I love AutoIt v3 and AutoIt-GUI. Lilla -
Is SplashOff() required to reclaim memory? I'm using AutoIt v3 build 101 published 11-Mar-2004 For example, at the end of a .vbs program it is important to do cleanup. For example: Set colDisks = nothing Set objDisk = nothing Set objWMIService = nothing Set objNetwork = nothing Set objOutLogFile = nothing Set objFileSystem = nothing So, I've been wondering if there are things that need to be cleaned up at the end of an AutoIt v3 script? For example, when a script uses a SplashTextOn, the Splash closes itself when it sees the Exit command, so I don't bother issuing a SplashOff(). Am I causing memory leaks by not issuing a SplashOff() before Exiting? Is it considered better form to issue a SplashOff()? Thank you, Lilla