Jump to content

Noob, with simple question


Recommended Posts

Greets,

I have been playing with autoit. I like it. I am using it to automate program installs for an unattended cd. I got that mostly figured out. Now, moving on to better things. Now I am using it to customize my start menu. Using some fucntions and such. Here is my question.

What is the #Region? Is it similar to #cs#ce? Doesn't have any documentation that I can find. It looks like the old batch file :Heading thing, where you can call the script back to that area. I am hoping that is what it is. If it is not, what is it.

And, if it is not, is there a way to do just that. I notice that the "Goto" feature is gone (not that I messed with this when it was there :) ).

So basically I am giving variable for the default start menu folder, such as Adobe Acrobat. Then I pass a variable for a new name for it, such as Acrobat, and a new category folder such as TextTools. I also pass some .lnk's that I want deleted and a .lnk that it looks for to determine if directory changes and file copies have been made.

Here is why I want to segregate out different routines. A program such as AutoIt has subfolders from the start menu program folder. I can write scripts for each one, but would prefer to have it in one place.

Mind you I am very new to any scripting, and cannot take credit even for writing all of what I am using. Will post code here, if I can figure out the options.

#Region - app organize script -
Opt('TrayIconDebug', 1)
#cs
delcare these variables
 smdir = start menu directory -- what is the default folder name for the app on the start menu
 newcat = new start menu category -- what folder defines the category name that you want to use
 newcatname = new category name -- what do you wish to call the app folder (rename it?)
 scfind = shortcut to find -- what shortcut.lnk are you going to check on to see if copying worked
 delnk1 = delete link -- first shortcut you no longer need in the app folder
 delnk2 - 10 = and so on -- either add more lines if you need them, or;comment out extras
 dedlnk = delete desktop link -- what is the name of the shortcut on the desktop you want removed
 deqlnk = delete quicklaunch link -- what is the name of the quicklaunch link you want removed
#ce
$newcat = "Browsers"
$newcatname = "FireFox"
$smdir = "Mozilla Firefox"
$delnk1 = "Mozilla Firefox (Safe Mode).lnk"
$scfind = "Mozilla Firefox (Safe Mode).lnk"

