sample
Code: Select all
Loop, Parse,% "CDEF"
IF FileExist(Dir := A_LoopField ":\Dropbox\AHK\")
{
Run, %Dir%Autohotkey.ahk
Run, %Dir%Script2.ahk
}
Moderator: DosItHelp
Code: Select all
Loop, Parse,% "CDEF"
IF FileExist(Dir := A_LoopField ":\Dropbox\AHK\")
{
Run, %Dir%Autohotkey.ahk
Run, %Dir%Script2.ahk
}
Code: Select all
@echo off
for %%f in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do echo %%f
Code: Select all
@echo off
for %%f in (C D E F)
{
do %%f:\Dropbox\AHK\Autohotkey.ahk
do %%f:\Dropbox\AHK\TextExpansion.ahk
}
Code: Select all
@for %%f in (C D E F) do if exist %%f:\Dropbox\AHK\Autohotkey.ahk if exist %%f:\Dropbox\AHK\TextExpansion.ahk %%f:\Dropbox\AHK\Autohotkey.ahk&%%f:\Dropbox\AHK\TextExpansion.ahk
Code: Select all
@for %%f in (C D E F) do %%f:\Dropbox\AHK\Autohotkey.ahk&%%f:\Dropbox\AHK\TextExpansion.ahk
Code: Select all
@echo off
setlocal enabledelayedexpansion enableextensions
for /F "delims=" %%u in ('mountvol /l^|findstr ":\\"') DO (set hd=%%u & set hd= !hd: =! & echo !hd!)
pause
miskox wrote: ↑20 Dec 2022 11:25I don't know how AHK works (their syntax and how you call the scripts) but I guess you could use something like this:
This code will check if both .ahk files exist. If *both* exist it will first run first .ahk file and then the second one.
The code below will not check for presence of both .ahk files.Code: Select all
@for %%f in (C D E F) do if exist %%f:\Dropbox\AHK\Autohotkey.ahk if exist %%f:\Dropbox\AHK\TextExpansion.ahk %%f:\Dropbox\AHK\Autohotkey.ahk&%%f:\Dropbox\AHK\TextExpansion.ahk
SasoCode: Select all
@for %%f in (C D E F) do %%f:\Dropbox\AHK\Autohotkey.ahk&%%f:\Dropbox\AHK\TextExpansion.ahk
Code: Select all
@for %%f in (C D E F) do %%f:\Dropbox\AHK\Autohotkey.ahk&%%f:\Dropbox\AHK\TextExpansion.ahk
Code: Select all
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
Code: Select all
Runs a specified command for each file in a set of files.
FOR %variable IN (set) DO command [command-parameters]
%variable Specifies a single letter replaceable parameter.
(set) Specifies a set of one or more files. Wildcards may be used.
command Specifies the command to carry out for each file.
command-parameters
Specifies parameters or switches for the specified command.
To use the FOR command in a batch program, specify %%variable instead
of %variable. Variable names are case sensitive, so %i is different
from %I.
.
.
.
Code: Select all
@for %%f in (C D E F) do echo ---&dir %%f:\Dropbox\AHK\Autohotkey.ahk&dir %%f:\Dropbox\AHK\TextExpansion.ahk
It is possible that .ahk runs and does not wait until it finishes? (I don't know how .ahk works) This requires another approach. How do you run .ahk files manually? This info will help.and it only launches the first script instead of both scripts.
Code: Select all
@for %%f in (C D E F) do echo ---&dir %%f:\Dropbox\AHK\Autohotkey.ahk&dir %%f:\Dropbox\AHK\TextExpansion.ahk
Code: Select all
@for %%f in (C D E F) do echo ---&dir %%f:\Dropbox\AHK\Autohotkey.ahk&dir %%f:\Dropbox\AHK\TextExpansion.ahk&pause
Code: Select all
E:\Dropbox\AHK>echo --- & dir C:\Dropbox\AHK\Autohotkey.ahk & dir C:\Dropbox\AHK\TextExpansion.ahk & pause
---
The system cannot find the path specified.
The system cannot find the path specified.
Press any key to continue . . .
Code: Select all
@for %%f in (C D E) do %%f:\Dropbox\AHK\Autohotkey.ahk&%%f:\Dropbox\AHK\TextExpansion.ahk&%%f:\Dropbox\AHK\Emojis.ahk
Errors you have are caused because path you have does not exist on every device you have. So you have to use the first version which checks the existence of the files.
It is possible that .ahk runs and does not wait until it finishes? (I don't know how .ahk works) This requires another approach. How do you run .ahk files manually? This info will help.
And this one for the latest command:If you execute (start) your .ahk file from within the command prompt: does it return to the prompt before it actually completes the job?
Code: Select all
@for %%f in (C D E F) do echo ---&dir %%f:\Dropbox\AHK\Autohotkey.ahk&dir %%f:\Dropbox\AHK\TextExpansion.ahk&pause
With the code above we should be able to see if both your .ahk files are there - but we can't because you don't provide the output.What you get?
It will launch both commands (scripts) one after the other and the PAUSE command as you already know - so all three commands were executed.so when using this below, it only launches the first script, and not the second/third script. why is that so and how do I fix it?
It is possible that .ahk runs and does not wait until it finishes? (I don't know how .ahk works) This requires another approach. How do you run .ahk files manually? This info will help.
If you start both .ahk files one after the other: do you have your work done as expected? If not then I guess you have to run the first .ahk file, wait for it to finish and then you have to start the second .ahk file. So what is it?If you execute (start) your .ahk file from within the command prompt: does it return to the prompt before it actually completes the job?
Code: Select all
@echo off
for %%f in (C D E F) do if exist "%%f:\Dropbox\AHK\Autohotkey.ahk" if exist "%%f:\Dropbox\AHK\TextExpansion.ahk" (
title Running %%f: Autohotkey.ahk
start "" /wait /b cmd /c "%%f:\Dropbox\AHK\Autohotkey.ahk"
title Running %%f: TextExpansion.ahk
start "" /wait /b cmd /c "%%f:\Dropbox\AHK\TextExpansion.ahk"
)
echo Done.
pause
Code: Select all
@echo off
break>test1.tmp
break>test2.tmp
for %%f in (C D E F) do if exist "%%f:test1.tmp" if exist "%%f:test2.tmp" (
title Running %%f: Autohotkey.ahk
ECHO start "" /wait /b cmd /c "%%f:\Dropbox\AHK\Autohotkey.ahk"
start "" /wait /b cmd /c "dir %windir%"
title Running %%f: TextExpansion.ahk
ECHO start "" /wait /b cmd /c "%%f:\Dropbox\AHK\TextExpansion.ahk"
start "" /wait /b cmd /c "dir %windir%"
)
del test1.tmp
del test2.tmp
echo Done.
pause
Code: Select all
start "" /wait /b
Code: Select all
@echo off
for %%f in (C D E F) do if exist "%%f:\Dropbox\AHK\Autohotkey.ahk" if exist "%%f:\Dropbox\AHK\TextExpansion.ahk" (
title Running %%f: Autohotkey.ahk
start "" /wait /b cmd /c "%%f:\Dropbox\AHK\Autohotkey.ahk"
title Running %%f: TextExpansion.ahk
start "" /wait /b cmd /c "%%f:\Dropbox\AHK\TextExpansion.ahk"
)
echo Done.
pause
i simply double click it like an .exe 1 by 1.It is possible that .ahk runs and does not wait until it finishes? (I don't know how .ahk works) This requires another approach. How do you run .ahk files manually? This info will help.
no it doesn't.If you execute (start) your .ahk file from within the command prompt: does it return to the prompt before it actually completes the job?
how do I reflect that in the bat file?If not then I guess you have to run the first .ahk file, wait for it to finish and then you have to start the second .ahk file.
Code: Select all
@echo off
for %%f in (C D E F) do echo ---&dir %%f:\Dropbox\AHK\Autohotkey.ahk&dir %%f:\Dropbox\AHK\TextExpansion.ahk
pause
Code: Select all
test.cmd>temporary.tmp