ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Skrommel's Software

[Idee] GroupStarter

<< < (2/3) > >>

AbteriX:
> Shouldn't be too hard to make for example with AutoHotkey,

Yes i have definitely to learn how to store/read settings in an ini  :-[

AbteriX:
My first script to solve my problem.

I would like to call this version an alpha build. Test on your own risk.

Tomorrow we see forward.

Any suggestions, comments and translating to English is welcome.

The AHK script:


--- ---;REM  DelayLauncher, 2007 by Stefan
;REM  Simple AHK script (www.autohotkey.com)
;REM  to start one or more applications listed in an ini file, if wanted with delay.
;REM 
;REM  Purpose: start an group of applications and/or start your programs in the autostart folder with an delay.
;REM 
;REM  Syntax of the DelayLauncher.ini file:
;REM  Seconds to wait, Target (Application plus parameters), Workingdir, launch state
;REM  For example:
;REM  2, Notepad notice.txt,,max
;REM 
;REM  All parameters could be empty. Only "Target" is needed ;-) and the comas for empty parameters if an parameter follows
;REM 
;REM  To take an application out of the launching put an '#' in front of the line
;REM  For example:
;REM  #2, Notepad notice.txt,,max
;REM 
;REM  To execute the applications the AHK command "Run" is used.
;REM  See www.AutoHotkey.com Help file for RUN command:
;REM 
;REM  Run, Target [, WorkingDir, Max|Min|Hide|UseErrorLevel]
;REM 
;REM  Target
;REM  A document, URL, executable file (.exe, .com, .bat, etc.), shortcut (.lnk), or system verb to launch (see remarks).
;REM  If Target contains any commas, they must be escaped as shown three times in the following example:
;REM  Run rundll32.exe shell32.dll`,Control_RunDLL desk.cpl`,`, 3  ; Opens Control Panel > Display Properties > Settings
;REM  To pass parameters, add them immediately after the program or document name.
;REM  If a parameter contains spaces, it is safest to enclose it in double quotes (even though it may work without them in some cases).
;REM   
;REM  WorkingDir
;REM  The working directory for the launched item. Do not enclose the name in double quotes even if it contains spaces.
;REM  If omitted, the script's own working directory (A_WorkingDir) will be used. 
;REM 
;REM  Max|Min|Hide
;REM  If omitted, Target will be launched normally. Alternatively, it can contain one or more of these words:
;REM  Max: launch maximized
;REM  Min: launch minimized
;REM  Hide: launch hidden (cannot be used in combination with either of the above)
 

Loop, read, DelayLauncher.ini              ;The INI who stores the applications list to launch
{
    Loop, parse, A_LoopReadLine, CSV
    {
    VAR%A_Index% = %A_LoopField%
    }
    IfInString, VAR1, #                   ;If this character is found skip the launch of this application
      continue
    If VAR1 is not integer                ;If the delay time is omitted (app is in Var1) shift the app name to Var2
       VAR2 = %VAR1%
   T := VAR1 * 1000                       ;AHK count with milliseconds, we multiply the user input '2' with 1000 to get 2000 ms = 2sec
   Sleep, %T%
        ;Test the command line:
        ;MsgBox, 4, Test, Wait for %VAR1% Seconds - RUN now %VAR2% %VAR3% %VAR4%   `n`nContinue?
          ;IfMsgBox, No
          ;return
   Run, %Var2% , %Var3% , %Var4% UseErrorLevel    ;Launch the app
        if ErrorLevel = ERROR                     ;If an error occur continue
        MsgBox, 20,Mistake,Error with application: %VAR2% `nPlease check the settings.  `n`nContinue the other applications?
            IfMsgBox, No
            return
}
Exit
return

;

The INI file (save as "DelayLauncher.ini"):

--- ---calc
#1,Paint
1, Notepa,,min
2, Notepad notice.txt,,max

justice:
good job. idea: instead of the ini filename, use %1%, then use your own extensino .gst for example, and then you can drag and drop .gst files on your script to execute them. this way you can use multiple .gst files. And associate .gst with your executable for double clicking.

AbteriX:
good job. idea: instead of the ini filename, use %1%,
then use your own extensino .gst for example,
and then you can drag and drop .gst files on your script to execute them.
this way you can use multiple .gst files. -justice (July 10, 2007, 05:40 PM)
--- End quote ---
And associate .gst with your executable for double clicking.
--- End quote ---
1.) K.I.S.S. ...
...and portable => NO!!! Registry mess up
2.) i can't d&d in TC
3.) but %1% is good idea to be flexible! (not only d&d but start like "EXE PARA" , no matter what extension)
4.) i will disable the TNA icon

