error message "no data media in drive" with #include Topic is solved

Propose new features and changes
hd0202
Posts: 183
Joined: 04 Oct 2013, 03:07
Location: Germany near Cologne

error message "no data media in drive" with #include

11 Apr 2015, 07:41

The FileName parameter may optionally be preceded by *i and a single space, which causes the program to ignore any failure to read the included file.
I want to use this code

Code: Select all

#include *i f:\ahk_source\include.ahk
#include *i d:\ahk_source\include.ahk
in my scripts to run the scripts on 2 different computers. Both have the harddisk on different drives, the other mentioned in the #include is a CD/DVD drive or not existent, and I get the message "no data media in drive" (in german: Kein Datenträger im Laufwerk), which must be closed on every run.

Is there a possibility to avoid this message?

Thnks in advance

Hubert
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: error message "no data media in drive" with #include

11 Apr 2015, 19:05

AutoHotkey does ignore the failure, but Windows sometimes doesn't.

I am not able to reproduce your problem on Windows 7 or Windows XP, specifying either a drive which doesn't exist or an empty DVD drive. Do you get any error dialogs (excluding the script's MsgBoxes) if you run the following?

Code: Select all

MsgBox TEST #1
test1("f:\ahk_source\include.ahk")
test1("d:\ahk_source\include.ahk")

MsgBox TEST #2
test2("f:\ahk_source\include.ahk")
test2("d:\ahk_source\include.ahk")

test1(f) {
    try {
        FileOpen(f, "r").Read()
        MsgBox File read.
    } catch
        MsgBox Exception thrown.
}

test2(f) {
    try {
        DllCall("SetErrorMode", "uint", 1)
        FileOpen(f, "r").Read()
        MsgBox File read.
    } catch
        MsgBox Exception thrown.
    finally
        DllCall("SetErrorMode", "uint", 0)
}
hd0202
Posts: 183
Joined: 04 Oct 2013, 03:07
Location: Germany near Cologne

Re: error message "no data media in drive" with #include

11 Apr 2015, 22:45

lexikos wrote:Do you get any error dialogs (excluding the script's MsgBoxes) if you run the following?
Yes, with TEST #1:
message in German
---------------------------
AutoHotkey.exe - Kein Datenträger
---------------------------
Es befindet sich kein Datenträger im Laufwerk. Legen Sie einen Datenträger in Laufwerk F: ein.
---------------------------
Abbrechen Wiederholen Weiter
---------------------------

message translated
---------------------------
AutoHotkey.exe - no disk
---------------------------
There is no disk in the drive. Please insert a disk into drive F:.
---------------------------
Cancel Retry Next
---------------------------
TEST #2 runs without this message!

lexikos, thank you for all your good work for AutoHotkey. I use it for many years and I love it :bravo:

Hubert
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: error message "no data media in drive" with #include  Topic is solved

11 Apr 2015, 23:27

Okay, I'll add the SetErrorMode() call in the next update.

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 16 guests