Jump to content

Recommended Posts

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
Posted

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.

Posted

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...