Every time Windows 7 updates my scripts break

Started by radioman54, April 04, 2014, 05:58:23 PM

Previous topic - Next topic

radioman54

Winbatch used to be a very useful tool for me but it's becoming more of a problem than a help. As of yesterday my start up script stopped working. It has been working fine until a Windows 7 update that took place yesterday. The script is compiled and a shortcut to the exe file is in the StartUp folder. All the script does is determine if it should perform a regular start up (load Windows Live Mail, Trillian, ECCO Pro, KeePass and My Phone Explorer) or load nothing so that a backup can be performed. After the system reboots I have to execute the start up script manually (everything else in StartUp loads just fine - just not the script). The script is below:

SystemStatus = IniReadPvt("System Status","Status","Home","WinBatch.ini")
If SystemStatus == "Home" Then SystemStatus = 1
If SystemStatus == "Away" Then SystemStatus = 2

StartUpStatus = IniReadPvt("StartUp Status","Status","StartUp","WinBatch.ini")
If StartUpStatus == "StartUp" Then StartUpStatus = 1
If StartUpStatus == "Backup" Then StartUpStatus = 2

If SystemStatus == 1
   StartTrillian = IniReadPvt("Trillian Status","Status","Yes","WinBatch.ini")
Else
   StartTrillian = "No"
EndIf

Date = TimeYmdHms()
JulianDate = TimeJulianDay(Date)
DayOfWeek = ((JulianDate + 5) mod 7) + 1

Select SystemStatus
   Case 1
      Select StartUpStatus
         Case 1

            TimeDelay(60)

            If StartTrillian == "Yes"
               TimeDelay(10)
               RunIcon("C:\Program Files (x86)\Trillian\Trillian.exe","")
            EndIf

            TimeDelay(10)
            Run("C:\Program Files (x86)\KeePass Password Safe\KeePass.exe","")

            TimeDelay(10)
            RunZoom("C:\Program Files (x86)\Windows Live\Mail\wlmail.exe","")
            TimeDelay(45)
            WinIconize("~Windows Live Mail~")

            Timedelay(10)
            DirChange("C:\Program Files (x86)\ECCO")
            RunZoom("C:\Program Files (x86)\ECCO\ECCOExt.exe","")
            TimeDelay(20)
            WinIconize("Ecco - [C:\Users\C.B. McCoy\Documents\My Ecco Files\CB McCoy.eco]")
            
            TimeDelay(15)
            RunIcon("C:\Program Files (x86)\MyPhoneExplorer\MyPhoneExplorer.exe","")

            Break

         Case 2

            TimeDelay(45)

            Run("c:\windows\system32\cleanmgr.exe","/sagerun:1")

            IniWritePvt("StartUp Status","Status","StartUp","WinBatch.ini")

            Break

      EndSelect

      Break

EndSelect

Return

Also, the WinIconize commands no longer work. I've tried partial window names and full window names but nothing works. This also started happing after yesterday's update.

How do I get the script to run or do I just trash WinBatch and look for something else?

Deana

The issue is most likely related to UAC on Windows 7.

User Account Control (UAC) restricts apps launched during the Windows startup process or logon process. To simplify these processes, Software Explorer blocks programs or services that require UAC confirmation from running.

What uiAccess setting are you using? It is my understanding that requested execution level should be AsInvoker and uiAccess should be set to FALSE.

Reference: http://msdn.microsoft.com/en-us/library/bb325654.aspx

See the 'Manifest' topic in the WIL help file.

There are no known issues with WinIconize on Windows 7. You might try debugging the script by add WinExist or WinItemize to determine the correct window titles.

DebugTrace output might be also helpful in tracking down the issue. 

But I recommend that you start by manifesting the EXE correctly for Windows Startup.
Deana F.
Technical Support
Wilson WindowWare Inc.

radioman54

I have UAC turned off and I have the manifest set as you indicated.

Deana

Are you logging in as an administrator? Do any of the applications you are launching require admin privileges?

Reference:  http://msdn.microsoft.com/en-us/library/bb325654.aspx
Deana F.
Technical Support
Wilson WindowWare Inc.

radioman54

My account is an admin account and I'm not launching anything that requires admin privileges. DebugTrace is useless as the process never loads so no log is created.

radioman54

I checked the window name via WinItemize and the names I am using are the correct names. WinExist shows that the windows do exist but WinIconize will not close any of them.

Deana

Are you absolutely sure that UAC is disabled? Based on the fact that the DebugTrace never initiates, indicates to me that the system might be trying to display a UAC prompt.  What is the exact UAC setting on the system? Is it set to never notify? http://support.microsoft.com/kb/975787

Deana F.
Technical Support
Wilson WindowWare Inc.

radioman54

