Batch Programs Thread.

Started by macdad-, June 16, 2008, 06:24:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Salmon Trout



DaveLembke

Salmon said back in January... Did a ghost press the power button?

Not rezzing this, but just sharing that WOL has been known to be a problem at times with PC's getting a WOL signal and starting themselves. I had a Zotac Mini ITX build that kept turning itself on. It wasn't until I disabled WOL that the problem was solved. The guy putting a batch into startup to check to see if he is there and if no response after a count down to force shutdown the system likely has WOL enabled and its getting triggered to start. Disabling WOL will probably fix this without the batch needed.

Salmon Trout

Quote from: JoshCM on June 29, 2018, 11:36:32 AM
Nope.
Your spelling needs attention, as well as your manners.

patio

A curtsy is grabbing your dress corners and doing a 3/4 kneel...
" Anyone who goes to a psychiatrist should have his head examined. "

Salmon Trout

Quote from: patio on June 29, 2018, 04:38:18 PMA curtsy is grabbing your dress corners and doing a 3/4 kneel...
Interestingly, curtsy (noun/verb: knee bend) can be spelled curtsey and courtesy, but courtesy (noun: politeness) has only one spelling.

BC_Programmer

Quote from: Salmon Trout on June 30, 2018, 12:34:52 AM
Interestingly, curtsy (noun/verb: knee bend) can be spelled curtsey and courtesy, but courtesy (noun: politeness) has only one spelling.

Curtsey's with respect.
I was trying to dereference Null Pointers before it was cool.

JoshCM

Quote from: Salmon Trout on June 29, 2018, 12:43:16 PM
Your spelling needs attention, as well as your manners.
My bad manners were because of someone else who also had bad manners. Although I made a spelling error in that post, I managed to get though college on the Dean's list. So I'm satisfied with my level of education at this time. Trolling is a waste of your time. There is so much to be learned. There is so much to see. So many experiences to be had. Get out there and make it happen man.

Brentrubin

Can anyone help me make this script work?

I'm making this simple program to use at work because I multiply stuff by the same number, all day, every day.

I want to be able to enter a variable and multiply it by 1.2

See below for code

:cost
cls
echo.
echo.
echo.
echo.
echo.
echo Please enter the freight cost provided from AllStates WorldCargo website.
echo.
set /P num1multiply=
echo.
set a=1.2
echo.
set /A Ans=%num1multiply% * %a%
echo.
echo The cost is: %Ans%
echo.
pause
exit

Can anyone please help me make this work?

I keep getting "missing operator" message

Thanks!

nil

Unfortunately MS-DOS doesn't do floating point operations. If you want precise math you'll have to use another scripting language, like VBScript or Python.

Python 3 can be downloaded at https://www.python.org/downloads/release/python-370/. (Scroll down for windows installer)

Your script in Python 3:

prompt = "Please enter the freight cost. "
multiplicand = float(input(prompt))
multiplier = 1.2
product = multiplicand * multiplier
print("The cost is", product)
exit(0)


save as (for instance) cargo.py, and run with python cargo.py

example operation:

Please enter the freight cost. 1.618                     
The cost is 1.9416


Hope this helps


Do not communicate by sharing memory; instead, share memory by communicating.

--Effective Go

brunoteta

Hi, need help to create a .batch file to open paint(or oder image editor), one or more images, cut top left corner (custom width x height), select "pick color" tool to fill the hole, save and close.

its possible? thanks

Squashman

Quote from: brunoteta on March 14, 2019, 07:48:42 PM
Hi, need help to create a .batch file to open paint(or oder image editor), one or more images, cut top left corner (custom width x height), select "pick color" tool to fill the hole, save and close.

its possible? thanks
No.  Batch files cannot interact with Graphical User Interfaces.

Geek-9pm

Quote from: Squashman on March 16, 2019, 09:15:58 PM
No.  Batch files cannot interact with Graphical User Interfaces.
True.
The alternative is some kind of automation program that will invoke things like a human would. Either keystrokes or mouse movements.
Here is a link that might be relevant:

5 best programs to automate PC tasks


He includes AutoHotkey
Here is the CH archive about AutoHotKey:
https://www.computerhope.com/jargon/a/autohotkey.htm
AutoHotkey is a fantastic free and open source Microsoft Windows tool that allows you to create macros, scripts, and automate frequently performed tasks on your computer. For example, Computer Hope uses this tool daily to help answer common questions asked in e-mail quickly and perform other common repetitive tasks.
It does have a learning g curve. But it is worth the effort.  :)

Salmon Trout

There is a program called ImageMagick (spelled thus) which can do most or all of the OP's tasks from a script or the command line.

Hackoo

Hi  ;)
I want to share with you this little batch : System_Info_HTML_Output.bat

@echo off
CHCP 65001>nul
Title System Info With HTML Output by Hackoo 2022
Color 0B & Mode 57,3
Set Systeminfo_TXT=%~dp0Systeminfo_TXT.txt
Set Systeminfo_HTML=%~dp0systeminfo.html
echo(
systeminfo>"%Systeminfo_TXT%"
call :CreateHTMLtable "%Systeminfo_TXT%" "%Systeminfo_HTML%"
Start "" "%Systeminfo_HTML%"
Exit /b
::------------------------------------------------------------------------------------------------------------------------------------------------------
:CreateHTMLTable <inputfile> <outputfile>
>"%~2" (
echo ^<!DOCTYPE HTML PUBLIC
echo "-//W3C//DTD HTML 4.01 Transitional//EN"
echo  "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"^>
echo ^<HTML^>
echo ^<HEAD^>
echo ^<META HTTP-EQUIV="Content-Type"
echo CONTENT="text/html; charset=utf-8"^>
echo ^</HEAD^>
echo ^<BODY^>
echo ^<style type="text/css"^>
echo .tftable {font-weight: bold;font-size:16px;color:#333333;width:100%;border-width: 1px;border-color: #bcaf91;border-collapse: collapse;}
echo .tftable th {font-size:16px;background-color:#ded0b0;border-width: 1px;padding: 8px;border-style: solid;border-color: #bcaf91;text-align:left;}
echo .tftable tr {background-color:#e9dbbb;}
echo .tftable td {font-size:16px;border-width: 1px;padding: 8px;border-style: solid;border-color: #bcaf91;}
echo .tftable tr:hover {background-color:#ffffff;}
echo ^</style^>
echo ^<center^>^<table class="tftable" border="1"^>
)
@for /f "tokens=1,* delims=:" %%a in ('Type "%~1"') do (
>>"%~2" echo ^<tr^>^<td^>%%a^</td^>^<td^>%%b^</td^>^</tr^>
)
>>"%~2" (
echo ^</table^>
echo ^</BODY^>
echo ^</HTML^>
)
Exit /B
::------------------------------------------------------------------------------------------------------------------------------------------------------