Jump to content

Dircreate with clipget() variables wont dircreate..


Recommended Posts

the title pretty much says it.

this is the part im having trouble with.

$name = ($first & " " & $last)
DirCreate(@DesktopDir & '\' & $first & $last & " " & @MON & @MDAY & "11")
DirCreate(@DesktopDir & '\' & $Name & " " & @MON & @MDAY & "11")

neither of those will create a folder.

when i make the variables:

first = ("richard")

last = ("nixon")

it works

below is the entire code. consolewrite at the end will show me the first and last name so i know they're getting put into $first and $last. im almost 100% that this is some formatting thing on my part. it almost always is.

WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
send ("!N")
send ("name")
send ("!F")
Winactive ("Find")
send ("{esc}")
send ("{right}")
send ("{SHIFTDOWN}")
send ("{down}")
send ("{shiftup}")
send ("^C")
$first = ClipGet ()
WinActivate ("[CLASS:Notepad]")
WinWaitActive ("[CLASS:Notepad]")
send ("{altdown}")
send ("E")
send ("F")
send ("{ALTUP}")
send ("!N")
send ("name")
send ("!F")
Winactive ("Find")
send ("{esc}")
send ("{right}")
send ("{SHIFTDOWN}")
send ("{down}")
send ("{shiftup}")
send ("^C")
$last = clipget ()
ConsoleWrite ($first)
ConsoleWrite ($last)
$name = ($first & " " & $last)
DirCreate(@DesktopDir & '\' & $first & $last & " " & @MON & @MDAY & "11")
DirCreate(@DesktopDir & '\' & $Name & " " & @MON & @MDAY & "11")
ConsoleWrite ($first)
ConsoleWrite ($last)
<--a good way to start you day
Link to comment
Share on other sites

Why are you using Notepad and the clipboard to get the first and last names from a text file? That seems like a very error prone way of obtaining this information first of all. What does your console output show for $first and $last after you've copied them this way? Are there any characters in them that might cause issues with creating a folder from them, and have you tried creating them in a different location to make sure it's not a permissions issue on the desktop?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

this is for a business card order. when i get the order, its formatted in HTML, and ive found the quickest way to make it searchable is to save it as plain text. basicly, i get it in HTML, it goes to plain text, i search it then the info gets dropped into InDesign. its a messy process, but its pretty rock solid the way i have it setup.

the console outputs:

richard

nixon

just like that. i havent tried a different directory, but dir create works when im not using the variables from that get info from clipget. ie,

$first = ("richard")
$last = ("nixon")
DirCreate(@DesktopDir & '\' & $first & $last & " " & @MON & @MDAY & $year & " ")

works i get a folder named "richard nixon 092811"

but when i use

;code that copies
$first = clipget ()
;other code that copies
$last = clipget ()
DirCreate(@DesktopDir & '\' & $first & $last & " " & @MON & @MDAY & $year & " ")

it ouputs "092811". no name.

Edited by RogerRabbitsClone
<--a good way to start you day
Link to comment
Share on other sites

You need to put quotes around the string that's going to be your folder name, because there's a space in it the name gets mangled when you go to create the folder. You'd need a quote before the @DesktopDir and after the last character of the folder name, if you use all single quote characters around all of the strings inside the folder name, you can use double quotes around the entire string without having to get fancy with them.

Also, as an FYI, you don't need the parentheses around the strings when setting a variable.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...