topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday April 18, 2024, 5:17 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

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

shudap

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
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 23, 2008, 09:11 PM by shudap »

tinjaw

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • View Profile
    • Donate to Member
Re: IDEA: Popup box to automate command prompt daily file copy task
« Reply #1 on: February 23, 2008, 09:12 PM »
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.

; 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

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Popup box to automate command prompt daily file copy task
« Reply #2 on: February 24, 2008, 05:29 AM »
"Wutz da name fur der file, aay?"
;D ;D ;D

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: Popup box to automate command prompt daily file copy task
« Reply #3 on: March 23, 2008, 04:27 PM »
 :) Only love, tinjaw, but here's a more elaborate AutoHotkey version.

Skrommel

;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
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: IDEA: Popup box to automate command prompt daily file copy task
« Reply #4 on: March 26, 2008, 09:24 AM »
This could actually be done very very easily with a dos .bat file

create a file   

copy_my_file.bat
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, 09:28 AM by razlin »