Sign in to follow this  
Followers 0
Jass

Output for a file link in MsgBox

7 posts in this topic

Hey out there,

I wrote a really simple script which I'd like to get a bit more comfortable.

Here is it:

$file = FileReadLine(@WorkingDir & "\files\Settings.ini",10)
MsgBox(4096,"Pfadfinder","Logfile: " & @AppDataDir & "\PTPU" & $file)

Line one reads a specific line from an ini-file to get a filename of a logfile.

Line two creates a MsgBox just with the path and the filename. The more comfort I'd like to get is that the text in the message box should link to the directory and the file so the user doesn't have to search the path in explorer himself.

Thanks in advance.

Jass

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Doing that is actually much harder than it sounds, simple message boxes do not have a way to simply make 'links'. You'd have to create a custom GUI, make it look like a MsgBox, and add the link text in as a label with an event handler to handle the clicking of, and possibly scrolling over (to change the mouse icon into the 'pointing finger' common for hot-links).

Edited by evilertoaster

Share this post


Link to post
Share on other sites

Ok thanks, this is too muck work for such a small program :blink:

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$file = FileReadLine(@WorkingDir & "\files\Settings.ini", 10)
$sLogfile = @AppDataDir & "\PTPU" & $file
ClipPut($sLogfile)
If MsgBox(4 + 4096, "Pfadfinder", "Logfile: " & $sLogfile & @CRLF & "Location has been copied to clipboard. Paste to Explorer Address Bar and hit Enter." & @CRLF & @CRLF & "Alternativly you can directly open the path in a new Explorer window. Do you want to proceed?") = 6 Then
    $sLogfile_Dir = StringRight($sLogfile, StringInStr($sLogfile, "\", 0, -1))
    ShellExecute($sLogfile_Dir)
EndIf

Edited by KaFu

Share this post


Link to post
Share on other sites

Thanks a lot KaFu!

I did two small changes on your code, that's what I now use:

$file = FileReadLine(@WorkingDir & "\files\Settings.ini", 10)
$sLogfile = @AppDataDir & "\PTPU\" & $file
ClipPut($sLogfile)
If MsgBox(4 + 4096, "Pfadfinder", "Logfile: " & $sLogfile & @CRLF & "Location has been copied to clipboard. Paste to Explorer Address Bar and hit Enter." & @CRLF & @CRLF & "Alternativly you can directly open the path in a new Explorer window. Do you want to proceed?") = 6 Then
    $sLogfile_Dir = @AppDataDir & "\PTPU"
    ShellExecute($sLogfile_Dir)
EndIf

Line two a backslash after "\PTPU" was missing and I just use the path, not with filename for ShellExecute to jump to the folder.

But, as I said, thanks a lot :blink:

Share this post


Link to post
Share on other sites

I did two small changes on your code, that's what I now use:

Looks good ;)...

Line two a backslash after "\PTPU" was missing

Me bad, copied&pasted the error from your first post :blink:...

and I just use the path, not with filename for ShellExecute to jump to the folder.

$sLogfile_Dir = StringRight($sLogfile, StringInStr($sLogfile, "\", 0, -1))

should just strip the filename from $sLogfile, wasn't sure if the filename in the Settings.ini not might consist of something like "subdir\subdir\logfile.log", then the $sLogfile_Dir would point to @AppDataDir & "\PTPU\subdir\subdir".

Share this post


Link to post
Share on other sites

Looks good ;)...

Me bad, copied&pasted the error from your first post :blink:...

Hehe, nice, my fault and you liked it :P

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  
Followers 0