Sign in to follow this  
Followers 0
rhiridflaidd

Running files, and odd extension behaviour

3 posts in this topic

#1 ·  Posted (edited)

Bear with me - I am very, very new to programming and scripting, my code is ludicrously inelegant due to inexperience too!!!

I am putting a front end on some perl scripts I wrote. They are very longwinded data processing that uses a lot of complex substitution.

So here is my code is in chunks

$htmlfile = FileOpenDialog("Select list of current drugs", @ScriptDir&"\input", "(*.htm)", 1 + 2 )
               GUICtrlSetData($Listouthtml, $htmlfile)
            $t2 =  FileGetTime(GUICtrlRead($listouthtml), 1)

That snipet puts the file name and extenstion into the listout box in the GUI, and the date of a file in a box beneath. So far so good (I thought)

But for the perlscript that calls a single file named in the $listout box

Run("perl perlscript.pl " & GUICtrlRead($listout),@ScriptDir)

Fails - but only on computers for people not geeky enough to have "Hide extensions for known filetype" Unchecked.

On my PC it works fine.

A script to write out the line into a bat works reguardless of the PC's settings, so this seems specific to "run"

So, in a nutshell, to get my script to work I have to get the user's PC to show all extensions.

Is there a way round this?

Edited by rhiridflaidd

Share this post


Link to post
Share on other sites



I'm on Vista right now and either way, the return value has always the extension supplied. If it's not working on XP, you can be sure that the file selected it .htm file so if:

StringRight($htmlfile, 4) <> ".htm" Then $htmlfile &= ".htm"

or something. Changing the folder view options is usually done through the registry but I believe it's not required here.

Share this post


Link to post
Share on other sites

That's the funny thing though.

It does return the value, and in the text box, the extension is there, and when I write it out into a bat, it's there.

It fails very specifically, in the "run" bit. Show extensions, and the script runs, hide em and it fails.

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