DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA: Popup box to automate command prompt daily file copy task  (Read 8,150 times)

shudap

  • Participant
  • Joined in 2008
  • *
  • Posts: 1
First off just want to say Donation Coder rocks. FARR and Clipboard Help+Spell are my top 2 favorites utilities on my computers.

I was hoping someone could help me with the following task i do a lot daily?

I copy a file from a mapped network share to my computer daily and the file is tagged  with a number and then a description. Currently I do the following to complete this task:

start -> run -> cmd.exe
x:
copy *1234567*.zip c:\share
exit


I was hoping someone would be able to show me a method that would allow for instance the following.

I would hit a hotkey (win+c) that launches a small pop-up box that prompts for the “1234567” value mentioned above, then in the background the application switch's to the mapped drive “x:” and runs the copy command for me. If it cant find the file, I was wondering if its possible to have a “retry” button possibly?

Thanks for reading this and keep up the great work, i love the website.
« Last Edit: February 24, 2008, 03:11 AM by shudap »

tinjaw

  • I'm so glad breakbeat techno isn't an illegal drug
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • Participated in NANY Challenge Twice
    • Coding Snacks
    • Military Service Badge - US Army
    • Linux User
Re: IDEA: Popup box to automate command prompt daily file copy task
« Reply #1 on: February 24, 2008, 03:12 AM »
People here hate me because I use AutoIt 3 instead of AutoHotKey. So, I am sure they will respond in 34.54637 seconds on how to do it in AHK. Until then, this AutoIt 3 script is what you can use.

Code
; shudap's app
; shudap.au3

$filename = InputBox ( "shudap's app", "Wutz da name fur der file, aay?")
FileCopy ( "C:\" & $filename & ".zip", "C:\TEMP")

You can get AutoIt 3 and learn more at your leisure.

I'll let you try capturing the result/error code and doing a retry. If you need help just shout.

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: IDEA: Popup box to automate command prompt daily file copy task
« Reply #2 on: February 24, 2008, 11:29 AM »
"Wutz da name fur der file, aay?"
;D ;D ;D

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • Participated in NANY Challenge Twice
    • Coding Snacks
Re: IDEA: Popup box to automate command prompt daily file copy task
« Reply #3 on: March 23, 2008, 09:27 PM »
:) Only love, tinjaw, but here's a more elaborate AutoHotkey version.

Skrommel

Code
;Press a hotkey to show a file copy dialog 
;Skrommel @ 2008

file=1234567
source=X:\
target=C:\Share
hotkey=#c

#NoEnv
#SingleInstance,Force
If hotkey<>
{
  Hotkey,%hotkey%,DIALOG
  Return
}

DIALOG:
Gui,Destroy
Gui,Add,Text,,Filename:
Gui,Add,Edit,w200 vfile,%file%
Gui,Add,Text,,Source:
Gui,Add,Edit,w200 vsource,%source%
Gui,Add,Text,,Target:
Gui,Add,Edit,w200 vtarget,%target%
Gui,Add,Button,x+5 w75 GCOPY Default,&Copy
Gui,Add,StatusBar,,www.1HourSoftware.com
Gui,Show,,Copy
Return


COPY:
Gui,Submit,NoHide
SB_SetText("Copying " source . file " to " target "...")
StringRight,char,source,1
If (char<>"\")
  source.="\"
StringRight,char,target,1
If (char<>"\")
  target.="\"
IfNotExist %source%%file%
{
  SB_SetText("Unable to find source " source . file)
  Return
}
FileCreateDir,%target%
IfNotExist %target%
{
  SB_SetText("Unable to find target " target)
  Return
}
FileCopy,%source%%file%,%target%,1
If ErrorLevel=0
  SB_SetText("Finished copying " source . file " to " target)
Else
  SB_SetText("Unable to copy " source . file " to " target)
Return

razlin

  • Participant
  • Joined in 2008
  • *
  • Posts: 2
Re: IDEA: Popup box to automate command prompt daily file copy task
« Reply #4 on: March 26, 2008, 02:24 PM »
This could actually be done very very easily with a dos .bat file

create a file   

copy_my_file.bat
Code
copy n:\myfile.ext c:\newfile.ext



Thats it   n:\ is your network file and  c:\ is your new file   or vice versa.

to run it just 2ble click the .bat file.
« Last Edit: March 26, 2008, 02:28 PM by razlin »

Original address: https://www.donationcoder.com/forum/index.php?topic=12440.0