Jump to content
Sign in to follow this  
jbarr

Small App: App_auto_launch

Recommended Posts

Hm You could just as well creat an small App like this for people who dont know how to handle with Register...

Youll choose the .exe and the App will add it in Run (= Auto launch ^^)


Share this post


Link to post
Share on other sites

Well its like this: you store the string @SW_MINIMIZE into a variable.

Then use the variable as parameter. in your case the var $state has the value of 0 which would launch everything with @SW_HIDE value..

just run this to show what i mean:

$state = "@SW_MINIMIZE"

msgbox(0,'test1',Number($state))

msgbox(0,'test2',NUMBER(@SW_MINIMIZE))

<{POST_SNAPBACK}>

Odd, it was launching them maximized... but it's working now, using the numbers:
;App_Auto_Launch.au3
;
;Written by: Jim Barr
;Email: jim+au3@barr.net
;Web Site: http://jimstips.com
;
;DESCRIPTION
;This application simply reads an initialization file to launch a pre-defined set of applications
;It reads as input the file "App_Auto_Launch.ini". The first section defines the number of apps to
;launch. Each successive section contains the required launch information for each app.
;
;COMMENTS
;I wrote this app to take the tedium out of launching the same apps every day whan I log in.
;Please feel free to tailor it to your needs, however if you sell any derivitive versions of this, 
;please just give me credit. Thanks!
;
;----------------------------------------------------------------------------------------------------
AutoItSetOption("TrayIconDebug", 1)
$title = "App Auto-launch"
;Read in number of apps to launch
$appcount = IniRead("App_Auto_Launch.ini", "NumberApps", "AppCount", "No Apps Defined")
;
;Define and display initial Splash Text
$splashtext = "Auto-Launching " & $appcount & " applications..."
$wd = 300
$ht = 20 + 20 * $appcount
SplashTextOn($title, $splashtext, $wd, $ht)
Sleep(2000)
;
;Read in app definitions and launch the apps
For $i = 1 To $appcount
   $checkrunning = IniRead("App_Auto_Launch.ini", "App" & $i, "CheckRunning", "Y")
   $processname = IniRead("App_Auto_Launch.ini", "App" & $i, "ProcessName", "NotDefined")
   $description = IniRead("App_Auto_Launch.ini", "App" & $i, "Description", "NotDefined")
   $programname = IniRead("App_Auto_Launch.ini", "App" & $i, "ProgramName", "NotDefined")
   $startupdirectory = IniRead("App_Auto_Launch.ini", "App" & $i, "StartupDirectory", "NotDefined")
   $delay = IniRead("App_Auto_Launch.ini", "App" & $i, "Delay", "2000")
   $state = IniRead("App_auto_launch.ini", "App" & $i, "State", 6)
   Launchit($checkrunning, $processname, $programname, $description, $startupdirectory, $delay, $state)
Next
;
;Function to check if process is running
;----------------------------------------------------------------------------------------------------
Func Launchit($checkrunning, $processname, $programname, $description, $startupdirectory, $delay, $state)
   If $checkrunning = "Y" Then
      If Not ProcessExists($processname) Then
         LaunchProgram($programname, $description, $startupdirectory, $delay, $state)
      Else
         $splashtext = $splashtext & @CRLF & $description & " is already running..."
         SplashTextOn($title, $splashtext, $wd, $ht)
         Sleep($delay)
      EndIf
   Else
      LaunchProgram($programname, $description, $startupdirectory, $delay, $state)
   EndIf
EndFunc  ;==>Launchit 
;
;Function to launch the apps
;----------------------------------------------------------------------------------------------------
Func LaunchProgram($programname, $description, $startupdirectory, $delay, $state)
   $splashtext = $splashtext & @CRLF & "Starting " & $description & "..."
   SplashTextOn($title, $splashtext, $wd, $ht)
   Run($programname, $startupdirectory, $state)
   Sleep($delay)
EndFunc  ;==>LaunchProgram
;
Exit

INI, just enough to get the idea:

[NumberApps]
AppCount=1
[App1]
CheckRunning = "Y"
ProcessName = "aruser.exe"
Description = "Remedy"
ProgramName = "C:\Program Files\Remedy\Aruser.exe"
StartupDirectory = "C:\Program Files\Remedy"
Delay = 1000
State = 6


#~ State options:
#~ 0 = HIDE    Hides the window and activates another window.  
#~ 1 = NORMAL    Normal window state
#~ 3 = MAXIMIZE   Maximizes the specified window.  
#~ 6 = MINIMIZE   Minimizes the specified window and activates the next top-level window in the Z order.

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

ProcessName = "aruser.exe"

Description = "Remedy"

Remedy? It's in use elsewhere?

I'm lucky I 've moved to another team so I don't have to work with this hourglass-showing-program anymore... I haven't seen anything slower than that.

Share this post


Link to post
Share on other sites

Remedy? It's in use elsewhere?

I'm lucky I 've moved to another team so I don't have to work with this hourglass-showing-program anymore... I haven't seen anything slower than that.

<{POST_SNAPBACK}>

sadly, yes we use it here. wish we didn't. now they're planning on moving all inventory stuff into it too. yay. not. it'd help if they'd actually paid to get it developed instead of having some mainframe programer develop it in house... that database is a MESS.

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

Just messing around, added this bit of code before the main body of the script:

if $cmdline[0] = 1 and $cmdline[1] = "prompt" Then
   if MsgBox(4, "App Auto Launch", "Would you like to launch your Apps now?",30) = 7 then
      Exit
   EndIf
EndIf

And added a shortcut to window's startup folder to

"c:\program files\app auto launch\app_auto_launch.exe" prompt

'cause I like having it be there when I boot up, but I don't always want it to launch... May even add a timeout, so I can login, get my coffee and have it assume I mean yes...

edit: added that timeout :ph34r:

Edited by emmanuel

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

I have just finished writing my Delphi App to do this (using AutoIT.dll)

Q) Why didn't I use AutoIT ?

A) didn't know about AutoIT before I started writing it :ph34r:

other features in my App

ask for UserID & password

select which programs to run

Sync passwords in selected Apps even if current passwords are different

all controled by the INI file

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...