I'm positive it's off. I have Tweak-7 and it shows as off. I turned it back on and set it to Always Notify just to see if it was trying to display a UAC prompt and it didn't. There was no warning of any kind. The script did not load.

Deana

Quote from: radioman54 on April 05, 2014, 08:19:33 PM
I'm positive it's off. I have Tweak-7 and it shows as off. I turned it back on and set it to Always Notify just to see if it was trying to display a UAC prompt and it didn't. There was no warning of any kind. The script did not load.

How are you testing? Are you trying to test from the start up? If so, you will never see a UAC prompt at start up. if an process requires elevation it  will simply be blocked.

Please try running your script after logon using the AsInvoker/False manifest. This can be accomplished using a special file extension .wbt_if. Test with UAC off.  You might also add a DebugTrace statement and add the UacExePromptTest for each of the exes you are trying to launch. Post the resulting trace file here.

I suspect maybe one of the launched processes might be triggering a UAC prompt. The debug trace output should help confirm that theory.

Also please temporarily disable your Anti-virus tool to make sure that it is not the source of the problem.
Deana F.
Technical Support
Wilson WindowWare Inc.

td

It is easy enough to demonstrate that a simple compiled script will start and run consistently from a shortcut in the shell's Startup folder given UAC off, a Admin account and a few other details.  There are several missing bits of information so it is difficult to say what the problem is other than that there is no evidence that it is do to some defect in WinBatch.   
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Deana

radioman54,

Just curious were your able to resolve your Windows 7 start up script?
Deana F.
Technical Support
Wilson WindowWare Inc.

radioman54

No, it's still not working. I have UAC off and it still won't load at Start Up. It was running fine then just stopped. I'm not at home so I can't do any debugging right now.

kdmoyers

radioman54,

[1] dunno if you already thought of this, but sometimes it helps to start with just a one liner script
Code (winbatch) Select
message("hello","world") just to see if anything runs at all.

[2] I can tell you that MANY people run startup scripts on windows 7, so odds are good that the answer exists.

[3] wondering if the location of the script file itself is a factor here? maybe windows can't see it while in starting up mode?

just $0.02
Kirby
The mind is everything; What you think, you become.

Deana

Deana F.
Technical Support
Wilson WindowWare Inc.

td

Quote from: kdmoyers on April 09, 2014, 06:20:55 AM
...
[3] wondering if the location of the script file itself is a factor here? maybe windows can't see it while in starting up mode?

Location would be my first guess too.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Deana

The user states that the startup script was working then suddenly stopped working...but has failed to tell us if anything else changed. I assume ( I know this is dangerous ) that the user did not modify anything like the placement of the exe. Waiting to hear back.
Deana F.
Technical Support
Wilson WindowWare Inc.

Deana

As Tony previously stated there are no issues running programs at start up on Windows 7 using WinBatch. To confirm a created a very simple script, compiled as a large EXE using the UAC Manifest Settings: level="asInvoker" uiAccess="false" and compiled it to c:\temp\a.exe. I then created a shortcut to c:\temp\a.exe and copied the Shortcut to  C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\. Restarted the system and the script ran fine. In fact here is the DebugTrace output:

************************************************************

*** Debug Initialized ***

==============================
Wed 4/9/2014 9:02:03 AM
WinBatch 32 2014A
WIL DLL 6.14ana
C:\TEMP\a.exe
Windows platform: NT, version: 6.1, build: 7601 (Service Pack 1)
ErrorMode: @CANCEL
Valid Code Signature: No
UAC Manifest Settings: level="asInvoker" uiAccess="false"
UAC Elevation Level: Admin Not Elevated
==============================

Message('WinBatch Startup Script', 'Launched!')
(20576) VALUE INT => 1

programname = 'c:\windows\system32\cleanmgr.exe'
(20576) VALUE STRING => "c:\windows\system32\cleanmgr.exe"

If UacExePromptTest ( programname )
(20607) ELSE DO==>TRUE

ShellExecute(programname, '', '', @NORMAL, '')
(20623) VALUE INT => 1

Endif
(20623) END OPERATOR

Exit
(20623) VALUE INT => 0

--- Normal termination ---

;;;END OF JOB;;;
Deana F.
Technical Support
Wilson WindowWare Inc.

td

Quote from: Deana on April 09, 2014, 08:34:01 AM
The user states that the startup script was working then suddenly stopped working...but has failed to tell us if anything else changed. I assume ( I know this is dangerous ) that the user did not modify anything like the placement of the exe. Waiting to hear back.

Not saying that location is the issue but the location of an exe can become a problem without moving the exe or any other obviously connected user action.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

Come to think of it.  I believe we had a sudden unexplained failure of one of our business systems recently.  The cause was eventually traced to a user unintentionally moving files without being aware of it.  Maybe that is why the file location explanation seems so appealing...
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Deana

Deana F.
Technical Support
Wilson WindowWare Inc.