; Default Startmenu directory.
$directory = $smdir
; Catagory to move shortcuts folder.
$catagory = $newcat
; Show progess. 1 = True, 0 = False
$splash = 1
If _WorkDir() Then
; Copy shortcut folder to catagory, then remove old folder.
    If DirCopy($directory, $catagory & '\' & $newcatname, 1) Then
        DirRemove($directory, 1)
    ; Change to new shortcut directory.
        If FileChangeDir($catagory & '\' & $newcatname) Then
        ; *** NOTE: Just the name of the shortcuts is required for below. ***
        ; Wait for shortcut creation.
            If _ShortcutWait($scfind) Then
            ; Remove unwanted Startmenu shortcuts.
                FileDelete($delnk1)
            ;FileDelete($delnk2)
            ;FileDelete($delnk3)
            ;FileDelete($delnk4)
            ;FileDelete($delnk5)
            ;FileDelete($delnk6)
            ;FileDelete($delnk7)
            ;FileDelete($delnk8)
            ;FileDelete($delnk9)
            ; Remove other unwanted shortcuts.
            ;_Desktop($dedlnk)
            ;_QuickLaunch($deqlnk)
            EndIf
        EndIf
    EndIf
EndIf
_Splash()

#EndRegion
Func _Desktop($shortcut); Delete a Desktop shortcut.
    If FileExists(@DesktopDir & '\' & $shortcut) Then
        If FileChangeDir(@DesktopDir) And FileDelete($shortcut) Then Return 1
    ElseIf FileExists(@DesktopCommonDir & '\' & $shortcut) Then
        If FileChangeDir(@DesktopCommonDir) And FileDelete($shortcut) Then Return 1
    EndIf
EndFunc
Func _QuickLaunch($shortcut); Delete a Quicklaunch shortcut.
    $subdirs = '\Microsoft\Internet Explorer\Quick Launch'
    If FileExists(@AppDataDir & $subdirs & '\' & $shortcut) Then
        If FileChangeDir(@AppDataDir & $subdirs) And FileDelete($shortcut) Then Return 1
    ElseIf FileExists(@AppDataCommonDir & $subdirs & '\' & $shortcut) Then
        If FileChangeDir(@AppDataCommonDir & $subdirs) And FileDelete($shortcut) Then Return 1
    EndIf
EndFunc
Func _ShortcutWait($shortcut); Waits for shortcut existance in startmenu.
    For $i = 1 To 20
        If FileExists($shortcut) Then Return 1
        Sleep(250)
    Next
EndFunc
Func _Splash($text = ''); Shows a small borderless splash message.
    If $splash Then
        If $text Then
            SplashTextOn('', $text, 130, 25, -1, 20, 1, '', 14)
            Return 1
        Else
            SplashOff()
            Return 1
        EndIf
    EndIf
EndFunc
Func _WorkDir(); Change workdir to default Startmenu directory.
    If FileExists(@ProgramsDir & '\' & $directory) Then
        If FileChangeDir(@ProgramsDir) Then Return 1
    ElseIf FileExists(@ProgramsCommonDir & '\' & $directory) Then
        If FileChangeDir(@ProgramsCommonDir) Then Return 1
    EndIf
EndFunc

Hope that works correct. You can see here that FireFox is pretty simple, only one folder.

Can anyone give me a tip as to how I can achieve this?

Thanks,

Sul

Link to comment
Share on other sites

#region and #endregion are there for the "code folding" features of the SciTe editor (see http://www.autoitscript.com/autoit3/SciTe ). You'll find reference to them in the SciTe helpfile once you install it -- which I highly recommend you do as it works very well with AutoIt.

Regarding the writing of reusable code in one place, I'm not following what you want and why Func's (which you oviously know how to write) don't satisfy the need.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

I do have SciTe installed, and that has really helped make the scripting easier. I have seen the #region, will have to check out the docs.

As for the script, like I said, I cannot take credit for writing this. I understand it mostly, and have edited some of it.

I guess what I want to do is this. Here are the variable I want to pass

$newcat = "Browsers"
$newcatname = "FireFox"
$smdir = "Mozilla Firefox"
$delnk1 = "Mozilla Firefox (Safe Mode).lnk"
$scfind = "Mozilla Firefox (Safe Mode).lnk"

That works fine. However, there could also be this

$newcat = "Browsers"
$newcatname = "FireFox"
$smdir = "Mozilla Firefox\Plugins"
$delnk1 = "Mozilla Firefox plugin 1.lnk"
$delnk2 = "Mozilla Firefox plugin 2.lnk"
$delnk3 = "Mozilla Firefox plugin 3.lnk"
$scfind = "Mozilla Firefox plugin 1.lnk"

This is a subfolder, with more .lnk's than the parent folder. It works fine if I put it in a second script. I am wanting to put both entries, with the same variable names into one script. In batch I would make a :section1 and a :section2, and then goto each section, performing the same thing, and using the same variables. I am wondering how to do that with autoit.

I was thinking of just duping the main function, or putting the variable within the function, but frankly I don't really understand the structure of autoit enough yet to fully realize how to do this in the most tidy fashion.

Thanks for the reply,

Sul

Link to comment
Share on other sites

#region and #endregion are there for the "code folding" features of the SciTe editor (see http://www.autoitscript.com/autoit3/SciTe ).  You'll find reference to them in the SciTe helpfile once you install it -- which I highly recommend you do as it works very well with AutoIt.

Regarding the writing of reusable code in one place, I'm not following what you want and why Func's (which you oviously know how to write) don't satisfy the need.

Dale

<{POST_SNAPBACK}>

Just have to say thanks... i've been doing all of my stuff in notepad, and had no complaints with it so i never bothered to try out the SciTe. but i saw your reccomendation to try it out and decided to give it a try. i LOVE the code folding... and the highlighting is something i didn't even realized i missed from an ide...i just installed SciTe at work and will be doing the same as soon as i get home. don't worry, not trying to give you credit for the editor or anything, (unless you had something to do with it, in which case awesome job), but the suggestion is very much appreciated.
Link to comment
Share on other sites

I do have SciTe installed, and that has really helped make the scripting easier. I have seen the #region, will have to check out the docs.

As for the script, like I said, I cannot take credit for writing this. I understand it mostly, and have edited some of it.

I guess what I want to do is this. Here are the variable I want to pass

$newcat = "Browsers"
$newcatname = "FireFox"
$smdir = "Mozilla Firefox"
$delnk1 = "Mozilla Firefox (Safe Mode).lnk"
$scfind = "Mozilla Firefox (Safe Mode).lnk"

That works fine. However, there could also be this

$newcat = "Browsers"
$newcatname = "FireFox"
$smdir = "Mozilla Firefox\Plugins"
$delnk1 = "Mozilla Firefox plugin 1.lnk"
$delnk2 = "Mozilla Firefox plugin 2.lnk"
$delnk3 = "Mozilla Firefox plugin 3.lnk"
$scfind = "Mozilla Firefox plugin 1.lnk"

This is a subfolder, with more .lnk's than the parent folder. It works fine if I put it in a second script. I am wanting to put both entries, with the same variable names into one script. In batch I would make a :section1 and a :section2, and then goto each section, performing the same thing, and using the same variables. I am wondering how to do that with autoit.

I was thinking of just duping the main function, or putting the variable within the function, but frankly I don't really understand the structure of autoit enough yet to fully realize how to do this in the most tidy fashion.

Thanks for the reply,

Sul

<{POST_SNAPBACK}>

I still don't really understand what you are trying to accomplish. If I did I'd be able to help more.

A couple of things that may help you would be 1) variables use in the mail program context (ie. not in a function) are global and cen be seen and used in func's 2) you might want to use an array to load all of your variables into and you can then loop through the contents in your Function and take the appropriate actions (dimension the array to the largest number of items) -- you can check to see if the length of a particular item in the array is 0 and you would know it was empty and not take action on it.

Again, try again to explain what you are trying to accomplish and it will take some of the guess work out.

Dale

@cameronsdad - no, I have nothing to do with SciTe, but JdeB has put a lot of work into customizing it for AutoIt so that is where the thanks belongs...

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Ok, I will try a little better this time.

You can see that I have some variables placed in the script, such as $newcat. You can also see that I am placing the value of those variables in the script in this section

$newcat = "Browsers"
$newcatname = "FireFox"
$smdir = "Mozilla Firefox"
$delnk1 = "Mozilla Firefox (Safe Mode).lnk"
$scfind = "Mozilla Firefox (Safe Mode).lnk"

So, the script runs and deletes, copies, etc. So what I did was take a directory from my start menu\programs that was called "Mozilla Firefox", and basically made a new directory in start menu\programs called "Browsers" and copied the directory "Mozilla Firefox" to that point renaming it "Firefox". Then removed the "Mozilla Firefox" directory from start menu\programs. That leaves me with this: start menu\programs\browsers\firefox.

Now, in the "Firefox" directory COULD be a subdirectory called "Plugins" (start menu\programs\browsers\firefox\plugins). There are also .lnk's in there that I want the function to process as well. In order for the script to do this, as is sits, I must use the same variables as the aforementioned section, like this

$newcat = "Browsers"
$newcatname = "FireFox"
$smdir = "Mozilla Firefox\Plugins"
$delnk1 = "Mozilla Firefox plugin 1.lnk"
$delnk2 = "Mozilla Firefox plugin 2.lnk"
$delnk3 = "Mozilla Firefox plugin 3.lnk"
$scfind = "Mozilla Firefox plugin 1.lnk"

This essentially does the exact same operation. These second variables should run first, so that the subfolder is copied first, thus ensuring the parent folder is there for the first part of the script to find. Conversely I could restructure the $smdir variable to point to the newly made "Firefox" directory instead of the original "Mozilla Firefox" directory. But, that would require writing different functions I believe, and if I am going to do that, I might as well declare some different variables. I guess I am trying to "reuse" those variables into that fuction because they will work as is.

The point is, I want to be able to, in this script, include both sets of values to those variables, but play with the order in which they are called. Obviously you cannot declare the variable twice and expect both values to hold true, as the second set will override the first.

Maybe you can't do this like I have thought, but I sure would like to try.

Umm, is that any clearer? Maybe like mud?

Thanks again for the time,

Sul

Link to comment
Share on other sites

Here is what my limited knowledge has come up with.

I made a dir called "AAA", and subdirs like this: AAA\AAA ; AAA\AAA\AAA ; AAA\ABC . In each are 3 .lnk's. I want to keep one .lnk and delete the rest, while creating a new dir called "ABC app" with a subdir of "ABC app\extras". I want the AAA dir .lnk which I am keeping to stay in "ABC app", and all .lnk's from all other subdirs to go to "ABC app\extras"

Here is the code, but there must be a better way, and besides, the script complains about variables being set at wrong times. When this is parsed before running, does it look inside of functions? I was under the impression that those variables I am redeclaring would not be applied until the function was called, but something isn't right.

Any help? Here is the code. Perhaps this shows what I am trying to do.

#Region - app organize script -
Opt('TrayIconDebug', 1)
#cs
delcare these variables
 directory = start menu directory -- what is the default folder name for the app on the start menu
 catagory = new start menu category -- what folder defines the category name that you want to use
 newcatname = new category name -- what do you wish to call the app folder (rename it?)
 scfind = shortcut to find -- what shortcut.lnk are you going to check on to see if copying worked
 delnk1 = delete link -- first shortcut you no longer need in the app folder
 delnk2 - 10 = and so on -- either add more lines if you need them, or;comment out extras
 dedlnk = delete desktop link -- what is the name of the shortcut on the desktop you want removed
 deqlnk = delete quicklaunch link -- what is the name of the quicklaunch link you want removed
#ce
$v1 = "false"
$v2 = "false"
$v3 = "false"
$v4 = "false"

; Show progess. 1 = True, 0 = False
$splash = 1

If $v1 = "false" Then
    _v1()
Else
    MsgBox(0, "Error", "No values set, exiting noww...")
    Exit
EndIf

If $v1 = "true" And $v2 = "false" Then
    _v2()
Else
    MsgBox(0, "Error", "There was only 1 value, exiting now...")
    Exit
EndIf

If $v2 = "true" And $v3 = "false" Then
    _v3()
Else
    MsgBox(0, "Error", "There were only 2 values, exiting now...")
    Exit
EndIf

If $v3 = "true" And $v4 = "false" Then
    _v4()
Else
    MsgBox(0, "Error", "There were only 3 values, exiting now...")
    Exit
EndIf
Exit

func _v1()
    $directory = "AAA\BBB"
    $catagory = "ABC app"
    $newcatname = "ABC\extras"
    $delnk1 = "Solitaire2b.lnk"
    $delnk2 = "Solitaire3b.lnk"
    $scfind = "Solitaire2b.lnk"
    _SMstart()
    $v1 = "true"
EndFunc

Func _v2()
    $directory = "AAA\AAA\AAA"
    $catagory = "ABC app"
    $newcatname = "ABC\extras"
    $delnk1 = "Solitaire2aaa.lnk"
    $delnk2 = "Solitaire3aaa.lnk"
    $scfind = "Solitaire2aaa.lnk"
    _SMstart()
    $v2 = "true"
EndFunc

Func _v3()
    $directory = "AAA\AAA"
    $catagory = "ABC app"
    $newcatname = "ABC\extras"
    $delnk1 = "Solitaire2aa.lnk"
    $delnk2 = "Solitaire3aa.lnk"
    $scfind = "Solitaire2aa.lnk"
    _SMstart()
    $v3 = "true"
EndFunc

Func _v4()
    $directory = "AAA"
    $catagory = "ABC app"
    $newcatname = "ABC"
    $delnk1 = "Solitaire2a.lnk"
    $delnk2 = "Solitaire3a.lnk"
    $scfind = "Solitaire2a.lnk"
    _SMstart()
    $v4 = "true"
EndFunc



Func _SMstart();Start the routine
    If _WorkDir() Then
    ; Copy shortcut folder to catagory, then remove old folder.
        If DirCopy($directory, $catagory & '\' & $newcatname, 1) Then
            DirRemove($directory, 1)
        ; Change to new shortcut directory.
            If FileChangeDir($catagory & '\' & $newcatname) Then
            ; *** NOTE: Just the name of the shortcuts is required for below. ***
            ; Wait for shortcut creation.
                If _ShortcutWait($scfind) Then
                ; Remove unwanted Startmenu shortcuts.
                    FileDelete($delnk1)
                    FileDelete($delnk2)
                ;FileDelete($delnk3)
                ;FileDelete($delnk4)
                ;FileDelete($delnk5)
                ;FileDelete($delnk6)
                ;FileDelete($delnk7)
                ;FileDelete($delnk8)
                ;FileDelete($delnk9)
                ; Remove other unwanted shortcuts.
                ;_Desktop($dedlnk)
                ;_QuickLaunch($deqlnk)
                EndIf
            EndIf
        EndIf
    EndIf
EndFunc
_Splash()

#EndRegion
Func _Desktop($shortcut); Delete a Desktop shortcut.
    If FileExists(@DesktopDir & '\' & $shortcut) Then
        If FileChangeDir(@DesktopDir) And FileDelete($shortcut) Then Return 1
    ElseIf FileExists(@DesktopCommonDir & '\' & $shortcut) Then
        If FileChangeDir(@DesktopCommonDir) And FileDelete($shortcut) Then Return 1
    EndIf
EndFunc
Func _QuickLaunch($shortcut); Delete a Quicklaunch shortcut.
    $subdirs = '\Microsoft\Internet Explorer\Quick Launch'
    If FileExists(@AppDataDir & $subdirs & '\' & $shortcut) Then
        If FileChangeDir(@AppDataDir & $subdirs) And FileDelete($shortcut) Then Return 1
    ElseIf FileExists(@AppDataCommonDir & $subdirs & '\' & $shortcut) Then
        If FileChangeDir(@AppDataCommonDir & $subdirs) And FileDelete($shortcut) Then Return 1
    EndIf
EndFunc
Func _ShortcutWait($shortcut); Waits for shortcut existance in startmenu.
    For $i = 1 To 20
        If FileExists($shortcut) Then Return 1
        Sleep(250)
    Next
EndFunc
Func _Splash($text = ''); Shows a small borderless splash message.
    If $splash Then
        If $text Then
            SplashTextOn('', $text, 130, 25, -1, 20, 1, '', 14)
            Return 1
        Else
            SplashOff()
            Return 1
        EndIf
    EndIf
EndFunc
Func _WorkDir(); Change workdir to default Startmenu directory.
    If FileExists(@ProgramsDir & '\' & $directory) Then
        If FileChangeDir(@ProgramsDir) Then Return 1
    ElseIf FileExists(@ProgramsCommonDir & '\' & $directory) Then
        If FileChangeDir(@ProgramsCommonDir) Then Return 1
    EndIf
EndFunc
Link to comment
Share on other sites

Was able to figure it out. Had to declare the variables global at the start, because the scope within a function is only local, and is destroyed upon endfunc. It would seem that when declared within that function, it could not pass it to another function within itself. Declaring it Globally fixed that. Here is the code now in case anyone has any good tips on how to shorten it up or has a better way.

Thanks for any replies,

Sul.

#Region - app organize script -
Opt('TrayIconDebug', 1)
#cs
delcare these variables
 directory = start menu directory -- what is the default folder name for the app on the start menu
 catagory = new start menu category -- what folder defines the category name that you want to use
 newcatname = new category name -- what do you wish to call the app folder (rename it?)
 scfind = shortcut to find -- what shortcut.lnk are you going to check on to see if copying worked
 delnk1 = delete link -- first shortcut you no longer need in the app folder
 delnk2 - 10 = and so on -- either add more lines if you need them, or;comment out extras
 dedlnk = delete desktop link -- what is the name of the shortcut on the desktop you want removed
 deqlnk = delete quicklaunch link -- what is the name of the quicklaunch link you want removed
#ce
Global $directory
Global $catagory
Global $newcatname
Global $delnk1
Global $delnk2
Global $scfind

$v1 = "false"
$v2 = "false"
$v3 = "false"
$v4 = "false"

; Show progess. 1 = True, 0 = False
$splash = 1

If $v1 = "false" Then
    _v1()
Else
    MsgBox(0, "Error", "No values set, exiting noww...")
    Exit
EndIf

If $v1 = "true" And $v2 = "false" Then
    _v2()
Else
    MsgBox(0, "Error", "There was only 1 value, exiting now...")
    Exit
EndIf

If $v2 = "true" And $v3 = "false" Then
    _v3()
Else
    MsgBox(0, "Error", "There were only 2 values, exiting now...")
    Exit
EndIf

If $v3 = "true" And $v4 = "false" Then
    _v4()
Else
    MsgBox(0, "Error", "There were only 3 values, exiting now...")
    Exit
EndIf
Exit

func _v1()
    $directory = "AAA\BBB"
    $catagory = "ABC app"
    $newcatname = "ABC\extras"
    $delnk1 = "Solitaire2b.lnk"
    $delnk2 = "Solitaire3b.lnk"
    $scfind = "Solitaire2b.lnk"
    _SMstart()
    $v1 = "true"
EndFunc

Func _v2()
    $directory = "AAA\AAA\AAA"
    $catagory = "ABC app"
    $newcatname = "ABC\extras"
    $delnk1 = "Solitaire2aaa.lnk"
    $delnk2 = "Solitaire3aaa.lnk"
    $scfind = "Solitaire2aaa.lnk"
    _SMstart()
    $v2 = "true"
EndFunc

Func _v3()
    $directory = "AAA\AAA"
    $catagory = "ABC app"
    $newcatname = "ABC\extras"
    $delnk1 = "Solitaire2aa.lnk"
    $delnk2 = "Solitaire3aa.lnk"
    $scfind = "Solitaire2aa.lnk"
    _SMstart()
    $v3 = "true"
EndFunc

Func _v4()
    $directory = "AAA"
    $catagory = "ABC app"
    $newcatname = "ABC"
    $delnk1 = "Solitaire2a.lnk"
    $delnk2 = "Solitaire3a.lnk"
    $scfind = "Solitaire2a.lnk"
    _SMstart()
    $v4 = "true"
EndFunc

Func _SMstart();Start the routine
    If _WorkDir() Then
    ; Copy shortcut folder to catagory, then remove old folder.
        If DirCopy($directory, $catagory & '\' & $newcatname, 1) Then
            DirRemove($directory, 1)
        ; Change to new shortcut directory.
            If FileChangeDir($catagory & '\' & $newcatname) Then
            ; *** NOTE: Just the name of the shortcuts is required for below. ***
            ; Wait for shortcut creation.
                If _ShortcutWait($scfind) Then
                ; Remove unwanted Startmenu shortcuts.
                    FileDelete($delnk1)
                    FileDelete($delnk2)
                ;FileDelete($delnk3)
                ;FileDelete($delnk4)
                ;FileDelete($delnk5)
                ;FileDelete($delnk6)
                ;FileDelete($delnk7)
                ;FileDelete($delnk8)
                ;FileDelete($delnk9)
                ; Remove other unwanted shortcuts.
                ;_Desktop($dedlnk)
                ;_QuickLaunch($deqlnk)
                EndIf
            EndIf
        EndIf
    EndIf
EndFunc
_Splash()

#EndRegion
Func _Desktop($shortcut); Delete a Desktop shortcut.
    If FileExists(@DesktopDir & '\' & $shortcut) Then
        If FileChangeDir(@DesktopDir) And FileDelete($shortcut) Then Return 1
    ElseIf FileExists(@DesktopCommonDir & '\' & $shortcut) Then
        If FileChangeDir(@DesktopCommonDir) And FileDelete($shortcut) Then Return 1
    EndIf
EndFunc
Func _QuickLaunch($shortcut); Delete a Quicklaunch shortcut.
    $subdirs = '\Microsoft\Internet Explorer\Quick Launch'
    If FileExists(@AppDataDir & $subdirs & '\' & $shortcut) Then
        If FileChangeDir(@AppDataDir & $subdirs) And FileDelete($shortcut) Then Return 1
    ElseIf FileExists(@AppDataCommonDir & $subdirs & '\' & $shortcut) Then
        If FileChangeDir(@AppDataCommonDir & $subdirs) And FileDelete($shortcut) Then Return 1
    EndIf
EndFunc
Func _ShortcutWait($shortcut); Waits for shortcut existance in startmenu.
    For $i = 1 To 20
        If FileExists($shortcut) Then Return 1
        Sleep(250)
    Next
EndFunc
Func _Splash($text = ''); Shows a small borderless splash message.
    If $splash Then
        If $text Then
            SplashTextOn('', $text, 130, 25, -1, 20, 1, '', 14)
            Return 1
        Else
            SplashOff()
            Return 1
        EndIf
    EndIf
EndFunc
Func _WorkDir(); Change workdir to default Startmenu directory.
    If FileExists(@ProgramsDir & '\' & $directory) Then
        If FileChangeDir(@ProgramsDir) Then Return 1
    ElseIf FileExists(@ProgramsCommonDir & '\' & $directory) Then
        If FileChangeDir(@ProgramsCommonDir) Then Return 1
    EndIf
EndFunc
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...