Solomon Posted January 14, 2007 Share Posted January 14, 2007 With the help of the guys here, I created a script for cleaning up the My Documents folder on my sisters PC. She's now requested a few features that I've coded and tested. But, I actually have 3 separate scripts. They work fine individually, but I can't work out how to join them together into one compilable script.Part 1 is the file moving script.$activedir = IniRead("fm.ini", "dir", "active", "ValueNotFound") FileChangeDir($activedir) $audio = IniRead("fm.ini", "types", "audio","ValueNotFound") $audiodir = IniRead("fm.ini", "dir", "audio", "valuenotfound") $pic = IniRead("fm.ini", "types", "pic","ValueNotFound") $picdir = IniRead("fm.ini", "dir", "pic", "valuenotfound") $text = IniRead("fm.ini", "types", "text","ValueNotFound") $textdir = IniRead("fm.ini", "dir", "text", "valuenotfound") $process = IniRead("fm.ini", "process", "processname", "ValueNotFound") $delay = Iniread("fm.ini", "process", "delay", "ValueNotFound") while ProcessExists($process) $audioArray = StringSplit ( $audio, "|" ) For $a = 1 To $audioArray[0] FileMove($audioArray[$a], $audiodir) Next $picarray = StringSplit ( $pic, "|") For $p = 1 To $picarray[0] FileMove($picarray[$v], $picdir) Next $textarray = StringSplit ( $text, "|") For $t = 1 To $textarray[0] FileMove($textarray[$s], $textdir) Next Sleep($delay) WEndoÝ÷ Ù8b±¶¬Æ¥)¨½ëW¢Ø^rëyË_¢W^®ÆÚ±çhÜ©y(^j[(0j{l¶y«në-¡·nW¢ÈnµÚ0Ø^(Part 3 is for the most part copied from the help file.)What I'd like to know is how to put all these together in one script so that I can compile it, and get all the functionality. I've tried putting them all in the same script, and running it, but I only seem to get 1 functionality (the file moving part, for example) working at a time. :"> This is the first time I've done something like this (adding multiple functionalities to a script) and I'm having trouble finding a guide as to how the script should be laid out. I'm really curious as to why (and how) the script should be laid out in a certain way, but I can't find anything. :"> Anyone who can point me in the right direction will get my undying gratitude. Link to comment Share on other sites More sharing options...
BALA Posted January 14, 2007 Share Posted January 14, 2007 Why not create a simple GUI where you have a button for each of the three parts. [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
Valuater Posted January 14, 2007 Share Posted January 14, 2007 maybe... expandcollapse popup#Include <Constants.au3> #NoTrayIcon Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown. $audio = TrayCreateItem("Audio Dir") TrayCreateItem("") $picture = TrayCreateItem("Picture Dir") TrayCreateItem("") $text = TrayCreateItem("Text Dir") TrayCreateItem("") $Copyitem = TrayCreateItem("Copy Folders") TrayCreateItem("") $Shutdownitem = TrayCreateItem("Shutdown") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $audio Run("explorer.exe" & " /root,d:\my docs\my music") Case $msg = $picture Run("explorer.exe" & " /root,d:\my docs\my pictures") Case $msg = $text Run("explorer.exe" & " /root,d:\my docs\my texts") Case $msg = $exititem ExitLoop Case $msg = $Copyitem Set_Copy() Case $msg = $Shutdownitem Set_Shutdown() EndSelect WEnd Func Set_Copy() $activedir = IniRead("fm.ini", "dir", "active", "ValueNotFound") FileChangeDir($activedir) $audio = IniRead("fm.ini", "types", "audio", "ValueNotFound") $audiodir = IniRead("fm.ini", "dir", "audio", "valuenotfound") $pic = IniRead("fm.ini", "types", "pic", "ValueNotFound") $picdir = IniRead("fm.ini", "dir", "pic", "valuenotfound") $text = IniRead("fm.ini", "types", "text", "ValueNotFound") $textdir = IniRead("fm.ini", "dir", "text", "valuenotfound") $process = IniRead("fm.ini", "process", "processname", "ValueNotFound") $delay = IniRead("fm.ini", "process", "delay", "ValueNotFound") While ProcessExists($process) $audioArray = StringSplit($audio, "|") For $a = 1 To $audioArray[0] FileMove($audioArray[$a], $audiodir) Next $picarray = StringSplit($pic, "|") For $p = 1 To $picarray[0] FileMove($picarray[$p], $picdir) Next $textarray = StringSplit($text, "|") For $t = 1 To $textarray[0] FileMove($textarray[$t], $textdir) Next Sleep($delay) WEnd EndFunc ;==>Set_Copy Func Set_Shutdown() $Dir = IniRead("fm.ini", "shutdown", "dir", "ValueNotFound") $Shutdown = IniRead("fm.ini", "shutdown", "shutdown", "ValueNotFound") $delay = IniRead("fm.ini", "shutdown", "delay", "ValueNotFound") While FileExists($Dir & "\*.*") Sleep($delay) WEnd Sleep(60000) If $Shutdown = "9" Then Shutdown(9) If $Shutdown = "32" Then Shutdown(32) If $Shutdown = "64" Then Shutdown(64) EndFunc ;==>Set_Shutdown 8) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now