Jump to content



Photo

Create folder using variable as name


  • Please log in to reply
4 replies to this topic

#1 Tigerweld

Tigerweld

    Wayfarer

  • Active Members
  • Pip
  • 78 posts

Posted 27 December 2007 - 07:32 PM

It's me again Margret, the noob. I've spent 30 minutes on trying to figure this out and I know it's gotta be simple. I've searched the forums for one like it and cannot come up with anything. What I need to do is create a folder using the varible name.

DriveMapAdd ("y:", "\\DG8BRR11\Deployment Server\rips")

$computername = regread("HKLM\SYSTEM\CONTROLSET001\CONTROL\COMPUTERNAME\COMPUTERNAME" , "COMPUTERNAME")

if not fileexists("y:\rips\$computername") then
dircreate("y:\$computername")
endif

I know I don't have it right as it is actually creating a folder called $computername. What am I missing here?





#2 Swift

Swift

    Get Linux Ubuntu Now.

  • Banned (NOT IN USE)
  • 1,706 posts

Posted 27 December 2007 - 07:34 PM

what exactly...are you asking? :)

#3 SpookMeister

SpookMeister

    Peanut Gallery

  • Active Members
  • PipPipPipPipPipPip
  • 840 posts

Posted 27 December 2007 - 07:37 PM

It's me again Margret, the noob. I've spent 30 minutes on trying to figure this out and I know it's gotta be simple. I've searched the forums for one like it and cannot come up with anything. What I need to do is create a folder using the varible name.

DriveMapAdd ("y:", "\\DG8BRR11\Deployment Server\rips")

$computername = regread("HKLM\SYSTEM\CONTROLSET001\CONTROL\COMPUTERNAME\COMPUTERNAME" , "COMPUTERNAME")

if not fileexists("y:\rips\$computername") then
dircreate("y:\$computername")
endif

I know I don't have it right as it is actually creating a folder called $computername. What am I missing here?

$computername cant be in the quotes:
if not fileexists("y:\rips\" & $computername) then     dircreate("y:\" & $computername) endif

Helpful tips:If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.Useful links:BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE

<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers


#4 The Kandie Man

The Kandie Man

    All Your Base Are Belong To Us

  • Active Members
  • PipPipPipPipPipPip
  • 950 posts

Posted 27 December 2007 - 07:38 PM

DriveMapAdd ("y:", "\\DG8BRR11\Deployment Server\rips") If Not fileexists("y:\rips\" & @ComputerName) then     DirCreate("y:\" & @ComputerName) EndIf


That is correct syntax. Maybe that is what you are looking for?

- The Kandie Man ;-)
"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

#5 Tigerweld

Tigerweld

    Wayfarer

  • Active Members
  • Pip
  • 78 posts

Posted 27 December 2007 - 07:47 PM

MAN, I knew I was close. I got a lot to learn. Thanks guys! This is the fastest replying forum I've ever seen!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users