Facing issue while exporting the report from Tally using command line - tally

We want some functionality where we can export the report using the command line so that we can execute that command through some batch file and export reports on a daily schedule time.
Issue:
For this ,we are trying some code snippet from Tally developer "Help --> TDL Sample"(this is complete path of sample code C:\Program Files\TallyPrimeDeveloper\Samples\Whats New\Rel 3.x\Rel 3.0\Programmable Configurations\Export Report Trial Balance.txt).
The following code sample works properly on button click and we are successfully exported the report in our folder
"""[Button: TSPL Smp Export PC]
Key : Ctrl + E
Action : Call : TSPL Smp PC Export Report
Title : "Export Report"
;; Function Definition begins
[Function: TSPL Smp PC Export Report]
Local Formula : SysDate : $$SysInfo:SystemDate
00 : SET : SVExportLocation : "."
10 : SET : SVExportFormat : $$SysName:PDF
20 : SET : SVPrintFileName : "List of Ledgers as onShri_1234 " + $$String:#SysDate + ".PDF"
30 : SET : SVPrintFileName : $$MakeExportName:##SVPrintFileName:##SVExportFormat
40 : EXPORT REPORT : . : TRUE
50 : Msg Box : "TestMsg2" :"We need to download this report through command line" """
But we are facing issue when we are trying to call this same function through command line
Command line is : "C:\Program Files\TallyPrime\tally.exe" /Load:10000 /Action:Call:TSPLSmpPCExportReport .
As per our observations and debugging, the above function gets successfully called through the command line because when I am executing it through the command line,I am getting a "TestMsg2" popup but the file is not getting exported. It seems there is some issue only in file export through the command line, not in function calling through the command line.

I have a solution that works, but without TDL and uses C# or Python
Using C# you can create console app, and you can use that in command line
using Python, you can create script and run from command line
Refer this video for python

Related

how to enable the neon glow in synthwave 84 on windows?

it shows "You must run VS code with admin privileges in order to enable Neon Dreams.".It doesn't work even after running vs-code as administrator.
The error is caused by the new version of VSCode, the extension normally change the workbench files of electron-browser but electron-browser was removed in the commit https://github.com/microsoft/vscode/tree/f4f1b04d872a2b94d9a5105a1eefb81a213c07f2 and it has been replaced by electron-sandbox.
So you have 2 choices :
You can go back to previous version of VSCode (1.69 June version) by downloading it here https://code.visualstudio.com/updates/v1_69 and then run VSCode as Administrator and enable neon dreams again
Or
You can stay in 1.70 and modify manually the extension :
Go to "C:/Users/YourUsername/.vscode/extensions/robbowen.synthwave... or wherever your vscode extensions are stored
Go to src/ and open extension.js
You will have to replace all the "electron-browser" with "electron-sandbox" so
const htmlFile =
base +
(isWin
? "\\electron-browser\\workbench\\workbench.html"
: "/electron-browser/workbench/workbench.html");
const templateFile =
base +
(isWin
? "\\electron-browser\\workbench\\neondreams.js"
: "/electron-browser/workbench/neondreams.js");
on line 34 become
const htmlFile =
base +
(isWin
? "\\electron-sandbox\\workbench\\workbench.html"
: "/electron-sandbox/workbench/workbench.html");
const templateFile =
base +
(isWin
? "\\electron-sandbox\\workbench\\neondreams.js"
: "/electron-sandbox/workbench/neondreams.js");
and same operation at line 149 on
var htmlFile =
base +
(isWin
? "\\electron-browser\\workbench\\workbench.html"
: "/electron-browser/workbench/workbench.html");
Save extension.js, close VSCode, open VSCode as Administrator and Enable Neon Dreams again.
Hope it helps !
Following the advise of S.Mollet to find and replace electron-browser with electron-sandbox worked; only difference I was on mac, but principal was same.
Find vs code extension files, mine were in ~/.vscode/exentions/robb...
and then to run vs code with admin I ran sudo code --user-data-dir="~/.vscode-root"
and then in vs code press ⌘-p and select enable dreams.
I was losing so much productivity while my font wasnt glowing, smh.

Powershell forms application different output in console and ISE

I created complex forms application in powersheel and it is running correctly in Powershell ISE and powershell console too, but there is little difference in behaviour:
when I run application by double clicking in windows explorer, powershell console opens, but there is toooo much of "debug" data from creating all form controls(checkboxes, labels, buttons...). It takes too long to start and it looks like this:
TextImageRelation : Overlay UseMnemonic : True UseCompatibleTextRendering : True UseVisualStyleBackColor : True AccessibilityObject : ControlAccessibleObject: Owner = System.Windows.Forms.CheckBox, CheckState: 0 AccessibleDefaultActionDescription : AccessibleDescription : AccessibleName : AccessibleRole : Default AllowDrop : False Anchor : Top, Left AutoScrollOffset : {X=0,Y=0} LayoutEngine : System.Windows.Forms.Layout.DefaultLayout BackgroundImage : BackgroundImageLayout : Tile BindingContext : {} Bottom : 208 Bounds : {X=165,Y=190,Width=96,Height=18} CanFocus : False CanSelect : False Capture : False CausesValidation : True ClientRectangle : {X=0,Y=0,Width=96,Height=18}
This output is not in powershell ISE(there is none) - there application starts immediately.
I was not able to resolve this issue and I would like to remove debug output when run from console, if it is possible - to speed up script start.
Script source code is same as examples on internet, for example like this:
https://learn.microsoft.com/en-us/powershell/scripting/samples/creating-a-custom-input-box?view=powershell-7
I tried yo add | Out-Null to some controls/rows - which i saw in logs, but it did not help.
Also I tried to identify which command is making output by manually adding some controls to console, but none generated that output.
I tried to create ISE profile and load it in script run from console, but it did not help, because created profile file was empty.
If I run new console window like this:
start-process powershell -argumentlist "-noexit", "-noprofile" and run script from that, it works without logs.
But if I run script like this:
start-process powershell -argumentlist "-noexit", "-noprofile", "-command $path"
it outputs logs again.
Any ideas how to do it? What should I check/modify.
Thank you.
solved: problem was a space in script name as I mentioned in comment.

