Jump to content

Problems running in Vista


DickG
 Share

Recommended Posts

I have code that runs fine on my own WinXP system. But when I send it to a friend who uses Vista, he gets problems that I don't get, and can't figure out why. I'm hoping some of you guys might have run into this before and have a solution.

===================================

Problem #1: Creating new folder in Program Files folder.

===================================

If I run this code:

Dim $FileDir = @ProgramFilesDir & "\DickGirard\"
    
;If secified folder does not exist, create it.
If FileExists($FileDir) Then
    ;Do nothing.
Else
    DirCreate($FileDir)
EndIf
    
;Test to make sure new folder was created.
If FileExists($FileDir) Then
    ;Do nothing.
Else
    MsgBox(0, "Problem", @ProgramFilesDir & " could not be created.")
    Exit
EndIf

It runs fine on my system, but gives him an error about an array value, yet the $Output is virtually the same on my system and his system. The difference is that he gets the IPV6 type of info, but that should be ignored by the StringRegExp.

Sometimes he also gets the first IP found by StringRegExp instead of the third. I am baffled by what to do. I've tried everything I know (which ain't much). [i'm not a trained programmer, just an experienced self-taught scripter.]

Any ideas on what the problem could be?

Regards,

Dick

Link to comment
Share on other sites

I have code that runs fine on my own WinXP system. But when I send it to a friend who uses Vista, he gets problems that I don't get, and can't figure out why. I'm hoping some of you guys might have run into this before and have a solution.

===================================

Problem #1: Creating new folder in Program Files folder.

===================================

If I run this code:

Dim $FileDir = @ProgramFilesDir & "\DickGirard\"
    
;If secified folder does not exist, create it.
If FileExists($FileDir) Then
    ;Do nothing.
Else
    DirCreate($FileDir)
EndIf
    
;Test to make sure new folder was created.
If FileExists($FileDir) Then
    ;Do nothing.
Else
    MsgBox(0, "Problem", @ProgramFilesDir & " could not be created.")
    Exit
EndIf

It runs fine on my system, but gives him an error about an array value, yet the $Output is virtually the same on my system and his system. The difference is that he gets the IPV6 type of info, but that should be ignored by the StringRegExp.

Sometimes he also gets the first IP found by StringRegExp instead of the third. I am baffled by what to do. I've tried everything I know (which ain't much). [i'm not a trained programmer, just an experienced self-taught scripter.]

Any ideas on what the problem could be?

Regards,

Dick

hmm thats different, I am running it on vista (1st one) and its not working, I will try and figure out why :) lol
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

I just tried the first one on my Vista machine, and it worked fine, but then I'm running as administrator on a test machine, with UAC turned off.

Kerros

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

what might UAC be, and where can I find it? :)

UAC is User Account Control, I turn it off from MSConfig, under the tools tab.

Here is a site that gives different ways to disable it. There appears to be a registry entry, but I can't confirm that it works.

Disable UAC

I also tried the second script, and the example code is missing three variables. If you want to provide those I'll try it on my machine again.

$STDERR_CHILD + $STDOUT_CHILD

I'm assuming $output = ""

Kerros

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

As a "quick 'n dirty" fix, add

#RequireAdmin
to the top of your script. Your friend running Vista will get a "Do you want to let this program run" prompt when they launch it (same as any installation routine would ask), then when they click yes, it should run fine.

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

UAC is User Account Control, I turn it off from MSConfig, under the tools tab.

Here is a site that gives different ways to disable it. There appears to be a registry entry, but I can't confirm that it works.

Disable UAC

I also tried the second script, and the example code is missing three variables. If you want to provide those I'll try it on my machine again.

$STDERR_CHILD + $STDOUT_CHILD

I'm assuming $output = ""

Kerros

thanks, reset time :)
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

As a "quick 'n dirty" fix, add

#RequireAdmin
to the top of your script. Your friend running Vista will get a "Do you want to let this program run" prompt when they launch it (same as any installation routine would ask), then when they click yes, it should run fine.
your right, it did

EDIT

I dont know how to do this, but try it out :)

if UAC = 1 then

