ArrayArrayArrayArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2011-03-29T10:26:09+02:00 https://brainmodular.com/forums/app.php/feed/topic/2765 2011-03-29T10:26:09+02:00 2011-03-29T10:26:09+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18843#p18843 <![CDATA[[script] Removing the path from a string]]> It works perfectly now, thank you very much...

Kenan

Statistics: Posted by Ken29 — 29 Mar 2011, 10:26


]]>
2011-03-21T10:19:17+02:00 2011-03-21T10:19:17+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18764#p18764 <![CDATA[[script] Removing the path from a string]]>
Create another parameter, eg pFileNameOut. This should also be of type ptTextField. In Callback, you can do something like:

CODE:

PROCEDURE Callback&#40;n &#58; Integer&#41;;BEGIN  IF &#40;n = pFileName&#41; THEN     SetStringValue&#40;pFileNameOut, ExtractFileName&#40;GetStringValue&#40;pFileName&#41;&#41;&#41;;END;

Statistics: Posted by bsork — 21 Mar 2011, 09:19


]]>
2011-03-20T11:38:57+02:00 2011-03-20T11:38:57+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18746#p18746 <![CDATA[[script] Removing the path from a string]]>
Thanks for your answer. Unfortunately it doesn't work as expected. The whole string is getting out of the script. I'll have to search in my archives books about Turbo Pascal and relearn this language...

Image

Thanks

Statistics: Posted by Ken29 — 20 Mar 2011, 10:38


]]>
2011-03-14T23:04:33+02:00 2011-03-14T23:04:33+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18640#p18640 <![CDATA[[script] Removing the path from a string]]>
Here's an example script for Usine accepting one input - the pathfile name - and displays the extracted strings in the console every time the script is initiated or the file name input changes:

CODE:

VAR pFileName &#58; tParameter;PROCEDURE Init;BEGIN   pFileName &#58;= CreateParam&#40;'pathFile name', ptTextField&#41;; SetIsOutput&#40;pFileName, FALSE&#41;;END;PROCEDURE Callback&#40;n&#58; Integer&#41;;   VAR fileName &#58; String;BEGIN   fileName &#58;= GetStringValue&#40;pFileName&#41;;   WriteLn&#40;'Input file name = ' + fileName&#41;;   WriteLn&#40;'Drive = ' + ExtractFileDrive&#40;fileName&#41;&#41;;   WriteLn&#40;'Dir = ' + ExtractFileDir&#40;fileName&#41;&#41;;   WriteLn&#40;'Path = ' + ExtractFilePath&#40;fileName&#41;&#41;;   WriteLn&#40;'Name = ' + ExtractFileName&#40;fileName&#41;&#41;;   WriteLn&#40;'Ext = ' + ExtractFileExt&#40;fileName&#41;&#41;;END;
Paste it into an empty script module and compile. You can connect an Interface Control/Open Dialog module to input if you want, but you can also just enter text strings to see how the different extracts.

Statistics: Posted by bsork — 14 Mar 2011, 22:04


]]>
2011-03-13T01:06:16+02:00 2011-03-13T01:06:16+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18626#p18626 <![CDATA[[script] Removing the path from a string]]>
I find this post very interesting, but I'm not familiar with scripts and I don't know how to use this information.

I tried to copy this in an empty script but I had a couple of errors. If someone can help me.

Thanks

Kenan

// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.

unit Unit1;

interface

uses
SysUtils, // Unit containing the ExtractFileName command
Forms, Dialogs;

type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;

var
Form1: TForm1;

implementation
{$R *.dfm} // Include form definitions

procedure TForm1.FormCreate(Sender: TObject);
var
fullFileName : string;

begin
// Set up a full file name with drive and path
fullFileName := 'C:Program FilesBorlandDelphi7ProjectsUnit1.dcu';

// Show the component parts of this full name
ShowMessage('Drive = '+ExtractFileDrive (fullFileName));
ShowMessage('Dir = '+ExtractFileDir (fullFileName));
ShowMessage('Path = '+ExtractFilePath (fullFileName));
ShowMessage('Name = '+ExtractFileName (fullFileName));
ShowMessage('Ext = '+ExtractFileExt (fullFileName));
end;

end.

Statistics: Posted by Ken29 — 13 Mar 2011, 00:06


]]>
2011-03-07T11:11:25+02:00 2011-03-07T11:11:25+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18525#p18525 <![CDATA[[script] Removing the path from a string]]> Statistics: Posted by 23fx23 — 07 Mar 2011, 10:11


]]>
2011-03-07T04:10:03+02:00 2011-03-07T04:10:03+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18520#p18520 <![CDATA[[script] Removing the path from a string]]>
extractFileName(pString);

http://www.delphibasics.co.uk/RTL.asp?N ... ctFileName

Statistics: Posted by gthibert — 07 Mar 2011, 03:10


]]>
2011-03-07T02:29:02+02:00 2011-03-07T02:29:02+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18517#p18517 <![CDATA[[script] Removing the path from a string]]>
There's a lot of functions to manipulate strings in the script reference, but I can't figure out wich would allow me to extract a substring.