powershell not expanding variable

I am trying to create a powershell script which installs a load of firewall policies.
I have a file firewalls.txt which has "firewall" "policy" on a single line. I then put that into a variable and try to call it using the "fwm load" command which is an external firewall application binary but the $fwPolstring is not being expanded within the command
$fwPol = Get-Content firewalls.txt
$fwPolString = $fwPol
fwm load "$fwPolString" 2>&1 > InstallLog.txt
I get error in InstallLog.txt
fwm : Missing targets
At C:\fw_estate_install.ps1:3 char:1
+ fwm load "$fwPolString" 2>&1 > InstallLog.txt

Installing an exe with Powershell DSC Package resource gets return code 1619

I'm trying to use Powershell DSC's Package resource to install an exe... Perforce's P4V to be specific. Here's my code:
Configuration PerforceMachine
{
Node "SERVERNAME"
{
Package P4V
{
Ensure = "Present"
Name = "Perforce Visual Components"
Path = "\\nas\share\p4vinst64.exe"
ProductId = ''
Arguments = "/S /V/qn" # args for silent mode
LogPath = "$env:ProgramData\p4v_install.log"
}
}
}
When running this, this is the error Powershell gives me:
PowerShell provider MSFT_PackageResource failed to execute Set-TargetResource functionality with error message: The return code 1619 was not expected. Configuration is likely not
correct
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : SERVERNAME
According to documentation, return code 1619 means the MSI package couldn't be opened. However, when I manually log in to the machine and run "\\nas\share\p4vinst64.exe /S /V/qn", the install works flawlessly.
Does anyone know why this is failing? Alternately, can anyone tell me how to troubleshoot this? I pasted all the error information I got from the terminal, my log file (p4v_install.log) is a 0 byte file, and there are no events in the event viewer. I don't know how to troubleshoot it any further!
EDIT: I should note that I also tried using the File resource to copy the file locally, and then install it from there. Sadly, that met with the same result.
Daniel over at the Powershell.org forums was able to figure this out for me.
The P4V InstallShield setup wrapper puts the MSI file into wrong path if you execute as LocalSystem.
I’ve managed to develop a Configuration that works, see below. The key is the /b switch here which puts the MSI file into a defined location. I’ve added ALLUSERS=1 to get the shortcuts visible to all users and REBOOT=ReallySuppress to avoid a sudden restart (which will happen otherwise).
Configuration PerforceMachine
{
Package P4V
{
Ensure = "Present"
Name = "Perforce Visual Components"
Path = "C:\My\p4vinst64.exe"
ProductId = ''
Arguments = '/b"C:\Windows\Temp\PerforceClient" /S /V"/qn ALLUSERS=1 REBOOT=ReallySuppress"' # args for silent mode
}
}
Well, what happens here is that the package gets installed (not tested with p4vinst64.exe yet! So, not sure why it says pack cannot be opened as the error) but since you did not specify a ProductID value, the verification at the end of install fails. That is the error you are seeing. The Package resource is no good for installing .exe packages or even MSIs with no ProductID represented as a GUID.
You can use the WindowsProcess resource instead.

Powershell 2 ISE, not stopping on breakpoints in imported modules

When we set breakpoints within a Module we've imported the debugger ignores the breakpoint. Has anybody else seen this behaviour?
This is driving me nuts, we use PowerShell Modules extensively.
The thing that's really weird is I can see the breakpoint if I run get-psbreakpoint
PS H:\Projects\Powershell> get-psbreakpoint | format-list -force
Id : 0
Script : H:\projects\Powershell\Shared\SFTP\SFTP.psm1
Line : 25
Column : 0
Enabled : True
HitCount : 0
Action :
Id : 1
Script : H:\projects\Powershell\Trading\CPPIB\scripts\CppibBorrowReturns.ps1
Line : 12
Column : 0
Enabled : True
HitCount : 1
Action :
EDIT: Seems to work if I delete the psd1 (Manifest file)
Debugging modules can be tough. One way I have been able to do it is load both the module and the code that calls the function you are debugging. In the code that calls a function in the module, place a break point. Then when it its the call to the function in the module, step in to it. Once it steps into the module you should be able to hit F5 again to hit your break point in the module.
Sorry if that is not as clear as it should be, still reeling from day light savings on a Monday.