#requireadmin

endif

Edited by ReaImDown
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

your right, it did

EDIT

I dont know how to do this, but try it out :)

if UAC = 1 then

#requireadmin

endif

If you check that website with the registry entry, you can do a regread against that, and then do the if statement.

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

I already have thae #requireadmin command there. Also, my friend (with Vista) logs in as Admin (it's his own personal computer) and approves the exe.

Strange problem, and since I don't have Vista, I can't test anything on it to what the problem is.

[Yeah, I hate Vista also.]

Dick

As a "quick 'n dirty" fix, add

#RequireAdmin
to the top of your script. Your friend running Vista will get a "Do you want to let this program run" prompt when they launch it (same as any installation routine would ask), then when they click yes, it should run fine.
Link to comment
Share on other sites

Well, I finally figured it out.

I had two problems:

Problem 1: I had #requireadmin in my main exe, but not in the installer exe! Arrgghhh!! Once that dawned on me, I put that in, and my friend was finally able to get it installed on his Vista.

Problem 2: I was using a reg expression I got from one of these posts, where it showed "[0-9][0-9]?[0-9]?.[0-9][0-9]?[0-9]?.[0-9][0-9]?[0-9]?.[0-9][0-9]" for StringRegExp. That turned out to be wrong.

After trying it in Expresso (which I had not done before but just took it "on faith"), sure enough it found the wrong values that were causing the error.

I then used the expression for finding an IP address that came right from the Expresso tutorial, which is: "(\d{1,3}\.){3}\d{1,3}", and it worked like a charm.

Man, Expresso is great tool. It has really helped me a lot. Thanks to Ultrapico for a great tool!

And thanks to you guys too. You helped me focus on the #requireadmin part, which I had not realized I did not include in my installer. Lessons learned.

Dick

I already have thae #requireadmin command there. Also, my friend (with Vista) logs in as Admin (it's his own personal computer) and approves the exe.

Strange problem, and since I don't have Vista, I can't test anything on it to what the problem is.

[Yeah, I hate Vista also.]

Dick

Link to comment
Share on other sites

Update: I discovered that the last expression I used for finding a valid IP address also wasn't working real good. I wanted it to find complete addresses rather than pieces.

So I changed the expression to: (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})

Example code to find IP addresses from a ping:

#include <Constants.au3>

$pid = Run(@ComSpec & " /c " & 'ipconfig', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
ProcessWaitClose($pid, 10); Wait up to 10 seconds.
$Output &= StdoutRead($pid); Save output.
$Result = StringRegExp($Output,"(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", 3)

;For testing purposes to see the 1st three IPs found.
MsgBox(0, "ipconfig: RouterIP", "Result[0] = " & $Result[0])
MsgBox(0, "ipconfig: RouterIP", "Result[1] = " & $Result[1])
MsgBox(0, "ipconfig: RouterIP", "Result[2] = " & $Result[2])

;The 3rd IP ($Result[2]) should be the router's IP.
$routerIP = $Result[2]
MsgBox(0, "RouterIP", $routerIP)

This works like a charm.

Dick

Well, I finally figured it out.

I had two problems:

Problem 1: I had #requireadmin in my main exe, but not in the installer exe! Arrgghhh!! Once that dawned on me, I put that in, and my friend was finally able to get it installed on his Vista.

Problem 2: I was using a reg expression I got from one of these posts, where it showed "[0-9][0-9]?[0-9]?.[0-9][0-9]?[0-9]?.[0-9][0-9]?[0-9]?.[0-9][0-9]" for StringRegExp. That turned out to be wrong.

After trying it in Expresso (which I had not done before but just took it "on faith"), sure enough it found the wrong values that were causing the error.

I then used the expression for finding an IP address that came right from the Expresso tutorial, which is: "(\d{1,3}\.){3}\d{1,3}", and it worked like a charm.

Man, Expresso is great tool. It has really helped me a lot. Thanks to Ultrapico for a great tool!

And thanks to you guys too. You helped me focus on the #requireadmin part, which I had not realized I did not include in my installer. Lessons learned.

Dick

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...