Bug #3861
closedIcon control doesn't recognize $scriptdir correctly
0%
Description
Example of a "test.mrc"
dialog test {
title "test"
size -1 -1 200 200
icon $scriptdir(test.ico)
icon 1, 0 0 32 32, $scriptdir(test.ico)
}
You put "test.mrc" and "test.ico" in a folder like C:\Test and AdiIRC doesn't it recognize correctly.
But recognizes fine for Picture Window.
Updated by Cassio Luz S. over 6 years ago
Cassio Luz da Silva wrote:
Example of a "test.mrc"
dialog test {
title "test"
size -1 -1 200 200
icon $scriptdir(test.ico)
icon 1, 0 0 32 32, $scriptdir(test.ico)
}You put "test.mrc" and "test.ico" in a folder like C:\Test and AdiIRC * [ doesn't it ] * recognize correctly.
But recognizes fine for Picture Window.
Correction: Sorry, you should forget about "()" between the icons. Also, grammar correction: [ doesn't recognize it.]*
Updated by Per Amundsen over 6 years ago
You are using $scriptdir wrong, try $scriptdir\test.ico
Updated by Cassio Luz S. over 6 years ago
Per Amundsen wrote:
You are using $scriptdir wrong, try $scriptdir\test.ico
Tried
I am still having the issue. The identifier "thinks" that the icon is in other folder instead the folder where the script is really loaded.
Updated by Per Amundsen over 6 years ago
It depends on where the dialog was started from, if it was started from the editbox, $scriptdir is blank, if started from the same acript file as the dialog, it will be correct, if started from another script file, it will be the path to the starting script.
How are you starting it?
In mirc starting it from Editbox seems to use the original dialog script file for the path, I will emulate that as well.
Updated by Cassio Luz S. over 6 years ago
Cassio Luz da Silva wrote:
Per Amundsen wrote:
You are using $scriptdir wrong, try $scriptdir\test.ico
Tried
I am still having the issue. The identifier "thinks" that the icon is in other folder instead the folder where the script is really loaded.
Also, i have a new information: The issue doesn't happen with the first file loaded on AdiIRC. Looks like it only happens if you have over than 1 script loaded, and the issue itself doesn't happen with the first script.
I tested the $scriptdir in the first file loaded, and it worked fine.
Updated by Cassio Luz S. over 6 years ago
Per Amundsen wrote:
It depends on where the dialog was started from, if it was started from the editbox, $scriptdir is blank, if started from the same acript file as the dialog, it will be correct, if started from another script file, it will be the path to the starting script.
How are you starting it?
In mirc starting it from Editbox seems to use the original dialog script file for the path, I will emulate that as well.
I am starting on the AdiIRC's Script Editor
Updated by Per Amundsen over 6 years ago
I mean where do you start the dialog using "/dialog -m test test".
Updated by Cassio Luz S. over 6 years ago
Per Amundsen wrote:
I mean where do you start the dialog using "/dialog -m test test".
Usually, using menubar
Updated by Per Amundsen over 6 years ago
- Status changed from New to Assigned
Ah okay, $scriptdir will probably be null from there as well, (when it's null, it falls back to the AdiIRC config dir).
I'll fix it so in cases where $scriptdir is null during a dialog setup, it will change it to the file containing the dialog setup.
Updated by Cassio Luz S. over 6 years ago
Per Amundsen wrote:
Ah okay, $scriptdir will probably be null from there as well, (when it's null, it falls back to the AdiIRC config dir).
I'll fix it so in cases where $scriptdir is null during a dialog setup, it will change it to the file containing the dialog setup.
But i am having the same issue using /dialog -m manually in a window.
I don't know why, but $scriptdir somehow is really confusing folders in the icon control for dialogs.
Updated by Per Amundsen over 6 years ago
I already explained, but let me try again.
When you type "/dialog -m test test" in the Editbox or click it in a Menu/Menubar, $scriptdir is $null/empty/have no value, since there is no script file associated with the /dialog command.
When $scriptdir is $null/empty/have no value, adiirc sets $scriptdir to $adiircdir so $scriptdir always returns a value, mirc does the same thing.
Updated by Per Amundsen over 6 years ago
I fixed so typing /dialog -m test test in the Editbox will properly fill $scriptdir, I then tested $scriptdir and compared to mirc in various ways.
Scenario 1, dialog test { bla bla } in script1.ini and menu menubar { Test:dialog -m test test } in script1.ini, works the same as mirc already, $scriptdir have the expected path.
Scenario 2, dialog test { bla bla } in script1.ini and menu menubar { Test:dialog -m test test } in script2.ini, works the same as mirc already, $scriptdir have the script2.ini path so doesn't work.
Scenario 3, dialog test { bla bla } in script1.ini, then using Edit Menus -> Menubar -> Test:dialog -m test test works the same as mirc already, $scriptdir have the same path as $adiircdir so doesn't work.
Let me know if I missed a scenario, and which one are you currently using?
Updated by Cassio Luz S. over 6 years ago
Per Amundsen wrote:
I fixed so typing /dialog -m test test in the Editbox will properly fill $scriptdir, I then tested $scriptdir and compared to mirc in various ways.
Scenario 1, dialog test { bla bla } in script1.ini and menu menubar { Test:dialog -m test test } in script1.ini, works the same as mirc already, $scriptdir have the expected path.
Scenario 2, dialog test { bla bla } in script1.ini and menu menubar { Test:dialog -m test test } in script2.ini, works the same as mirc already, $scriptdir have the script2.ini path so doesn't work.
Scenario 3, dialog test { bla bla } in script1.ini, then using Edit Menus -> Menubar -> Test:dialog -m test test works the same as mirc already, $scriptdir have the same path as $adiircdir so doesn't work.
Let me know if I missed a scenario, and which one are you currently using?
I am testing the new build you developed for the tests right now. But daily, i use my fullscript developed by myself. I don't use pure adiirc, and i open all dialogs using the Scenario 3.
Updated by Per Amundsen over 6 years ago
- Status changed from Assigned to Resolved
I messed up scenario 3.
In this case mirc/$scriptdir actually returns script1.ini, the good news is, so does adiirc after the previous change, so everything should be fine now.
Updated by Per Amundsen over 6 years ago
- Status changed from Resolved to Closed
Updated by Cassio Luz S. over 6 years ago
Edit: Nevermind
But maybe I will report something here soon, I need to discover more
Updated by Per Amundsen over 6 years ago
Do you have an example that fails?
This works for me:
dialog test { title "test" size -1 -1 200 200 icon $scriptdiricon.ico icon 1, 0 0 32 32, $scriptdiricon.ico }
The script was in C:\test.
Updated by Cassio Luz S. over 6 years ago
Per Amundsen wrote:
Do you have an example that fails?
This works for me:
[...]
The script was in C:\test.
It works fine for you because you use pure AdiIRC
If i open the dialogs using /dialog -m for example, it works fine for me as well.
But my project opens the dialogs using a command developed by myself, and possibly for this reason, AdiIRC doesn't recognize the difference of folders (probably mIRC might not recognize as well)
Updated by Per Amundsen over 6 years ago
here is my full test script:
dialog test { title "test" size -1 -1 200 200 icon $scriptdiricon.ico icon 1, 0 0 32 32, $scriptdiricon.ico } menu * { test dialog:dialog -m test test } alias testdialog { dialog -m test test }
Does yours work differently?
Updated by Cassio Luz S. over 6 years ago
Per Amundsen wrote:
here is my full test script:
[...]
Does yours work differently?
I will explain to you how the things works on my project.
First: The reason of why my project opens the dialogs using a custom command
alias _psys.open {
if ($dialog($2) == $true) { return }
else { dialog $1 $2 $2 }
}
It's used this way to avoid error messages. Also, I just need use /_psys.open -m <dialog-name> without repeat the "<dialog-name>".
Actually, the "/_psys.open" is written in a different file. Not in the same file where the dialog that i am trying to load icons using $scriptdir is written.
And what happens? AdiIRC is recognizing $scriptdir only where the /_psys.open exists (in this case)
Updated by Per Amundsen over 6 years ago
Yes, that is the correct behavior according to my tests in mIRC.
When you start the /_psys.open alias, the $scriptdir is set to the script file where the /_psys.open alias is, this path follows down into the /dialog command.
In my test there is 2 scripts, one containing the dialog which is in C:\, the script containing the /_psys.open alias is in "C:\Users\kr0n\..."
Test is performed by manually calling /_psys.open -m test test and through Tools -> Edit Menubar with test dialog 2:/_psys.open -m test test.
mIRC:
/dialog: 'test' error loading icon 'C:\Users\kr0n\AppData\Roaming\mIRC\scripts\icon.ico' (line 46, remote.ini)
AdiIRC:
/dialog: 'test' error loading icon 'C:\Users\kr0n\Documents\AdiIRC\Scripts\icon.ico' (line 46, script101.ini)
Have you compared to mIRC as well?
If I have missed something, please let me know.
Updated by Per Amundsen over 6 years ago
Was thinking about an alternative to using $scriptdir but then I realized there is no way in MSL to get which file contains a given dialog.
Solution might be to add a new identifier, something like $isdialog(test).fname similar to $isalias, what you think?
Updated by Cassio Luz S. over 6 years ago
I am developing a tool in MSL that might deal with the "issue"
I am sure my tool will work perfect, but this new identifier might be great