Sign in to follow this  
Followers 0
rdwray

Having problems running windows 7 OS programs

30 posts in this topic

#1 ·  Posted (edited)

Yes, I have looked in this forum. Here is a command that I cannot get to work. I have tried with shortcuts, AutoIt's FileCreateShortcut and batch files. I put a full day into this and everything has failed. Is there a way? BTW: OS is Win 7 HP 64bit. Thanks...

%windir%\system32\dfrgui.exe

Edited by rdwray

“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Share this post


Link to post
Share on other sites



rdwray,

Have you used Opt("ExpandEnvStrings", 1) so that %windir% is properly expanded in the string? :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Ahh. The master control panel. I actually made a batch file to do this, along with other windows secrets.

Just one minute, lets see if I can find it.

Here we go, in batch the Master Control Panel is made using this command:

Monster Control Panel.{ED7BA470-8E54-465E-825C-99712043E01C}

Therefore, in AutoIt, it is made as follows:

DirCreate((path)\Monster Control Panel.{ED7BA470-8E54-465E-825C-99712043E01C}")

As for the shortcut, you are on the right track. Refer to the above comment.

shanet

Edited by shanet

[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:
%programfiles%/AutoIt3/autoit3.chm

Share this post


Link to post
Share on other sites

rdwray,

Have you used Opt("ExpandEnvStrings", 1) so that %windir% is properly expanded in the string? :x

M23

M23, If it exists, I have tried it...

Thanks....


“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Share this post


Link to post
Share on other sites

Ahh. The master control panel. I actually made a batch file to do this, along with other windows secrets.

Just one minute, lets see if I can find it.

Here we go, in batch the Master Control Panel is made using this command:

Monster Control Panel.{ED7BA470-8E54-465E-825C-99712043E01C}

Therefore, in AutoIt, it is made as follows:

DirCreate((path)\Monster Control Panel.{ED7BA470-8E54-465E-825C-99712043E01C}")

As for the shortcut, you are on the right track. Refer to the above comment.

shanet

Thanks shanet, but I have that command. My goal is to open defragment directly.

“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Share this post


Link to post
Share on other sites

In vista and windows 7 much that could be done with defragmenter was taken out like the -w switch for eg which leaves large fragments left untouched

Its pretty much a waste of time now

Defraggler is a better solution and has command line options to get the job done, and its free

It can be installed silently with the Defraggler - Slim Build, look on the builds page for the download

http://www.piriform.com/defraggler

Share this post


Link to post
Share on other sites

Since the previous does not work, why does this fail?

$file = FileGetShortcut("F:\Backup\Common\ShortCuts\Disk Defragmenter.lnk")
MsgBox(0, "", $file[0])
Run($file[0])


“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I guess I don't understand what the problem is. Are you having trouble running Defrag or creating a shortcut or what?

run (@SystemDir & "\dfrgui.exe") ;runs defragmenter
FileCreateShortcut(@SystemDir & "\dfrgui.exe", @DesktopDir &"\Disk Defragmenter.lnk", @SystemDir) ;creates a working shortcut

Edit: This worked with Win 7 32 bit. I don't have 64 bit at work to play with.

Edited by sleepydvdr

#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

I guess I don't understand what the problem is. Are you having trouble running Defrag or creating a shortcut or what?

run (@SystemDir & "\dfrgui.exe") ;runs defragmenter
FileCreateShortcut(@SystemDir & "\dfrgui.exe", @DesktopDir &"\Disk Defragmenter.lnk", @SystemDir) ;creates a working shortcut

Edit: This worked with Win 7 32 bit. I don't have 64 bit at work to play with.

It will create the shortcut and the shortcut works, but with double clicking the shortcut, it will not run defrag. If there was a way to double click the shortcut or program name???????

“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Share this post


Link to post
Share on other sites

I'm at home now and just tried it out on my Win 7 64 bit system and defrag works with the shortcut it created. Perhaps your UAC is set to high security.

Also, have you considered bypassing the GUI with unattended defrag parameters?

http://www.winhelponline.com/blog/new-defrag-cmd-line-parameters-windows-7/


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

I'm at home now and just tried it out on my Win 7 64 bit system and defrag works with the shortcut it created. Perhaps your UAC is set to high security.

Also, have you considered bypassing the GUI with unattended defrag parameters?

http://www.winhelponline.com/blog/new-defrag-cmd-line-parameters-windows-7/

Yes, the shortcut does work. What I am after is some way to run defrag with a button.

“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Share this post


Link to post
Share on other sites

Still not 100% sure what you are wanting. How about these ideas?

$Shortcutpath = FileGetShortcut(@DesktopDir & "\Disk Defragmenter.lnk")
run ($Shortcutpath[0])
WinWaitActive("Disk Defragmenter")
send ("d")

Or

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 214, 78)
$Button1 = GUICtrlCreateButton("Defrag", 72, 24, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            run (@SystemDir & "\defrag.exe /A c: ")
    EndSwitch
WEnd

#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

Yep sleepydvdr, I am still waiting. I tried both and they didn't work. Defrag.exe is DOS based and I am sure that would take a command window which can be accessed via a .bat file. I guess MS has got the upper hand on this one "also"....


“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Share this post


Link to post
Share on other sites

I just tried compiling both of the last 2 scripts I posted as 32 bit and 64 bit. When I compiled as 32 bit, neither worked. But they did work when I compiled as 64 bit. If that works and you still want to compile your script as 32 bit, you could use @OSArch to determine if the OS is 64 bit and start a 64 bit exe.


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

Sleepydvdr's scripts will run defrag, the only thing is though, the -a or /A command line switch only analyzes the disk but doesn't actually defrag the drive. If you take out the /A it will defrag the drive by clicking the button.


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

Share this post


Link to post
Share on other sites

I have been doing some research on this problem and found out that AutoHotKey's "Run" will run Dfrgui.exe so there has to be a bug in AutoIt. Does anyone have a resolve on how to handle this issue or do I move to AutoHotKey???? thanks....


“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Share this post


Link to post
Share on other sites

I have been doing some research on this problem and found out that AutoHotKey's "Run" will run Dfrgui.exe so there has to be a bug in AutoIt. Does anyone have a resolve on how to handle this issue or do I move to AutoHotKey???? thanks....

Yeah, that's it, a bug. Can't be anything else because of your research.

I've done no research and just tried to think with premise that you aren't the brightest bulb.

DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", 0)
Run("dfrgui.exe")
DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", 1)
;...

Good luck with AutoHotKey.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Yeah, that's it, a bug. Can't be anything else because of your research.

I've done no research and just tried to think with premise that you aren't the brightest bulb.

DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", 0)
Run("dfrgui.exe")
DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", 1)
;...

Good luck with AutoHotKey.

Well trancexx, since you evidently more intelligent than I am, how about explaining why one works and the other one doesn't? You have got me in suspense - my bulb is almost out.

“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Share this post


Link to post
Share on other sites

Well trancexx, since you evidently more intelligent than I am, how about explaining why one works and the other one doesn't? You have got me in suspense - my bulb is almost out.

Very nice.

...Usually people start crying when I say something like that.

Do you mean why it works with disabled redirection?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Very nice.

...Usually people start crying when I say something like that.

Do you mean why it works with disabled redirection?

No, why does the Run function in AutoIt fail when AutoHotKey works? I came from AHK to AutoIt because of better formatting and it was my understanding that both compilers were the same at one time.

“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Share this post


Link to post
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
Sign in to follow this  
Followers 0