Statistics: Posted by gthibert — 07 Mar 2011, 01:29


]]>
BrainModular BrainModular Users Forum 2011-03-29T10:26:09+02:00 https://brainmodular.com/forums/app.php/feed/topic/2765 2011-03-29T10:26:09+02:00 2011-03-29T10:26:09+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18843#p18843 <![CDATA[[script] Removing the path from a string]]> It works perfectly now, thank you very much...

Kenan

Statistics: Posted by Ken29 — 29 Mar 2011, 10:26


]]>
2011-03-21T10:19:17+02:00 2011-03-21T10:19:17+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18764#p18764 <![CDATA[[script] Removing the path from a string]]>
Create another parameter, eg pFileNameOut. This should also be of type ptTextField. In Callback, you can do something like:

CODE:

PROCEDURE Callback&#40;n &#58; Integer&#41;;BEGIN  IF &#40;n = pFileName&#41; THEN     SetStringValue&#40;pFileNameOut, ExtractFileName&#40;GetStringValue&#40;pFileName&#41;&#41;&#41;;END;

Statistics: Posted by bsork — 21 Mar 2011, 09:19


]]>
2011-03-20T11:38:57+02:00 2011-03-20T11:38:57+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18746#p18746 <![CDATA[[script] Removing the path from a string]]>
Thanks for your answer. Unfortunately it doesn't work as expected. The whole string is getting out of the script. I'll have to search in my archives books about Turbo Pascal and relearn this language...

Image

Thanks

Statistics: Posted by Ken29 — 20 Mar 2011, 10:38


]]>
2011-03-14T23:04:33+02:00 2011-03-14T23:04:33+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18640#p18640 <![CDATA[[script] Removing the path from a string]]>
Here's an example script for Usine accepting one input - the pathfile name - and displays the extracted strings in the console every time the script is initiated or the file name input changes:

CODE:

VAR pFileName &#58; tParameter;PROCEDURE Init;BEGIN   pFileName &#58;= CreateParam&#40;'pathFile name', ptTextField&#41;; SetIsOutput&#40;pFileName, FALSE&#41;;END;PROCEDURE Callback&#40;n&#58; Integer&#41;;   VAR fileName &#58; String;BEGIN   fileName &#58;= GetStringValue&#40;pFileName&#41;;   WriteLn&#40;'Input file name = ' + fileName&#41;;   WriteLn&#40;'Drive = ' + ExtractFileDrive&#40;fileName&#41;&#41;;   WriteLn&#40;'Dir = ' + ExtractFileDir&#40;fileName&#41;&#41;;   WriteLn&#40;'Path = ' + ExtractFilePath&#40;fileName&#41;&#41;;   WriteLn&#40;'Name = ' + ExtractFileName&#40;fileName&#41;&#41;;   WriteLn&#40;'Ext = ' + ExtractFileExt&#40;fileName&#41;&#41;;END;
Paste it into an empty script module and compile. You can connect an Interface Control/Open Dialog module to input if you want, but you can also just enter text strings to see how the different extracts.

Statistics: Posted by bsork — 14 Mar 2011, 22:04


]]>
2011-03-13T01:06:16+02:00 2011-03-13T01:06:16+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18626#p18626 <![CDATA[[script] Removing the path from a string]]>
I find this post very interesting, but I'm not familiar with scripts and I don't know how to use this information.

I tried to copy this in an empty script but I had a couple of errors. If someone can help me.

Thanks

Kenan

// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.

unit Unit1;

interface

uses
SysUtils, // Unit containing the ExtractFileName command
Forms, Dialogs;

type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;

var
Form1: TForm1;

implementation
{$R *.dfm} // Include form definitions

procedure TForm1.FormCreate(Sender: TObject);
var
fullFileName : string;

begin
// Set up a full file name with drive and path
fullFileName := 'C:Program FilesBorlandDelphi7ProjectsUnit1.dcu';

// Show the component parts of this full name
ShowMessage('Drive = '+ExtractFileDrive (fullFileName));
ShowMessage('Dir = '+ExtractFileDir (fullFileName));
ShowMessage('Path = '+ExtractFilePath (fullFileName));
ShowMessage('Name = '+ExtractFileName (fullFileName));
ShowMessage('Ext = '+ExtractFileExt (fullFileName));
end;

end.

Statistics: Posted by Ken29 — 13 Mar 2011, 00:06


]]>
2011-03-07T11:11:25+02:00 2011-03-07T11:11:25+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18525#p18525 <![CDATA[[script] Removing the path from a string]]> Statistics: Posted by 23fx23 — 07 Mar 2011, 10:11


]]>
2011-03-07T04:10:03+02:00 2011-03-07T04:10:03+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18520#p18520 <![CDATA[[script] Removing the path from a string]]>
extractFileName(pString);

http://www.delphibasics.co.uk/RTL.asp?N ... ctFileName

Statistics: Posted by gthibert — 07 Mar 2011, 03:10


]]>
2011-03-07T02:29:02+02:00 2011-03-07T02:29:02+02:00 https://brainmodular.com/forums/viewtopic.php?t=2765&p=18517#p18517 <![CDATA[[script] Removing the path from a string]]>
There's a lot of functions to manipulate strings in the script reference, but I can't figure out wich would allow me to extract a substring.

Statistics: Posted by gthibert — 07 Mar 2011, 01:29


]]>