Jump to content

Script giving error while I place it on windows Startup folder but works file While I run it manually !! Help


Go to solution Solved by debkol35,

Recommended Posts

Posted

Hello,

I made a script to run programs automatically. While I am double clickng on the script, it runs fine. so, I place it on startup folder so that when windows start, the script runs automatically.

But while windows start, script gives me a error "Windows can't find 'program.lnk'. Make sure you typed the name correctly..."

But then I exit the script and double click on it...it starts everything fine !!

What is the problem here? Need some help.

OS:- Win 8.1 64bit

Posted

Hard to say without seeing what it is you're trying to do in the script. Post a reproducer script that demonstrates what you're doing and that doesn't work as expected when run from the start up folder.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted (edited)

Does your script have #AutoIt3Wrapper_Res_RequestedExecutionLevel=requireAdministrator, or #pragma compile(ExecLevel, requireAdministrator) in it?  If it does, Windows will not allow it to run on start up.  

 

Adam

Edited by AdamUL
Posted (edited)
  On 5/15/2014 at 3:28 AM, BrewManNH said:

Hard to say without seeing what it is you're trying to do in the script. Post a reproducer script that demonstrates what you're doing and that doesn't work as expected when run from the start up folder.

 

Ok..here is the script:- very simple scirpt:-

First..it runs default program(default.lnk), then program 1 (1.lnk)

then It click on certain button inside default program, then next select program 1 and click inside it.

AutoIt Version: 3.3.10.2
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
ShellExecute("Default.lnk", @desktopDir)
sleep(300)
ShellExecute("1.lnk", @desktopDir)
sleep(300)
sleep(100000)
WinActivate("[CLASS:Default.lnk]","")
ControlClick("", "", "[CLASS:Default.lnk:Chrome_RenderWidgetHostHWND; INSTANCE:1]","left",2,614,245)
sleep(1000)
WinActivate("[CLASS:1.lnk]","")
ControlClick("", "", "[CLASS:1.lnk:Chrome_RenderWidgetHostHWND; INSTANCE:1]","left",2,614,245)
WinMinimizeAll()

It works fine when I double click and run. But when in startup folder, it says it cant find default.link and program.lnk  in desktop !!

 

  On 5/15/2014 at 3:50 AM, AdamUL said:

Does your script have #AutoIt3Wrapper_Res_RequestedExecutionLevel=requireAdministrator, or #pragma compile(ExecLevel, requireAdministrator) in it?  If it does, Windows will not allow it to run on start up.  

 

Adam

 

No.. I dont have nothing like this !!

Ok..I find a nother strange things... While in startup folder, I double click on it, it says cant find those .lnk files.

But in desktop while I click, it opens normally !!

ok..another thing is... if I place this script file in any place except desktop, its giving me this error !! so I guess...it is path finding problem I guess?

Edited by debkol35
  • Solution
Posted

OK..I have solved it... it was my fault..I didnt put file path there

ShellExecute("Default.lnk", "", "C:UsersdebojitDDesktop")
sleep(300)

Solves the problem :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...