AbteriX:
New
- alternative use of INI file as parameter instead of default DelayLauncher.ini
- little Debug message
- MsgBox improvements
- No Tray Icon
- still to do some little improvements, testings with blanks, clean up the code and such, but here is DelayLauncher v0.2
(need an other/better name???)

;REM  DelayLauncher, 2007 by Stefan
;REM  Simple AHK script (www.autohotkey.com)
;REM  to start one or more applications listed in an ini file, if wanted with delay.
;REM
;REM  Purpose: start an group of applications and/or start your programs in the autostart folder with an delay.
;REM
;REM  Syntax of the DelayLauncher.ini file:
;REM  Seconds to wait, Target (Application plus parameters), Workingdir, launch state
;REM  For example:
;REM  2, Notepad notice.txt,,max
;REM
;REM  All parameters could be empty. Only "Target" is needed ;-) and the comas for empty parameters if an parameter follows
;REM
;REM  To take an application out of the launching put an '#' in front of the line
;REM  For example:
;REM  #2, Notepad notice.txt,,max
;REM
;REM  To execute the applications the AHK command "Run" is used.
;REM  See www.AutoHotkey.com Help file for RUN command:
;REM
;REM  Run, Target [, WorkingDir, Max|Min|Hide|UseErrorLevel]
;REM
;REM  Target
;REM  A document, URL, executable file (.exe, .com, .bat, etc.), shortcut (.lnk), or system verb to launch (see remarks).
;REM  If Target contains any commas, they must be escaped as shown three times in the following example:
;REM  Run rundll32.exe shell32.dll`,Control_RunDLL desk.cpl`,`, 3  ; Opens Control Panel > Display Properties > Settings
;REM  To pass parameters, add them immediately after the program or document name.
;REM  If a parameter contains spaces, it is safest to enclose it in double quotes (even though it may work without them in some cases).
;REM
;REM  WorkingDir
;REM  The working directory for the launched item. Do not enclose the name in double quotes even if it contains spaces.
;REM  If omitted, the script's own working directory (A_WorkingDir) will be used.
;REM
;REM  Max|Min|Hide
;REM  If omitted, Target will be launched normally. Alternatively, it can contain one or more of these words:
;REM  Max: launch maximized
;REM  Min: launch minimized
;REM  Hide: launch hidden (cannot be used in combination with either of the above)


#NoTrayIcon                               ;disable the view of the AHK icon


INIfile = %1%                             ;Use the INI file given as parameter.
If ("%1%" = "")                           ;If no ini file parameter is given on the command line
   INIfile = DelayLauncher.ini            ;use the standard INI DelayLauncher.ini


If 2 contains debugit                     ;Debug mode: see what the script will do
 MsgBox, 64,Debug DelayLauncher command line, Parameter (%0%):`t%1% %2% %3%`nINIfile:`t`t%inifile% `nScript Working Dir: %A_ScriptDir%



Loop, read, %INIfile%                     ;The INI who stores the applications list to launch
{
    Loop, parse, A_LoopReadLine, CSV
    {
    VAR%A_Index% = %A_LoopField%
    }
    IfInString, VAR1, #                   ;If this character is found skip the launch of this application
      continue
    If VAR1 is not integer                ;If the delay time is omitted (app is in Var1) shift the app name to Var2
       VAR2 = %VAR1%
   T := VAR1 * 1000                       ;AHK count with milliseconds, we multiply the user input '2' with 1000 to get 2000 ms = 2sec
   Sleep, %T%                             ;Pause
        ;Test the command line:
        ;MsgBox, 4, Test, Wait for %VAR1% Seconds - RUN now %VAR2% %VAR3% %VAR4%   `n`nContinue?
          ;IfMsgBox, No
          ;return
        If (%VAR3% = "")                ;for .lnk error handling
        VAR3 = %A_ScriptDir%
   Run, %Var2% , %Var3% , %Var4% UseErrorLevel    ;Launch the app
        if ErrorLevel = ERROR                     ;If an error occur continue
        MsgBox, 20,DelayLauncher Warning,Error while launching this application: `nApp name:`t%VAR2%, `nWorking Dir:`t%VAR3%, `nState:`t`t%VAR4%, `n`t%VAR5% `n`t%VAR6% `nDelay:`t%VAR1% seconds`n`nPlease check the settings in the INI %INIfile%.  `nI give up :(`nContinue launching the other applications?
            IfMsgBox, No
            return
}
Exit
return
;-v0.2
--- End quote ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version