I need to create a dataset in a file that is not covered by the .make-command. How can I achieve this?
I tried it using the file-identifier you use in the .select-command and the correct group-identifier (e.g. group3). When run, it prompted "wrong group".
You can also use EDP or EPI.
Short example how to create a customer using EDP:
.type text xtedp xterr xtres xtsys
..
..: file containing the EDP commands
.file -TEMPNAME U|xtedp
..: file containing the error output of the edp command
.file -TEMPNAME U|xterr
..: file containing the id of the new customor
.file -TEMPNAME U|xtres
..
..: Create the edp command file containing two new customers
.input DATEI.F
.output new 'U|xtedp'
# hier you can write a comment for the edp file
#!database=0
#!group=1
#!action=new
#!password=yourpassword
#!charset=EKS
#!report=NUM
#!DONTCHANGE=-
#!TRANSACTION=1
# now we list all fields which we want to write
such#name#ans#plz#nort#str#
DOW#John Dow Ldt;#John Dow Ltd#12345#Someplace#Somestreet#
Max#Max Ldt;#Max Ltd#22345#Someplace2#Somestreet2#
..
..: close edp file
.output TERMINAL
..
..: Execute the edp command
.formula U|xtsys = "edpimport.sh " + " -t# -I " + 'U|xtedp' + " > " + 'U|xtrep' + " 2> " + 'U|xterr'
.system 'U|xtsys' background
..
..: G|mehr or G|success is "true" when the command could be executed successfully (on some abas-ERP versions G|success does not wort, use G|mehr)
.continue ERROR ? _G|success
.continue SHOW
!ERROR
..: Do something here!!
..
!SHOW
New customer(s) created:
.input -TEXT 'U|xtres'
.continue
The great benefit using edp is, that you can use transactions. If one operation fails, all transactions will be rolled back.
There is a workaround via .command
When the invisible-Property is set to 1, the mask doesn't become visible and the dataset is saved immediately.
You can use it as follows:
.formula xtCmd = "<File-Identifier> <new>, Group-Identifier ? param1=value1|param2=value2|[invisible]=1"
.command -WAIT -ID maskID 'U|xtCmd'
Related
So, I'm trying to make a formal module merging tool right now, and everything is working so far, except link copy. Here's how we copy
We empty already baselined reception formal module
We copy object with correct hierarchy
Then we should copy links
(Yes, it's more of a destroy and rebuild tool, than merging, but still, end result is the same)
The problem is, for incoming links, I'm told the source object of the link is inaccessible, even though the formal module is loaded, and I can access and do whatever I want with it. Here's the code to copy Incoming Links
for o in entire PRBaseline do
{
//Once current PBS has been emptied, start recovering objects from baseline
print "Inside Object : " o."IE PUID" "\n" ""
//Once current PBS is emptied & reconstructed to this PBS baseline, do links.
Link incomingLink
Link outLink
Object sourceObject
Object targetObject
for incomingLink in all(o <- "*") do //Iterate on all incoming baselined links, and load source module
{
ModName_ srcModRef = source(incomingLink)
Module temp = edit(fullName(srcModRef),true)
sourceObject = source(incomingLink)
Object oPRCurr
print name srcModRef
print sourceObject."IE PUID" ""
for oPRCurr in modOldPR do
{
print "Currently on Object : " oPRCurr."IE PUID" " and object : " o."IE PUID" "\n" ""
if (oPRCurr."IE PUID" "" == o."IE PUID" "")
{
createLinkset(fullName(srcModRef), fullName(modOldPR), "Test")
print sourceObject."IE PUID" "\n" ""
sourceObject -> "/Test_Access/Test" -> oPRCurr
print "Creating link between source object : " sourceObject."IE PUID" " & target object : " oPRCurr."IE PUID" " from" name srcModRef "\n" ""
}
}
}
}
As for outgoing links I'm not even able to recover the target object of the link, even though I've loaded in edit mode the targeted module
// Continuation of preceding code block
for outLink in all(o -> "*") do
{
ModName_ srcModRef = target(outLink)
print name srcModRef " est la cible \n" ""
Module temp = read(fullName(srcModRef),true)
targetObject = target(outLink)
Object oPRCurr
print name srcModRef
for oPRCurr in modOldPR do
{
print "Currently on Object : " oPRCurr."IE PUID" " and object : " o."IE PUID" "\n" ""
if (oPRCurr."IE PUID" "" == o."IE PUID" "")
{
createLinkset(fullName(srcModRef), fullName(modOldPR), "Test")
oPRCurr -> "/Test_Access/Test" -> targetObject
print "Creating link between target object : " " " " & source object : " oPRCurr."IE PUID" " from" name srcModRef "\n" ""
}
}
}
I'm sorry if I'm already asking a question that's been asked before, but I can't figure out why it doesn't want to work, and I've tried a lot of solutions already.
So, I actually found the answer after a whole lot more of digging. I'll post it below to help people that need to do this.
So, first of all, regarding incoming links the problem to not having access to the link was actually that I recoverd the baseline object, and not the current version object, like that, I was therefore only able to recover info, not edit the object (As it should be !). Therefore the solutionn should be then to actually open the CURRENT module, and find the object via a comparaison key (I hope you have a way to find the object back). Afterwards, I just proceed as before, with the only difference being that I have the current object, and not it's baselined counterpart.
For outgoing links, the matter was a little trickier, I was able to recover my target module name BUT I couldn't load objects from it for the life of me. The problem was, that you have to actually open the baselined module, to recover the baselined object, to recreate the link. To do so, I loaded it like this (know, that I'm iterating on Baseline Sets in this code, that's what the bs variable is)
Module temp = load(test,baseline(major bs, minor bs, suffix bs), true)
and proceeded as before. Now the scripts works perfectly well, so if you need precisions on the way I do this, feel free to ask below, I'll answer to the best of my capacity.
== UPDATE ===
So I realized that Sublime already has a command for adding comments. So if I have code inserted like this:
comment = " ----------------------------------------" + '\n'
comment += " " + title + '\n'
comment += " #author " + author + '\n'
comment += " #url " + url + '\n'
comment += " ---------------------------------------" + '\n'
comment = self.view.run_command('toggle_comment')
code = items['code']
layout = comment + code
self.view.replace(edit, sel[0], layout)
How do I get the command to work so that it comments out the comment variable? Thanks.
Initial Question
I am creating a plugin for Sublime Text 2 and want to make sure that when it inserts/replaces code it inserts comments as well, but to do this I need for it to insert the correct comment types for the various languages. I know that I can run the following command:
view.settings().get('syntax')
And that will return something like this:
Packages/Python/Python.tmLanguage
Is there a way to have it return just PHP, Python, C++, etc.
I'm sure I could do a substring command in Python, but since I can see an easy way of seeing all file settings I wanted to make sure there wasn't a quick easy way of doing this. Thanks for the help.
Are you looking for scope_name ?
scope_name(point) | String | Returns the syntax name assigned to the character at the given point.
im trying to write to a file using this code:
puts "-------------------- TEXT-EDITOR --------------------"
def tor(old_text)
old_text = gets.chomp #
end
$epic=""
def torr(input)
tore= $epic += input + ", "
File.open("tor.txt", "w") do |write|
write.puts tore
end
end
loop do
output = tor(output)
torr(output)
end
i have read the ultimate guide to ruby programming
and it says if i want to make a new line using in the file im writing to using File.open
i must use "line one", "line two
how can i make this happend using gets.chomp()? try my code and you will see what i mean
thank you.
The gets method will bring in any amount of text but it will terminate when you hit 'Enter' (or once the STDIN receives \n). This input record separator is stored in the global variable $/. If you change the input separator in your script, the gets method will actually trade the 'Enter' key for whatever you changed the global variable to.
$/ = 'EOF' # Or any other string
lines = gets.chomp
> This is
> multilined
> textEOF
lines #=> 'This is\nmultilined\ntext'
Enter whatever you want and then type 'EOF' at the end. Once it 'sees' EOF, it'll terminate the gets method. The chomp method will actually strip off the string 'EOF' from the end.
Then write this to your text file and the \n will translate into new lines.
File.open('newlines.txt', 'w') {|f| f.puts lines}
newlines.txt:
This is
multilined
text
If you dont use .chomp() the \n character will be added whenever you write a new line, if you save this to the file it also will have a new line. .chomp() removes those escape characters from the end of the input.
If this doesnt answer your question, i am sorry i dont understand it.
I am quite new in vbs and I would like some of your help on this script.
Basically I need a script that will get my current computername, look into a csv file to get the new related computername and then use that new name to move the corresponding account in the AD to a new OU.
I already know how to get my current computername and how to move an object to a new OU, these are things I have already done, but I am really not confident about parsing the csv looking for the new computername based on my current one.
The new name is the value just after the current name in the csv file. Only separted by a coma.
Edit 1
I tried your solution but as stated in the comments I think there are some things that I don't get. I might misuse the recordset or do not know how to retrieve the information from it. Here is my full script so you can see what I am doing:
'Get the old/current computername
Set wshShell = WScript.CreateObject( "WScript.Shell" )
OldComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
'Parse the xml file to get the related new computername
Dim CONNECTION : Set CONNECTION = CreateObject("ADODB.CONNECTION")
Dim RECORDSET : Set RECORDSET = CreateObject("ADODB.RECORDSET")
CONNECTION.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test\;Extended Properties=""text;HDR=YES;FMT=Delimited"""
RECORDSET.Open "SELECT NewComputerName FROM ComputerList.csv WHERE ComputerName = '& OldComputerName'", CONNECTION, 3, 3
'Move the new computername in the target AD to a new OU
Dim NewComputerName
Dim OldLocation
NewComputerName = RECORDSET
OldLocation = "LDAP://CN=" & NewComputerName & ",OU=Staging,OU=Workstations,DC=contoso,DC=lab"
Set objNewOU = GetObject("LDAP://OU=Migration,OU=Workstations,DC=contoso,DC=lab")
Set objMoveComputer = objNewOU.MoveHere(OldLocation, vbNullString)
' It does not work as it said Error: Wrong number of arguments or invalid property assignment pour la ligne:
' OldLocation = "LDAP://CN=" & NewComputerName & ",OU=Staging,OU=Workstations,DC=contoso,DC=lab"
Thanks a lot for your help ! :)
You can use ADO to read CSV (and other delimited) files. The gory details are discussed in this article. Sample code for reading a simple CSV file using VBScript is as follows:
Note: the CSV file needs a header line in order for ADO to use column names:
ComputerName,NewComputerName
Computer #1,Other Computer #1
Computer #2,Other Computer #2
Computer #3,Other Computer #3
VBScript Code:
option explicit
dim CONNECTION : set CONNECTION = CreateObject("ADODB.CONNECTION")
dim RECORDSET : set RECORDSET = CreateObject("ADODB.RECORDSET")
CONNECTION.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Folder\Containing\CSV\File\;Extended Properties=""text;HDR=YES;FMT=Delimited"""
RECORDSET.Open "SELECT * FROM data.csv WHERE ComputerName = '" & OldComputerName & "'", CONNECTION, 3, 3
' //// For testing \\\\
WScript.Echo RECORDSET.Source
' \\\\ For testing ////
if RECORDSET.EOF then
WScript.Echo "Record not found"
WScript.Quit
else
dim NewComputerName : NewComputerName = RECORDSET("NewComputerName") & ""
WScript.Echo NewComputerName
end if
Note that this code might not work on 64-bit OS -- not directly. You must run 32-bit version of CScript/WScript like so:
%windir%\SysWoW64\cscript c:\Path\To\test.vbs
Ok the script works perfectly now thanks to your modifications ! :)
But I've got one more trouble, it seems that I cannot open the csv file in the FROM clause when this file have - in the name.
Like : CONTOSO-US-ComputerList.csv I get the error Syntax error in FROM clause
But when I use a file name without dashes there is no problem.
I know it is a detail but I have no choice than having a file with dashes in the name :/
Thanks again for your help :) Very much appreciated !!
EDIT:
Nevermind I found the solution thanks to the scriptingguys !
The request now looks like this:
strFile = "[CONTOSO-ComputerList.csv]"
RECORDSET.Open "SELECT * FROM " & strFile & " WHERE ComputerName = '" & OldComputerName & "'", CONNECTION, 3, 3
What is the easiest method for joining/merging all files in a folder (tab delimited) into a single file? They all share a unique column (primary key). Actually, I only need to combine a certain column and link on this primary key, so the output file would contain a new column for each file. Ex:
KEY# Ratio1 Ratio2 Ratio3
1 5.1 4.4 3.3
2 1.2 2.3 3.2
etc....
There are many other columns in each file that I don't need to combine in the output file, I just need these "ratio" columns linked by the unique key column.
I am running OS X Snow Leopard but have access to a few Linux machines.
use the join(1) utility
I actually spent some time learning Perl and solved the issue on my own. I figured I'd share the source code if anyone has a similar problem to solve.
#!/usr/bin/perl -w
#File: combine_all.pl
#Description: This program will combine the rates from all "gff" files in the current directory.
use Cwd; #provides current working directory related functions
my(#handles);
print "Process starting... Please wait this may take a few minutes...\n";
unlink"_combined.out"; #this will remove the file if it exists
for(<./*.gff>){
#file = split("_",$_);
push(#files, substr($file[0], 2));
open($handles[#handles],$_);
}
open(OUTFILE,">_combined.out");
foreach (#files){
print OUTFILE"$_" . "\t";
}
#print OUTFILE"\n";
my$continue=1;
while($continue){
$continue=0;
for my$op(#handles){
if($_=readline($op)){
my#col=split;
if($col[8]) {
$gibberish=0;
$col[3]+=0;
$key = $col[3];
$col[5]+=0; #otherwise you print nothing
$col[5] = sprintf("%.2f", $col[5]);
print OUTFILE"$col[5]\t";
$continue=1;
} else {
$key = "\t";
$continue=1;
$gibberish=1;
}
}else{
#do nothing
}
}
if($continue != 0 && $gibberish != 1) {
print OUTFILE"$key\n";
} else {
print OUTFILE"\n";
}
}
undef#handles; #closes all files
close(OUTFILE);
print "Process Complete! The output file is located in the current directory with the filename: _combined.out\n";