Jerryab
04-11-2006, 07:37 PM
Can anyone help me with this ?
I have been trying to manipulate this string from this format:
D:\My Drivers Disc\autoplay\drivers\logitech\setup.exe
to this format:
autoplay\\drivers\\logitech\\setup.exe
The folders change for other drivers.
Example: D:\My Drivers Disc\autoplay\folder\folder\folder\program.exe
any help with this string manipulation would be appreciated.
Jerry
Jerryab
04-11-2006, 10:44 PM
:D I'm a newbe guys but I think this is the best way to do it. It works anyway.
-- dialog the user to browse to the driver
tbl_ProgramFile = Dialog.FileBrowse(true, "Select Program Executable", _DesktopFolder, "", "", "exe", false, true)
if tbl_ProgramFile[1] ~= "CANCEL" then
-- Gets total length of string count
HowLongString = tbl_ProgramFile[1]
StringSize = String.Length(HowLongString);
-- Gets the length of \Autoplay count
TargetIndex = String.Find(tbl_ProgramFile[1], "\\Autoplay", 1, false);
StartToEnd = StringSize - TargetIndex
Whatisit = String.Right(tbl_ProgramFile[1], StartToEnd);
-- Creates a new string from the right-most x characters of an existing string.
EndResult = String.Replace(Whatisit, "\\", "\\\\", false);
-- send EndResult to where ever want
Input.SetText("ProgramFileInput", EndResult);
end
-----------------------------------------------
Any Comments ?
Jerry
yosik
04-12-2006, 02:23 AM
Why not use _SourceFolder? This built-in variable refers to your project folder?
(check Global variables in the help file)
Yossi
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.