
Memnoch
Members-
Posts
13 -
Joined
-
Last visited
Everything posted by Memnoch
-
Sorry! It was me. The script was running through so fast that Notepad, at that point, was not even open. Putting in a simple WinWaitActive, or indeed a WinExists loop, fixed it. Thanks for your reply anyway. I knew I was missing something as I've never had problems with that before.
-
Any idea why this works: $win = WinGetPos ( "[Active]" ) and this doesn't: $win = WinGetPos ( "Untitled - Notepad" ) Even tried portions of the name, as in "Un" and it still won't find the window. The first one works, you just have to make sure that the window you want to read from is made active first. I've looked through the description of the command and haven't spotted anything that might indicate I am doing something wrong but then that's me all over.
-
Problem with StdOutRead/StringSplit under 3.2.12
Memnoch replied to Memnoch's topic in AutoIt General Help and Support
I can't take credit for the re-run bit. I found that on these forums. Good suggestions there regarding the username. I hadn't actually tried it yet on a machine logged in with a non-admin user. Thanks again to you both! -
Problem with StdOutRead/StringSplit under 3.2.12
Memnoch replied to Memnoch's topic in AutoIt General Help and Support
Hi, yes that works well thanks. I tried using While...Wend as well, as described in the help file and that works too. The bits I had missed was declaring the variable first, and using &= rather than =. Presumably because the loop is reading the output in a character at a time. -
This script works perfectly under 3.2.10 but not so with 3.2.12. I have indentified some of the issues such as RunAs instead of RunAsSet but can't seem to get my head around the StdErrRead. What the script does is run a DOS command called "getsid.exe". This outputs some text to the console, which is read in to the variable $getsidoutput. Stringsplit breaks this up and StringTrimRight lops off the last two carriage returns, leaving you with the SID of the currently logged in user. Script is below: If Not IsAdmin() Then RunAsSet ( "USER", @Computername, "Password" ) Run ('"' & @AutoItExe & '"' & ' "' & @ScriptFullPath & '"', @WorkingDir ) Exit EndIf #include <Constants.au3> FileInstall ( "getsid.exe", "D:\System\getsid.exe", 1 ) $getsid = Run ( "D:\System\getsid.exe \\" & @ComputerName & " " & @UserName & " \\" & @ComputerName & " " & @UserName, "", "", $STDERR_CHILD + $STDOUT_CHILD ) $getsidoutput = StdoutRead($getsid) $SIDsplit = StringSplit ( $getsidoutput, "is ", 1 ) $SIDtrimmed = StringTrimRight ( $SIDsplit[3], 2 ) RegDelete ( "HKEY_USERS\" & $SIDtrimmed & "\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "AutoConfigURL" ) ProcessWaitClose ( "getsid.exe" ) FileDelete ( "D:\System\getsid.exe" ) Exit The getsid.exe can be obtained here. I understand that the StdOutRead needs to be within a loop but after building some test scripts I cannot get it to work as it did. With the command within a While...Wend loop, $SIDSplit returns as having zero elements so the StringTrimRight command fails as there isn't a third element. Any help would be most appreciated.
-
Script exits with application failiure
Memnoch replied to Memnoch's topic in AutoIt General Help and Support
I seem to have come up with a somewhat inelligant solution to the problem. Since it seems to be keyed to the fact that the InetGet command is running in the background so that the ProgressSet loop can run after it I have removed this code from the main program, which will be called just before the InetGet runs and changed it to run in the foreground instead. So it appears as: Run ( @ScriptDir & \"ProgressMeter.exe" ) InetGet ( "ftp://linkstation/disk1/Databases/" & @UserName & "/sse_data.dbf", "C:\Siebel\782\LOCAL\sse_data.dbf", 1, 0 ) Where ProgressMeter will be: $filesize = FileGetSize ( "\\linkstation\Databases\" & @UserName & "\sse_data.dbf" ) $Downloaded = 0 ProgressOn ( "Database Download", "Database Completion", "0 percent" ) While $Downloaded < $filesize $Downloaded = FileGetSize ( "C:\Siebel\782\LOCAL\sse_data.dbf" ) $Percent = Round (( $Downloaded / $filesize ) * 100, 0 ) ProgressSet ( $percent, $percent & " percent" ) Sleep ( 2000 ) Wend ProgressOff () Exit I've tried this half a dozen times now and it has completed without the application failure. I would have preferred this to be in the one script though. Perhaps it could be created as a Function? I don't know much about these though so wil have to refer to the help file. Any suggestions gratefully received of course. -
Excuse me for interrupting the willy waving but does anytone know if there is a way of having the progress bar follow a data transfer without using InetGet?
-
Script exits with application failiure
Memnoch replied to Memnoch's topic in AutoIt General Help and Support
Hi there, Yes it does. Sorry, that was one other thing I had checked yesterday. It certainly seems to and I had done it by accident to be honest. I had changed it to 0 and left the ProgressSet loop in which then never got used. No errors! EDIT: Something else I was trying was application compatibility. I set it to Windows 2000 and immediately errored. As I type this I have it set to Windows 95 and it has ran through 7 times without the error. Switched compatibility mode off and the error popped up first time. Not sure how this helps me long term but at least it's a workaround. I also tried compiling the code with the latest beta and that made no difference either. EDIT2: Unfortunately when the application compatibility method is used on the full script which does the MSI installation, this then fails because of a policy in effect. Change this setting to Windows 2000 and the script proceeds but gives the error at the end. Either I have the MSI part as a second script which gets called from the first and runs without app. compat. or I live with the errors I guess. -
Script exits with application failiure
Memnoch replied to Memnoch's topic in AutoIt General Help and Support
Adding: Sleep ( 10000 ) inbetween: ProgressOff () and the FileExists at the end has confirmed, for me at least, that it is the FTP session as the application failure window immediately appears and then 10 seconds later the MsgBox appears indicating that the script has completed successfully. -
Script exits with application failiure
Memnoch replied to Memnoch's topic in AutoIt General Help and Support
I've been doing some more testing and pretty much identified that it is something to do with the FTP copy. If I replace: $filesize = InetGetSize ( "ftp://linkstation/disk1/Databases/" & @UserName & "/sse_data.dbf" ) InetGet ( "ftp://linkstation/disk1/Databases/" & @UserName & "/sse_data.dbf", "C:\Siebel\782\LOCAL\sse_data.dbf", 1, 1 ) ProgressOn ( "Database Download", "Database Completion", "0 percent" ) While @InetGetActive $Percent = Round (( @InetGetBytesRead / $filesize ) * 100, 0 ) ProgressSet ( $percent, $percent & " percent" ) Sleep ( 2000 ) Wend ProgressOff () with: FileCopy ( "\\linkstation\Databases\" & @UserName & "\sse_data.dbf", "C:\Siebel\782\LOCAL\", 1 ) The error message does not appear. We changed to an FTP transfer for two reasons. One was that we believed that it would be faster with multiple machines accessing the files and that we found that the NAS boxes were using would reboot when using FileCopy. A single machine would work but not multiple machines. If we wanted to swap back to using FileCopy instead of InetGet, is there a way to have the progress bar indicate progress as it does using FTP? Checking in the folder containing the application compatibilty error file it contains this but I'm not sure what to make of it to be honest. <?xml version="1.0" encoding="UTF-16"?> <DATABASE> <EXE NAME="DatabaseCopy.exe" FILTER="GRABMI_FILTER_THISFILEONLY"> <MATCHING_FILE NAME="DatabaseCopy.exe" SIZE="208080" CHECKSUM="0xE11CCBEA" BIN_FILE_VERSION="3.2.4.9" BIN_PRODUCT_VERSION="3.2.4.9" FILE_DESCRIPTION="" FILE_VERSION="3, 2, 4, 9" VERFILEDATEHI="0x0" VERFILEDATELO="0x0" VERFILEOS="0x4" VERFILETYPE="0x0" MODULE_TYPE="WIN32" PE_CHECKSUM="0x0" LINKER_VERSION="0x0" UPTO_BIN_FILE_VERSION="3.2.4.9" UPTO_BIN_PRODUCT_VERSION="3.2.4.9" LINK_DATE="05/25/2007 14:27:07" UPTO_LINK_DATE="05/25/2007 14:27:07" VER_LANGUAGE="English (United Kingdom) [0x809]" /> </EXE> <EXE NAME="kernel32.dll" FILTER="GRABMI_FILTER_THISFILEONLY"> <MATCHING_FILE NAME="kernel32.dll" SIZE="983552" CHECKSUM="0x4CE79457" BIN_FILE_VERSION="5.1.2600.2180" BIN_PRODUCT_VERSION="5.1.2600.2180" PRODUCT_VERSION="5.1.2600.2180" FILE_DESCRIPTION="Windows NT BASE API Client DLL" COMPANY_NAME="Microsoft Corporation" PRODUCT_NAME="Microsoft® Windows® Operating System" FILE_VERSION="5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)" ORIGINAL_FILENAME="kernel32" INTERNAL_NAME="kernel32" LEGAL_COPYRIGHT="© Microsoft Corporation. All rights reserved." VERFILEDATEHI="0x0" VERFILEDATELO="0x0" VERFILEOS="0x40004" VERFILETYPE="0x2" MODULE_TYPE="WIN32" PE_CHECKSUM="0xFF848" LINKER_VERSION="0x50001" UPTO_BIN_FILE_VERSION="5.1.2600.2180" UPTO_BIN_PRODUCT_VERSION="5.1.2600.2180" LINK_DATE="08/04/2004 07:56:36" UPTO_LINK_DATE="08/04/2004 07:56:36" VER_LANGUAGE="English (United States) [0x409]" /> </EXE> </DATABASE> -
Script exits with application failiure
Memnoch replied to Memnoch's topic in AutoIt General Help and Support
Thanks for that. Good advice. So rather than: Run ( "C:\Some dir\UK_PRD_5.0.exe" ) I could use something like: Run ( @ScriptDir & "\UK_PRD_5.0.exe" ) The reason I hadn't done this was all the install files are on USB keys except the large database so the paths would never change but point taken! Regarding the error I have another cut down script that uses elements of the above to only retrieve the database files if something goes wrong. ***** CODE BEGINS ****** ;---------------------------------------------------- ;Script to copy Siebel database files to users laptop ;---------------------------------------------------- Opt ( "TrayIconDebug", 1 ) ; Disable user input BLockInput ( 1 ) ; Check to see if Linkstation can be found on the network $findLS = Ping ( "linkstation", 2000 ) If $findLS = 0 Then BlockInput ( 0 ) MsgBox ( 16, "Network check", "Cannot find Linkstation. Check network connection." ) Exit EndIf ; Check if users database exists on Linkstation If FileExists ( "\\linkstation\Databases\" & @UserName & "\sse_data.dbf" ) Then Else BlockInput ( 0 ) MsgBox ( 16, "Siebel Version 5", "Database not found. Please check that database exists on Linkstation." ) Exit EndIf ; Check if users dicdata.dat exists on Linkstation If FileExists ( "\\linkstation\Databases\" & @UserName & "\dicdata.dat" ) Then Else BlockInput ( 0 ) MsgBox ( 16, "Siebel Version 5", "Dicdata.dat not found. Please check that the dicdata.dat file exists on Linkstation." ) Exit EndIf ; Copy Siebel database files to the users laptop FileCopy ( "\\linkstation\Databases\" & @UserName & "\dicdata.dat", "C:\Siebel\782\LOCAL\", 1 ) FileCopy ( "\\linkstation\Databases\" & @UserName & "\FILES\*.*", "C:\Siebel\782\LOCAL\FILES\", 1 ) $filesize = InetGetSize ( "ftp://linkstation/disk1/Databases/" & @UserName & "/sse_data.dbf" ) InetGet ( "ftp://linkstation/disk1/Databases/" & @UserName & "/sse_data.dbf", "C:\Siebel\782\LOCAL\sse_data.dbf", 1, 1 ) ProgressOn ( "Database Download", "Database Completion", "0 percent" ) While @InetGetActive $Percent = Round (( @InetGetBytesRead / $filesize ) * 100, 0 ) ProgressSet ( $percent, $percent & " percent" ) Sleep ( 2000 ) Wend ProgressOff () ; Enable user input BlockInput ( 0 ) ; Notify script completion and check to see if database has been copied If FileExists ( "C:\Siebel\782\LOCAL\sse_data.dbf" ) Then MsgBox ( 64, "Siebel Version 5", "Siebel database has been successfully copied." ) Exit Else MsgBox ( 16, "Siebel Version 5", "Database not found. Please check and try again" ) EndIf ***** CODE ENDS ****** When I ran this earlier I received the error message. I have attached 2 JPEGs showing the error messages. However in that instance the completed successfully message box had also appeared. Oddly enough, when I wiped the laptop and ran the full install I did not receive the error message at all, indicating the randomness of it. -
Script exits with application failiure
Memnoch replied to Memnoch's topic in AutoIt General Help and Support
***** CODE BEGINS ****** ;------------------------------------------------------------- ;Script to install Siebel Version 5 and country specific Files ;------------------------------------------------------------- Opt ( "TrayIconDebug", 1 ) ; Disable user input BLockInput ( 1 ) ; Check to see if Linkstation can be found on the network $findLS = Ping ( "linkstation", 2000 ) If $findLS = 0 Then BlockInput ( 0 ) MsgBox ( 16, "Network check", "Cannot find Linkstation. Check network connection." ) Exit EndIf ; Check if users database exists on Linkstation If FileExists ( "\\linkstation\Databases\" & @UserName & "\sse_data.dbf" ) Then Else BlockInput ( 0 ) MsgBox ( 16, "Siebel Version 5", "Database not found. Please check that database exists on Linkstation." ) Exit EndIf ; Check if users dicdata.dat exists on Linkstation If FileExists ( "\\linkstation\Databases\" & @UserName & "\dicdata.dat" ) Then Else BlockInput ( 0 ) MsgBox ( 16, "Siebel Version 5", "Dicdata.dat not found. Please check that the dicdata.dat file exists on Linkstation." ) Exit EndIf ; Assign Administrative rights RunAsSet ("ADMIN_USERNAME", @Computername, "ADMIN_PASSWORD") ; Run the Siebel Version 5 MSI package Run ( "msiexec /i SiebelWebClient-GlobalXlence-English-7823-R01.msi" ) WinWaitActive ( "Siebel Web Client (English) v7.8.2.3 Setup" ) WinWaitNotActive ( "Siebel Web Client (English) v7.8.2.3 Setup", "Computing space requirements" ) ; Error trapping to halt script if application is already installed and continue installation if not If WinExists ( "Siebel Web Client (English) v7.8.2.3 Setup", "Application Maintenance" ) Then ControlClick ( "Siebel Web Client (English) v7.8.2.3 Setup", "Uninstall Siebel Web Client (English) v7.8.2.3", "Cancel" ) WinWaitActive ( "Siebel Web Client (English) v7.8.2.3 Setup", "Installation is not complete" ) ControlClick ( "Siebel Web Client (English) v7.8.2.3 Setup", "Installation is not complete", "&Exit Setup" ) WinWaitActive ( "Siebel Web Client (English) v7.8.2.3 Setup Canceled" , "Siebel Web Client (English) v7.8.2.3" ) ControlClick ( "Siebel Web Client (English) v7.8.2.3 Setup Canceled" , "Siebel Web Client (English) v7.8.2.3", "OK" ) BlockInput ( 0 ) MsgBox ( 64, "Siebel Version 5", "Siebel V5 has already been installed. Exiting." ) Exit Else WinWaitActive ( "Siebel Web Client (English) v7.8.2.3 Setup", "Unauthorized reproduction" ) ControlClick ( "Siebel Web Client (English) v7.8.2.3 Setup", "Unauthorized reproduction", "&Next >" ) WinWaitActive ( "Siebel Web Client (English) v7.8.2.3 Setup", "The settings for this application" ) ControlClick ( "Siebel Web Client (English) v7.8.2.3 Setup", "The settings for this application", "&Next >" ) WinWaitActive ( "Siebel Web Client (English) v7.8.2.3 Setup", "You can choose not to install" ) ControlClick ( "Siebel Web Client (English) v7.8.2.3 Setup", "You can choose not to install", "&Next >" ) WinWaitActive ( "Siebel Web Client (English) v7.8.2.3 Setup", "Click the Back button" ) ControlClick ( "Siebel Web Client (English) v7.8.2.3 Setup", "Click the Back button", "&Next >" ) WinWaitActive ( "Siebel 7.8.2.3 QF0396 Patch" ) WinWaitClose ( "Siebel 7.8.2.3 QF0396 Patch" ) WinWaitActive ( "Siebel Web Client (English) v7.8.2.3 Setup", "Click the Finish button to exit" ) ControlClick ( "Siebel Web Client (English) v7.8.2.3 Setup", "Click the Finish button to exit", "&Finish" ) WinWaitClose ( "Siebel Web Client (English) v7.8.2.3 Setup" ) EndIf ; Install Country specific Files Run ( "UK_PRD_5.0.exe" ) WinWaitActive ( "WinRAR self-extracting archive", "Installation progress" ) ControlClick ( "WinRAR self-extracting archive", "Installation progress", "Install" ) WinWaitActive ( "Confirm file replace", "The following file already exists" ) ControlClick ( "Confirm file replace", "The following file already exists", "Yes to &All" ) WinWaitClose ( "Confirm file replace", "The following file already exists" ) WinWaitClose ( "WinRAR self-extracting archive" ) ; Remove admin rights RunAsSet () ; Move old Siebel shortcuts to D:\System and copy new shortcuts to users desktop FileMove ( @UserProfileDir & "\Desktop\*Siebel*.lnk" , "D:\System\Old Siebel Links\", 9 ) FileCopy ( "C:\Documents and Settings\All Users\Desktop\*Siebel*.lnk", @UserProfileDir & "\Desktop\" ) ; Copy Siebel files to users laptop. FileCopy ( "\\linkstation\Databases\" & @UserName & "\dicdata.dat", "C:\Siebel\782\LOCAL\", 1 ) FileCopy ( "phce.cfg", "C:\Siebel\782\BIN\ENU\", 1 ) FileCopy ( "siebel.pocketpc_arm.CAB", "D:\System\Siebel V5 Files\PDA\", 9 ) DirRemove ( "D:\System\siebelPDA", 1 ) ; Copy Proxy Disable shortcut to users desktop FileCopy ( "D:\System\VPN Proxy\VPN.lnk", @UserProfileDir & "\Desktop\Proxy Disable.lnk", 1 ) ; Copy users database to the local machine showing a progress bar $filesize = InetGetSize ( "ftp://linkstation/disk1/Databases/" & @UserName & "/sse_data.dbf" ) InetGet ( "ftp://linkstation/disk1/Databases/" & @UserName & "/sse_data.dbf", "C:\Siebel\782\LOCAL\sse_data.dbf", 1, 1 ) ProgressOn ( "Database Download", "Database Completion", "0 percent" ) While @InetGetActive $Percent = Round (( @InetGetBytesRead / $filesize ) * 100, 0 ) ProgressSet ( $percent, $percent & " percent" ) Sleep ( 2000 ) Wend ProgressOff () ; Enable user input BlockInput ( 0 ) ; Notify script completion and check to see if database has been copied If FileExists ( "C:\Siebel\782\LOCAL\sse_data.dbf" ) Then MsgBox ( 64, "Siebel Version 5", "Siebel V5 has been successfully installed." ) Exit Else MsgBox ( 16, "Siebel Version 5", "Database not found. Files will need copying manually." ) EndIf ***** CODE ENDS ****** What we have found is that in ALL cases the script completes all tasks correctly. The only difference is that right at the end sometimes the window indicating the script has completed successfully, with or without the windows exception error window as well, and very occasionally it will not show either of those last windows at all. My gut feeling is that it might be something to do with the InetGet code and that somehow the script is exiting without this completing properly but the files are always intact and the correct size. -
Hi, I have written a small script at work to do a rollout of a new version of an existing application. When this script ends it should display a message box stating that the script has completed and then exit gracefully. However this isn't always the case. Sometimes the last message box will never show or in other cases the window will appear but there is a Windows application failure box over it as well. I'm not doing anything clever. Just running a couple of applications as an admin, copying some files around and then using the Inetget to copy a large file over from a NAS box. This command runs in conjunction with a progress meter showing the percentage completed. When this finishes the script completes. I can't give much more info than that as I am posting from home. But I can post what I have when I get to work tomorrow. I am using the latest release version, 3.2.4.9, on Windows XP SP2.